update workspace binds

This commit is contained in:
Leonardo Eugênio 2022-08-07 15:54:56 -03:00
parent 8febe20c80
commit 24c91568c6

View file

@ -99,30 +99,28 @@ in {
mod = "Mod4"; mod = "Mod4";
menu = "${pkgs.bmenu}/bin/bmenu run"; menu = "${pkgs.bmenu}/bin/bmenu run";
terminal = "alacritty"; terminal = "alacritty";
workspace_binds = {
"${mod}+1" = "workspace number 1"; # Utility funcion
"${mod}+2" = "workspace number 2"; # Input: [{v1=1;} {v2=2;}]
"${mod}+3" = "workspace number 3"; # Output: {v1=1;v2=2;}
"${mod}+4" = "workspace number 4"; mergeAttrsSet = lib.foldAttrs (n: _: n) { };
"${mod}+5" = "workspace number 5";
"${mod}+6" = "workspace number 6"; # mod+1 to swich to workspace 1
"${mod}+7" = "workspace number 7"; # mod+shift+1 to move to workspace 1
"${mod}+8" = "workspace number 8"; workspace_binds = let
"${mod}+9" = "workspace number 9"; workspaceBinds = map makeWorkspaceBinds (lib.range 1 10);
"${mod}+0" = "workspace number 10"; makeWorkspaceBinds = (i:
"${mod}+Shift+1" = "move container to workspace number 1"; let
"${mod}+Shift+2" = "move container to workspace number 2"; key = toString (lib.mod i 10);
"${mod}+Shift+3" = "move container to workspace number 3"; workspaceNumber = toString i;
"${mod}+Shift+4" = "move container to workspace number 4"; in {
"${mod}+Shift+5" = "move container to workspace number 5"; "${mod}+${key}" = "workspace number ${workspaceNumber}";
"${mod}+Shift+6" = "move container to workspace number 6"; "${mod}+Shift+${key}" =
"${mod}+Shift+7" = "move container to workspace number 7"; "move container to workspace number ${workspaceNumber}";
"${mod}+Shift+8" = "move container to workspace number 8"; });
"${mod}+Shift+9" = "move container to workspace number 9"; in mergeAttrsSet workspaceBinds;
"${mod}+Shift+0" = "move container to workspace number 10";
};
prev_next_binds = let prev_next_binds = let
join_dict_arr = builtins.foldl' (a: v: a // v) { };
maybe_window = key: maybe_window = key:
if (lib.strings.hasInfix "button" key) then if (lib.strings.hasInfix "button" key) then
"--whole-window" "--whole-window"
@ -130,11 +128,18 @@ in {
""; "";
prev_binds = map (key: { prev_binds = map (key: {
"${maybe_window key} ${mod}+${key}" = "workspace prev_on_output"; "${maybe_window key} ${mod}+${key}" = "workspace prev_on_output";
}) [ key.tabL "bracketleft" "Prior" "button9" "button4" ]; }) [
key.tabL
"bracketleft"
"Prior"
"button9"
"button4"
"Shift+Tab"
];
next_binds = map (key: { next_binds = map (key: {
"${maybe_window key} ${mod}+${key}" = "workspace next_on_output"; "${maybe_window key} ${mod}+${key}" = "workspace next_on_output";
}) [ key.tabR "bracketright" "Next" "button8" "button5" ]; }) [ key.tabR "bracketright" "Next" "button8" "button5" "Tab" ];
in join_dict_arr (prev_binds ++ next_binds); in mergeAttrsSet (prev_binds ++ next_binds);
movement_binds = { movement_binds = {
"${mod}+${key.left}" = "focus left"; "${mod}+${key.left}" = "focus left";
"${mod}+${key.down}" = "focus down"; "${mod}+${key.down}" = "focus down";
@ -203,6 +208,8 @@ in {
"${mod}+m" = "mode audio"; "${mod}+m" = "mode audio";
"${mod}+b" = "splith"; "${mod}+b" = "splith";
"${mod}+v" = "splitv"; "${mod}+v" = "splitv";
"${mod}+t" = "layout toggle split tabbed stacking";
"${mod}+r" = "layout toggle split";
"${mod}+f" = "fullscreen toggle"; "${mod}+f" = "fullscreen toggle";
"${mod}+a" = "focus parent"; "${mod}+a" = "focus parent";
# "${mod}+s" = "layout stacking"; # "${mod}+s" = "layout stacking";
@ -215,12 +222,8 @@ in {
"${mod}+Shift+c" = "reload"; "${mod}+Shift+c" = "reload";
# "${mod}+Shift+e" = # "${mod}+Shift+e" =
# "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'"; # "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
"${mod}+r" = "mode resize";
} // workspace_binds // prev_next_binds // movement_binds // audio_binds } // workspace_binds // prev_next_binds // movement_binds // audio_binds
// system_binds // system_binds;
# // map (key: "$mod+${key} workspace prev_on_output") [ key.tabL "bracketleft" "Prior" "button9" "button4" ]
# // map (key: "$mod+${key} workspace next_on_output") [ key.tabL "bracketleft" "Prior" "button9" "button4" ]
;
terminal = pkgs.alacritty.executable; terminal = pkgs.alacritty.executable;
}; };
}; };