diff --git a/scripts/swayutils b/scripts/swayutils new file mode 100755 index 0000000..c665d47 --- /dev/null +++ b/scripts/swayutils @@ -0,0 +1,23 @@ +function move { + CURR_WORKSPACE=$(swaymsg -t get_workspaces | jq -r '. | map(select(.focused == true)) | .[0].name') + + echo $CURR_WORKSPACE + + case $1 in + "next") + NEW_WORKSPACE=$(expr ${CURR_WORKSPACE} + 1) + ;; + "prev") + NEW_WORKSPACE=$(expr ${CURR_WORKSPACE} - 1) + ;; + esac + + swaymsg "move container to workspace ${NEW_WORKSPACE}" + swaymsg "workspace ${NEW_WORKSPACE}" +} + +case $1 in + "move") + move $2 + ;; +esac diff --git a/users/configs/desktop/sway/default.nix b/users/configs/desktop/sway/default.nix index bef0fa8..126fada 100644 --- a/users/configs/desktop/sway/default.nix +++ b/users/configs/desktop/sway/default.nix @@ -20,6 +20,14 @@ mod = "Mod4"; hyper = "Control+Shift+Mod1"; in { + home = { + file = { + "bin/swayutils" = { + source = ../../../../scripts/swayutils; + executable = true; + }; + }; + }; wayland.windowManager.sway = { enable = true; config = { @@ -49,8 +57,8 @@ in { "${mod}+Down" = "movewindow down"; "${mod}+Right" = "movewindow right"; - "${mod}+Shift+h" = "move window workspace prev"; - "${mod}+Shift+l" = "move window workspace next"; + "${mod}+Shift+h" = "swayutils move prev"; + "${mod}+Shift+l" = "swayutils move next"; "${mod}+Control+h" = "workspace prev"; "${mod}+Control+l" = "workspace next"; @@ -102,6 +110,17 @@ in { "XF86AudioPrev" = "exec playerctl previous"; "XF86AudioPlay" = "exec playerctl play-pause"; "XF86AudioNext" = "exec playerctl next"; + + "${mod}+Shift+0" = "move container to workspace 0"; + "${mod}+Shift+1" = "move container to workspace 1"; + "${mod}+Shift+2" = "move container to workspace 2"; + "${mod}+Shift+3" = "move container to workspace 3"; + "${mod}+Shift+4" = "move container to workspace 4"; + "${mod}+Shift+5" = "move container to workspace 5"; + "${mod}+Shift+6" = "move container to workspace 6"; + "${mod}+Shift+7" = "move container to workspace 7"; + "${mod}+Shift+8" = "move container to workspace 8"; + "${mod}+Shift+9" = "move container to workspace 9"; }; }; };