summaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorXiao Pan <gky44px1999@gmail.com>2024-02-23 18:17:46 -0800
committerXiao Pan <gky44px1999@gmail.com>2024-02-23 18:17:46 -0800
commit4299615002711bfc2e2ce9477c05dc3839161c50 (patch)
tree3f0c28a504845cf317a4b892811e937caad15b47 /sh
parenta8e21184857f8d7ddfa06251516b39d301ea4dc2 (diff)
faster and less code
Diffstat (limited to 'sh')
-rwxr-xr-xsh/sbar15
1 files changed, 5 insertions, 10 deletions
diff --git a/sh/sbar b/sh/sbar
index 18c62f1..be63b44 100755
--- a/sh/sbar
+++ b/sh/sbar
@@ -15,16 +15,11 @@ update_time () {
update_net () {
net="$(if nmcli -t --fields type,state device | grep -q '^\(ethernet\|wifi\):connected$'; then echo 1; else echo 0; fi)"
- nm_device_state="$(nmcli -t --fields device,state device)"
- vpn="$(
- if echo "$nm_device_state" | grep -q '^wg_ka:connected$'; then
- echo K
- elif echo "$nm_device_state" | grep -q '^wg_studio:connected$'; then
- echo S
- else
- echo 0
- fi
- )"
+ case "$(nmcli -t --fields device,state device)" in
+ *wg_ka:connected*) vpn=K;;
+ *wg_studio:connected*) vpn=S;;
+ *) vpn=0;;
+ esac
}
update_vol () {