home: Move waybar exec commands into scripts
This commit is contained in:
parent
e6f12b0b76
commit
b5616501b2
|
@ -273,8 +273,20 @@ in
|
|||
};
|
||||
"custom/redshift" = {
|
||||
interval = 10;
|
||||
exec = "systemctl --user show redshift | grep -q ActiveState=active && echo '{\"tooltip\": \"Redshift active\", \"class\": \"active\"}' || echo '{\"tooltip\": \"Redshift inactive\", \"class\": \"inactive\"}'";
|
||||
on-click = "systemctl --user show redshift | grep -q ActiveState=active && systemctl --user stop redshift || systemctl --user start redshift";
|
||||
exec = pkgs.writeShellScript "waybar-redshift-state" ''
|
||||
if systemctl --user show redshift | grep -q ActiveState=active; then
|
||||
echo '{"tooltip": "Redshift active", "class": "active"}'
|
||||
else
|
||||
echo '{"tooltip": "Redshift inactive", "class": "inactive"}'
|
||||
fi
|
||||
'';
|
||||
on-click = pkgs.writeShellScript "waybar-redshift-toggle" ''
|
||||
if systemctl --user show redshift | grep -q ActiveState=active; then
|
||||
systemctl --user stop redshift
|
||||
else
|
||||
systemctl --user start redshift
|
||||
fi
|
||||
'';
|
||||
return-type = "json";
|
||||
format = "";
|
||||
tooltip = false;
|
||||
|
@ -347,7 +359,12 @@ in
|
|||
};
|
||||
"custom/vpn" = {
|
||||
interval = 10;
|
||||
exec = "ip -j link | jq --unbuffered --compact-output '[[.[].ifname | select(. | startswith(\"mullvad\"))][] | split(\"-\")[1] + \" ${thinsp}\"] as $conns | { text: ($conns[0] // \"\"), class: (if $conns | length > 0 then \"connected\" else \"disconnected\" end) }'";
|
||||
exec = pkgs.writeShellScript "vpn-state" ''
|
||||
ip -j link \
|
||||
| jq --unbuffered --compact-output '
|
||||
[[.[].ifname | select(. | startswith("mullvad"))][] | split("-")[1] + " ${thinsp}"] as $conns
|
||||
| { text: ($conns[0] // ""), class: (if $conns | length > 0 then "connected" else "disconnected" end) }'
|
||||
'';
|
||||
return-type = "json";
|
||||
format = "{}";
|
||||
tooltip = false;
|
||||
|
|
Loading…
Reference in a new issue