From 0799ab4db782864283c6f5024ee0f6b1652fee67 Mon Sep 17 00:00:00 2001 From: Nikolaos Karaolidis Date: Sun, 16 Feb 2025 19:48:34 +0000 Subject: [PATCH] Fix hyprland bind script Signed-off-by: Nikolaos Karaolidis --- .../configs/user/gui/hyprland/default.nix | 32 ++++++------------- .../configs/user/gui/hyprland/scripts/bind.sh | 13 ++++++-- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/hosts/common/configs/user/gui/hyprland/default.nix b/hosts/common/configs/user/gui/hyprland/default.nix index 4c47657..ca2a95b 100644 --- a/hosts/common/configs/user/gui/hyprland/default.nix +++ b/hosts/common/configs/user/gui/hyprland/default.nix @@ -49,33 +49,25 @@ "$mod, 9, exec, ${bindHelper} 9" "$mod, 0, exec, ${bindHelper} 10" - "$mod_Shift, 1, exec, ${bindHelper} 1 move" - "$mod_Shift, 2, exec, ${bindHelper} 2 move" - "$mod_Shift, 3, exec, ${bindHelper} 3 move" - "$mod_Shift, 4, exec, ${bindHelper} 4 move" - "$mod_Shift, 5, exec, ${bindHelper} 5 move" - "$mod_Shift, 6, exec, ${bindHelper} 6 move" - "$mod_Shift, 7, exec, ${bindHelper} 7 move" - "$mod_Shift, 8, exec, ${bindHelper} 8 move" - "$mod_Shift, 9, exec, ${bindHelper} 9 move" - "$mod_Shift, 0, exec, ${bindHelper} 1 move0" + "$mod_Ctrl, 1, exec, ${bindHelper} -m 1" + "$mod_Ctrl, 2, exec, ${bindHelper} -m 2" + "$mod_Ctrl, 3, exec, ${bindHelper} -m 3" + "$mod_Ctrl, 4, exec, ${bindHelper} -m 4" + "$mod_Ctrl, 5, exec, ${bindHelper} -m 5" + "$mod_Ctrl, 6, exec, ${bindHelper} -m 6" + "$mod_Ctrl, 7, exec, ${bindHelper} -m 7" + "$mod_Ctrl, 8, exec, ${bindHelper} -m 8" + "$mod_Ctrl, 9, exec, ${bindHelper} -m 9" + "$mod_Ctrl, 0, exec, ${bindHelper} -m 10" - "$mod, left, movefocus, l" "$mod, h, movefocus, l" - "$mod, down, movefocus, d" "$mod, j, movefocus, d" - "$mod, up, movefocus, u" "$mod, k, movefocus, u" - "$mod, right, movefocus, r" "$mod, l, movefocus, r" - "$mod_Shift, left, movewindow, l" "$mod_Shift, h, movewindow, l" - "$mod_Shift, down, movewindow, d" "$mod_Shift, j, movewindow, d" - "$mod_Shift, up, movewindow, u" "$mod_Shift, k, movewindow, u" - "$mod_Shift, right, movewindow, r" "$mod_Shift, l, movewindow, r" "$mod, Tab, cyclenext" @@ -94,13 +86,9 @@ ]; binde = [ - "$mod_Ctrl, left, resizeactive, -20 0" "$mod_Ctrl, h, resizeactive, -20 0" - "$mod_Ctrl, down, resizeactive, 0 20" "$mod_Ctrl, j, resizeactive, 0 20" - "$mod_Ctrl, up, resizeactive, 0 -20" "$mod_Ctrl, k, resizeactive, 0 -20" - "$mod_Ctrl, right, resizeactive, 20 0" "$mod_Ctrl, l, resizeactive, 20 0" ]; diff --git a/hosts/common/configs/user/gui/hyprland/scripts/bind.sh b/hosts/common/configs/user/gui/hyprland/scripts/bind.sh index ed5b722..7b39955 100644 --- a/hosts/common/configs/user/gui/hyprland/scripts/bind.sh +++ b/hosts/common/configs/user/gui/hyprland/scripts/bind.sh @@ -1,7 +1,16 @@ # shellcheck shell=bash +MOVE=false + +while getopts "m" opt; do + case $opt in + m) MOVE=true ;; + *) exit 1 ;; + esac +done +shift $((OPTIND - 1)) + SELECTED_WORKSPACE_BASE="$1" -ACTION="$2" BLOCK_SIZE=10 @@ -19,7 +28,7 @@ if [ "$target_workspace_id" -eq "$current_workspace_id" ]; then target_workspace_id=$((next_block * BLOCK_SIZE + SELECTED_WORKSPACE_BASE)) fi -if [ "$ACTION" = "move" ]; then +if [ "$MOVE" = true ]; then hyprctl dispatch movetoworkspacesilent "$target_workspace_id" else hyprctl dispatch workspace "$target_workspace_id"