pinwheel: Add warning in waybar when work-vpn is on

This commit is contained in:
Alexander Heldt
2023-10-01 22:41:11 +02:00
parent 776288f61e
commit 65de54d4bf
2 changed files with 25 additions and 3 deletions

View File

@@ -79,6 +79,11 @@ let
esac
'';
work-vpn-status = pkgs.writeShellScript "work-vpn-status" ''
ON=$(ls /tmp | grep work-vpn-on | wc -l)
[ "$ON" -gt 0 ] && echo "WORK-VPN ON"
'';
toggle-bt-power = pkgs.writeShellScript "toggle-bt-power" ''
POWERED_ON=$(bluetoothctl show | grep "Powered: yes")
if [ -z "$POWERED_ON" ]; then
@@ -104,7 +109,7 @@ in
output = [ "eDP-1" ];
modules-left = [ "hyprland/workspaces" ];
modules-right = [ "custom/spotify" "custom/dunst" "custom/mullvad" "bluetooth" "wireplumber" "network" "battery" "clock" ];
modules-right = [ "custom/work-vpn-status" "custom/spotify" "custom/dunst" "custom/mullvad" "bluetooth" "wireplumber" "network" "battery" "clock" ];
"custom/spotify" = {
exec = spotify-status;
@@ -120,6 +125,11 @@ in
tooltip = false;
};
"custom/work-vpn-status" = {
exec = "${work-vpn-status}";
interval = 1;
};
"custom/mullvad" = {
exec = "${mullvad} --output";
return-type = "json";
@@ -174,7 +184,12 @@ in
output = [ "HDMI-A-1" ];
modules-left = [ "hyprland/workspaces" ];
modules-right = [ "clock" ];
modules-right = [ "custom/work-vpn-status" "clock" ];
"custom/work-vpn-status" = {
exec = "${work-vpn-status}";
interval = 1;
};
"clock" = {
"interval" = 1;
@@ -188,6 +203,7 @@ in
foreground = "#f9c22b";
foreground-dim = "#a57b06";
background = "#262626";
warning = "#FF6969";
in
''
* {
@@ -219,6 +235,10 @@ in
background-color: ${background};
}
#custom-work-vpn-status {
color: ${warning};
}
#clock {
margin-right: 10px;
}

View File

@@ -9,6 +9,7 @@ let
pkgs.writeShellApplication {
name = "work-vpn";
text = ''
touch /tmp/work-vpn-on; \
sudo \
${pkgs.openvpn}/bin/openvpn \
--script-security 2 \
@@ -17,7 +18,8 @@ let
--down ${pkgs.update-systemd-resolved}/libexec/openvpn/update-systemd-resolved \
--down-pre \
--config ${ovpnconfig} \
--auth-user-pass ${userpass}
--auth-user-pass ${userpass}; \
rm /tmp/work-vpn-on
'';
};
in