From c233b5a11aecbf36de6d7e399616e09f70501ed0 Mon Sep 17 00:00:00 2001 From: Nikolaos Karaolidis Date: Thu, 22 May 2025 17:01:46 +0100 Subject: [PATCH] Update keybinds Signed-off-by: Nikolaos Karaolidis --- .../configs/user/gui/hyprshot/default.nix | 11 +++++-- .../configs/user/gui/spicetify/default.nix | 4 --- hosts/himalia/hardware/default.nix | 5 +++- hosts/himalia/hardware/keybinds.nix | 30 +++++++++++++++++++ hosts/himalia/hardware/touchpad-helper.sh | 22 ++++++++++++++ 5 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 hosts/himalia/hardware/keybinds.nix create mode 100644 hosts/himalia/hardware/touchpad-helper.sh diff --git a/hosts/common/configs/user/gui/hyprshot/default.nix b/hosts/common/configs/user/gui/hyprshot/default.nix index 6f63950..09fed03 100644 --- a/hosts/common/configs/user/gui/hyprshot/default.nix +++ b/hosts/common/configs/user/gui/hyprshot/default.nix @@ -34,9 +34,16 @@ in [ ", Print, exec, ${hyprshot} -m output -m active -f ${filename}" - "Shift, Print, exec, ${hyprshot} -m output -m active -f ${filename} -- ${swappyWrapper}" + "Ctrl, Print, exec, ${hyprshot} -m output -m active -f ${filename} -- ${swappyWrapper}" + + "$mod, s, exec, ${hyprshot} -m output -m active -f ${filename}" + "$mod_Ctrl, s, exec, ${hyprshot} -m output -m active -f ${filename} -- ${swappyWrapper}" + ", XF86SelectiveScreenshot, exec, ${hyprshot} -m region -z -f ${filename}" - "Shift, XF86SelectiveScreenshot, exec, ${hyprshot} -m region -z -f ${filename} -- ${swappyWrapper}" + "Ctrl, XF86SelectiveScreenshot, exec, ${hyprshot} -m region -z -f ${filename} -- ${swappyWrapper}" + + "$mod_Shift, S, exec, ${hyprshot} -m region -z -f ${filename}" + "$mod_Shift_Ctrl, S, exec, ${hyprshot} -m region -z -f ${filename} -- ${swappyWrapper}" ]; }; } diff --git a/hosts/common/configs/user/gui/spicetify/default.nix b/hosts/common/configs/user/gui/spicetify/default.nix index 53db2ee..698b642 100644 --- a/hosts/common/configs/user/gui/spicetify/default.nix +++ b/hosts/common/configs/user/gui/spicetify/default.nix @@ -87,9 +87,5 @@ in }; theme.template."${home}/.config/spotify/theme.css".source = ./theme.css; - - wayland.windowManager.hyprland.settings.bind = [ - "$mod, s, exec, ${lib.meta.getExe hmConfig.programs.spicetify.spicedSpotify}" - ]; }; } diff --git a/hosts/himalia/hardware/default.nix b/hosts/himalia/hardware/default.nix index 7c31015..baea9b5 100644 --- a/hosts/himalia/hardware/default.nix +++ b/hosts/himalia/hardware/default.nix @@ -5,7 +5,10 @@ ... }: { - imports = [ ./display.nix ]; + imports = [ + ./display.nix + ./keybinds.nix + ]; hardware = { enableAllFirmware = true; diff --git a/hosts/himalia/hardware/keybinds.nix b/hosts/himalia/hardware/keybinds.nix new file mode 100644 index 0000000..329eaba --- /dev/null +++ b/hosts/himalia/hardware/keybinds.nix @@ -0,0 +1,30 @@ +{ pkgs, ... }: +{ + home-manager.sharedModules = [ + { + wayland.windowManager.hyprland.settings = + let + asusctl = "${pkgs.asusctl}/bin/asusctl"; + in + { + bindle = [ + ", XF86KbdBrightnessUp, exec, ${asusctl} -n" + ", XF86KbdBrightnessDown, exec, ${asusctl} -p" + ]; + + bindl = + let + touchpadHelper = pkgs.writeShellApplication { + name = "touchpad-helper"; + runtimeInputs = with pkgs; [ hyprland ]; + text = builtins.readFile ./touchpad-helper.sh; + }; + in + [ + ", XF86Launch4, exec, ${asusctl} profile -n" + ", XF86TouchpadToggle, exec, ${touchpadHelper} asuf1209:00-2808:0219-touchpad" + ]; + }; + } + ]; +} diff --git a/hosts/himalia/hardware/touchpad-helper.sh b/hosts/himalia/hardware/touchpad-helper.sh new file mode 100644 index 0000000..bbd4b12 --- /dev/null +++ b/hosts/himalia/hardware/touchpad-helper.sh @@ -0,0 +1,22 @@ +HYPRLAND_DEVICE="$1" +export STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status" + +enable_touchpad() { + echo -n "true" >"$STATUS_FILE" + hyprctl keyword "device[$HYPRLAND_DEVICE]:enabled" true +} + +disable_touchpad() { + echo -n "false" >"$STATUS_FILE" + hyprctl keyword "device[$HYPRLAND_DEVICE]:enabled" false +} + +if ! [ -f "$STATUS_FILE" ]; then + disable_touchpad +else + if [ "$(<"$STATUS_FILE")" = "true" ]; then + disable_touchpad + elif [ "$(<"$STATUS_FILE")" = "false" ]; then + enable_touchpad + fi +fi