diff --git a/packages/hyprland/home.nix b/packages/hyprland/home.nix index dd50617..82b8906 100644 --- a/packages/hyprland/home.nix +++ b/packages/hyprland/home.nix @@ -1,4 +1,7 @@ {myConfig, ...}: { + home.file.".config/hypr/scripts" = { + source = builtins.toPath ./scripts; + }; wayland.windowManager.hyprland = { enable = true; xwayland.enable = true; @@ -190,7 +193,7 @@ i: let ws = i + 1; in [ - "$mod, ${toString ws}, workspace, ${toString ws}" + "$mod, ${toString ws}, exec, $wsaction workspace, ${toString ws}" "$mod SHIFT, ${toString ws}, movetoworkspace, ${toString ws}" ] ) @@ -224,6 +227,7 @@ bindi = [ "Super, Super_L, global, caelestia:launcher" + # "$mod, Space, global, caelestia:launcher" ]; bindin = [ diff --git a/packages/hyprland/scripts/wsaction.fish b/packages/hyprland/scripts/wsaction.fish new file mode 100644 index 0000000..dd720e3 --- /dev/null +++ b/packages/hyprland/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