diff --git a/hosts/pinwheel/modules/waybar/default.nix b/hosts/pinwheel/modules/waybar/default.nix index c34adf2..605967a 100644 --- a/hosts/pinwheel/modules/waybar/default.nix +++ b/hosts/pinwheel/modules/waybar/default.nix @@ -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; } diff --git a/hosts/pinwheel/modules/work/default.nix b/hosts/pinwheel/modules/work/default.nix index 43500c6..0dc0e4c 100644 --- a/hosts/pinwheel/modules/work/default.nix +++ b/hosts/pinwheel/modules/work/default.nix @@ -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