From 1e72b33cc65a1f4b75f6b6d40b07062862454cef Mon Sep 17 00:00:00 2001 From: Crony Akatsuki Date: Wed, 12 Feb 2025 19:13:28 +0100 Subject: [PATCH] Add binding to toggle vpn connection. --- modules/home-manager/hyprland.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/home-manager/hyprland.nix b/modules/home-manager/hyprland.nix index 3eaa6cb..f0d32ca 100644 --- a/modules/home-manager/hyprland.nix +++ b/modules/home-manager/hyprland.nix @@ -59,6 +59,18 @@ esac ''; grim = "${pkgs.grim}/bin/grim"; + vpn-toggle = pkgs.writeShellScriptBin "vpn-toggle" '' + #!/usr/bin/env sh + + if [ "$(nmcli --overview -f GENERAL.STATE connection show hetz)" = "" ]; then + nmcli con up hetz + notify-send "VPN" "UP" + else + nmcli con down hetz + notify-send "VPN" "DOWN" + fi + + ''; in { options = { crony.hyprland.enable = lib.mkEnableOption "Enable hyprland and configure it for me"; @@ -381,6 +393,7 @@ in { "$mod, G, exec, ${hyprgamemode}/bin/gamemode" "$mod, F1, exec, ${toggle-sound-output}/bin/toggle-sound-output" "$mod SHIFT, E, exec, ${power-menu}/bin/power-menu" + "$mod, w, exec, ${vpn-toggle}/bin/vpn-toggle" "$mod, F12, exec, ${grim} $HOME/Pictures/screenshots/$(date +'%s_grim.png')"