diff --git a/hypr/hyprland/keybinds.conf b/hypr/hyprland/keybinds.conf index f2a0f6d..e951066 100644 --- a/hypr/hyprland/keybinds.conf +++ b/hypr/hyprland/keybinds.conf @@ -35,27 +35,28 @@ bindr = Ctrl+Super+Shift, R, exec, qs -c caelestia kill bindr = Ctrl+Super+Alt, R, exec, hyprctl reload # Go to workspace # -bind = Super, 1, exec, caelestia workspace-action workspace 1 -bind = Super, 2, exec, caelestia workspace-action workspace 2 -bind = Super, 3, exec, caelestia workspace-action workspace 3 -bind = Super, 4, exec, caelestia workspace-action workspace 4 -bind = Super, 5, exec, caelestia workspace-action workspace 5 -bind = Super, 6, exec, caelestia workspace-action workspace 6 -bind = Super, 7, exec, caelestia workspace-action workspace 7 -bind = Super, 8, exec, caelestia workspace-action workspace 8 -bind = Super, 9, exec, caelestia workspace-action workspace 9 -bind = Super, 0, exec, caelestia workspace-action workspace 10 +$wsaction = ~/.config/hypr/scripts/wsaction.fish +bind = Super, 1, exec, $wsaction workspace 1 +bind = Super, 2, exec, $wsaction workspace 2 +bind = Super, 3, exec, $wsaction workspace 3 +bind = Super, 4, exec, $wsaction workspace 4 +bind = Super, 5, exec, $wsaction workspace 5 +bind = Super, 6, exec, $wsaction workspace 6 +bind = Super, 7, exec, $wsaction workspace 7 +bind = Super, 8, exec, $wsaction workspace 8 +bind = Super, 9, exec, $wsaction workspace 9 +bind = Super, 0, exec, $wsaction workspace 10 # Go to workspace group # -bind = Ctrl+Super, 1, exec, caelestia workspace-action -g workspace 1 -bind = Ctrl+Super, 2, exec, caelestia workspace-action -g workspace 2 -bind = Ctrl+Super, 3, exec, caelestia workspace-action -g workspace 3 -bind = Ctrl+Super, 4, exec, caelestia workspace-action -g workspace 4 -bind = Ctrl+Super, 5, exec, caelestia workspace-action -g workspace 5 -bind = Ctrl+Super, 6, exec, caelestia workspace-action -g workspace 6 -bind = Ctrl+Super, 7, exec, caelestia workspace-action -g workspace 7 -bind = Ctrl+Super, 8, exec, caelestia workspace-action -g workspace 8 -bind = Ctrl+Super, 9, exec, caelestia workspace-action -g workspace 9 -bind = Ctrl+Super, 0, exec, caelestia workspace-action -g workspace 10 +bind = Ctrl+Super, 1, exec, $wsaction -g workspace 1 +bind = Ctrl+Super, 2, exec, $wsaction -g workspace 2 +bind = Ctrl+Super, 3, exec, $wsaction -g workspace 3 +bind = Ctrl+Super, 4, exec, $wsaction -g workspace 4 +bind = Ctrl+Super, 5, exec, $wsaction -g workspace 5 +bind = Ctrl+Super, 6, exec, $wsaction -g workspace 6 +bind = Ctrl+Super, 7, exec, $wsaction -g workspace 7 +bind = Ctrl+Super, 8, exec, $wsaction -g workspace 8 +bind = Ctrl+Super, 9, exec, $wsaction -g workspace 9 +bind = Ctrl+Super, 0, exec, $wsaction -g workspace 10 # Go to workspace -1/+1 bind = Super, mouse_down, workspace, -1 bind = Super, mouse_up, workspace, +1 @@ -70,27 +71,27 @@ bind = Ctrl+Super, mouse_up, workspace, +10 bind = Super, S, exec, caelestia toggle specialws # Move window to workspace # -bind = Super+Alt, 1, exec, caelestia workspace-action movetoworkspace 1 -bind = Super+Alt, 2, exec, caelestia workspace-action movetoworkspace 2 -bind = Super+Alt, 3, exec, caelestia workspace-action movetoworkspace 3 -bind = Super+Alt, 4, exec, caelestia workspace-action movetoworkspace 4 -bind = Super+Alt, 5, exec, caelestia workspace-action movetoworkspace 5 -bind = Super+Alt, 6, exec, caelestia workspace-action movetoworkspace 6 -bind = Super+Alt, 7, exec, caelestia workspace-action movetoworkspace 7 -bind = Super+Alt, 8, exec, caelestia workspace-action movetoworkspace 8 -bind = Super+Alt, 9, exec, caelestia workspace-action movetoworkspace 9 -bind = Super+Alt, 0, exec, caelestia workspace-action movetoworkspace 10 +bind = Super+Alt, 1, exec, $wsaction movetoworkspace 1 +bind = Super+Alt, 2, exec, $wsaction movetoworkspace 2 +bind = Super+Alt, 3, exec, $wsaction movetoworkspace 3 +bind = Super+Alt, 4, exec, $wsaction movetoworkspace 4 +bind = Super+Alt, 5, exec, $wsaction movetoworkspace 5 +bind = Super+Alt, 6, exec, $wsaction movetoworkspace 6 +bind = Super+Alt, 7, exec, $wsaction movetoworkspace 7 +bind = Super+Alt, 8, exec, $wsaction movetoworkspace 8 +bind = Super+Alt, 9, exec, $wsaction movetoworkspace 9 +bind = Super+Alt, 0, exec, $wsaction movetoworkspace 10 # Move window to workspace group # -bind = Ctrl+Super+Alt, 1, exec, caelestia workspace-action -g movetoworkspace 1 -bind = Ctrl+Super+Alt, 2, exec, caelestia workspace-action -g movetoworkspace 2 -bind = Ctrl+Super+Alt, 3, exec, caelestia workspace-action -g movetoworkspace 3 -bind = Ctrl+Super+Alt, 4, exec, caelestia workspace-action -g movetoworkspace 4 -bind = Ctrl+Super+Alt, 5, exec, caelestia workspace-action -g movetoworkspace 5 -bind = Ctrl+Super+Alt, 6, exec, caelestia workspace-action -g movetoworkspace 6 -bind = Ctrl+Super+Alt, 7, exec, caelestia workspace-action -g movetoworkspace 7 -bind = Ctrl+Super+Alt, 8, exec, caelestia workspace-action -g movetoworkspace 8 -bind = Ctrl+Super+Alt, 9, exec, caelestia workspace-action -g movetoworkspace 9 -bind = Ctrl+Super+Alt, 0, exec, caelestia workspace-action -g movetoworkspace 10 +bind = Ctrl+Super+Alt, 1, exec, $wsaction -g movetoworkspace 1 +bind = Ctrl+Super+Alt, 2, exec, $wsaction -g movetoworkspace 2 +bind = Ctrl+Super+Alt, 3, exec, $wsaction -g movetoworkspace 3 +bind = Ctrl+Super+Alt, 4, exec, $wsaction -g movetoworkspace 4 +bind = Ctrl+Super+Alt, 5, exec, $wsaction -g movetoworkspace 5 +bind = Ctrl+Super+Alt, 6, exec, $wsaction -g movetoworkspace 6 +bind = Ctrl+Super+Alt, 7, exec, $wsaction -g movetoworkspace 7 +bind = Ctrl+Super+Alt, 8, exec, $wsaction -g movetoworkspace 8 +bind = Ctrl+Super+Alt, 9, exec, $wsaction -g movetoworkspace 9 +bind = Ctrl+Super+Alt, 0, exec, $wsaction -g movetoworkspace 10 # Move window to workspace -1/+1 binde = Super+Alt, Page_Up, movetoworkspace, -1 binde = Super+Alt, Page_Down, movetoworkspace, +1 diff --git a/hypr/scripts/wsaction.fish b/hypr/scripts/wsaction.fish new file mode 100755 index 0000000..dd720e3 --- /dev/null +++ b/hypr/scripts/wsaction.fish @@ -0,0 +1,21 @@ +#!/usr/bin/env fish + +if test "$argv[1]" = '-g' + set group + set -e $argv[1] +end + +if test (count $argv) -ne 2 + echo 'Wrong number of arguments. Usage: ./wsaction.fish [-g] ' + exit 1 +end + +set -l active_ws (hyprctl activeworkspace -j | jq -r '.id') + +if set -q group + # Move to group + hyprctl dispatch $argv[1] (math "($argv[2] - 1) * 10 + $active_ws % 10") +else + # Move to ws in group + hyprctl dispatch $argv[1] (math "floor(($active_ws - 1) / 10) * 10 + $argv[2]") +end