Skip to content

Commit

Permalink
graphical/wms/sway: update workspace moving binds
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Jul 16, 2024
1 parent 1e7aaee commit 41026ca
Showing 1 changed file with 140 additions and 131 deletions.
271 changes: 140 additions & 131 deletions modules/home/programs/graphical/wms/sway/binds.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,137 +63,146 @@ in
color_picker = "${getExe pkgs.hyprpicker} -a && (${convert} -size 32x32 xc:$(${wl-paste}) /tmp/color.png && ${getExe pkgs.libnotify} \"Color Code:\" \"$(${wl-paste})\" -h \"string:bgcolor:$(${wl-paste})\" --icon /tmp/color.png -u critical -t 4000)";
cliphist = "${getExe pkgs.cliphist} list | anyrun --show-results-immediately true | ${getExe pkgs.cliphist} decode | ${wl-copy}";
in
lib.mkOptionDefault {
"${swayCfg.modifier}+BackSpace" = "exec pkill -SIGUSR1 hyprlock || WAYLAND_DISPLAY=wayland-1 $screen-locker --immediate";
"${swayCfg.modifier}+Return" = "exec ${swayCfg.terminal}";
"${swayCfg.modifier}+Shift+q" = "kill";
"${swayCfg.modifier}+d" = "exec ${swayCfg.menu}";

# "${swayCfg.modifier}+${swayCfg.left}" = "focus left";
# "${swayCfg.modifier}+${swayCfg.down}" = "focus down";
# "${swayCfg.modifier}+${swayCfg.up}" = "focus up";
# "${swayCfg.modifier}+${swayCfg.right}" = "focus right";

# Additional bindings
# "${swayCfg.modifier}+Space" = "exec run-as-service ${launcher}";
"Control+Space" = "exec run-as-service ${launcher}";
"Super_L+Shift+Return" = "exec ${swayCfg.terminal} zellij";
"Super_L+Shift+P" = "exec ${color_picker}";
"${swayCfg.modifier}+b" = "exec ${browser}";
"Super_L+Shift+E" = "exec ${explorer}";
"${swayCfg.modifier}+e" = "exec ${swayCfg.terminal} yazi";
"${swayCfg.modifier}+Control+l" = mkForce "exec ${screen-locker} --immediate";
"${swayCfg.modifier}+t" = "exec ${swayCfg.terminal} btop";
"${swayCfg.modifier}+n" = "exec ${notification_center} -t -sw";
"${swayCfg.modifier}+v" = "exec ${cliphist}";
"${swayCfg.modifier}+w" = "exec ${looking-glass}";
# "${swayCfg.modifier}+I" = "exec ${pkgs.libnotify}/bin/notify-send ${window-inspector}";

# Kill window
"${swayCfg.modifier}+Q" = "kill";
"Control+Shift+q" = "kill";

# File screenshots
"Print" = "exec ${grimblast_active_file}";
"Shift+Print" = "exec ${grimblast_area_file}";
"Super_L+Print" = "exec ${grimblast_screen_file}";

# Area / Window screenshots
"Alt+Print" = "exec ${grimblast_active_swappy}";
"Alt+Control+Print" = "exec ${grimblast_area_swappy}";
"Alt+Super_L+Print" = "exec ${grimblast_screen_swappy}";

# Clipboard screenshots
"Control+Print" = "exec ${grimblast_active_clipboard}";
"Control+Shift+Print" = "exec ${grimblast_area_clipboard}";
"Super_L+Control+Print" = "exec ${grimblast_screen_clipboard}";

# Screen recording
"Super_L+Control+Alt+Print" = "exec ${screen-recorder} screen";
"Super_L+Control+Alt+Shift+Print" = "exec ${screen-recorder} area";

# Floating toggle
"Super_L+Alt+v" = "floating toggle";
"${swayCfg.modifier}+p" = "layout tabbed";
"${swayCfg.modifier}+j" = "split vertical";
"${swayCfg.modifier}+f" = "fullscreen";

# Focus and move windows
"Alt+left" = "focus left";
"Alt+right" = "focus right";
"Alt+up" = "focus up";
"Alt+down" = "focus down";
"Super_L+left" = "move left";
"Super_L+right" = "move right";
"Super_L+up" = "move up";
"Super_L+down" = "move down";

"Control+Shift+h" = "resize shrink width 10px";
"Control+Shift+l" = "resize grow width 10px";

# Workspace switching
"Control+Alt+right" = "workspace next";
"Control+Alt+left" = "workspace prev";
# "Control+Alt+mouse_down" = "workspace next";
# "Control+Alt+mouse_up" = "workspace prev";

# Moving to workspace
"Alt+Hyper_L+right" = "move container to workspace next";
"Alt+Hyper_L+left" = "move container to workspace prev";

# Scratchpad
"Super_L+Shift+grave" = "move container to scratchpad";
"Super_L+grave" = "scratchpad show";

# Inactive
"Alt+Shift+grave" = "move container to workspace special:inactive";
"Alt+grave" = "workspace special:inactive";

# Monitor focus
"Super_L+Alt+up" = "focus output up";
"Super_L+Alt+down" = "focus output down";
"Super_L+Alt+left" = "focus output left";
"Super_L+Alt+right" = "focus output right";

# Move workspace to monitor
"Hyper_L+down" = "move workspace to output down";
"Hyper_L+up" = "move workspace to output up";
"Hyper_L+left" = "move workspace to output left";
"Hyper_L+right" = "move workspace to output right";

XF86AudioRaiseVolume = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 2.5%+";
XF86AudioLowerVolume = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 2.5%-";
XF86AudioMute = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
XF86MonBrightnessUp = "exec light -A 5";
XF86MonBrightnessDown = "exec light -U 5";
XF86AudioMedia = "exec ${getExe pkgs.playerctl} play-pause";
XF86AudioPlay = "exec ${getExe pkgs.playerctl} play-pause";
XF86AudioStop = "exec ${getExe pkgs.playerctl} stop";
XF86AudioPrev = "exec ${getExe pkgs.playerctl} previous";
XF86AudioNext = "exec ${getExe pkgs.playerctl} next";
};

# ░█░█░█▀█░█▀▄░█░█░█▀▀░█▀█░█▀█░█▀▀░█▀▀
# ░█▄█░█░█░█▀▄░█▀▄░▀▀█░█▀▀░█▀█░█░░░█▀▀
# ░▀░▀░▀▀▀░▀░▀░▀░▀░▀▀▀░▀░░░▀░▀░▀▀▀░▀▀▀
# Switch workspaces with Control_Alt + [0-9]
# ++ (builtins.concatLists (
# builtins.genList (
# x:
# let
# ws =
# let
# c = (x + 1) / 10;
# in
# builtins.toString (x + 1 - (c * 10));
# in
# [
# "$Control_Alt, ${ws}, workspace, ${toString (x + 1)}"
# "$Control_Alt_Super_L, ${ws}, movetoworkspace, ${toString (x + 1)}"
# "$Super_L_Shift, ${ws}, movetoworkspacesilent, ${toString (x + 1)}"
# ]
# ) 10
# ));
lib.mkMerge [
(lib.mkOptionDefault {
"${swayCfg.modifier}+BackSpace" = "exec pkill -SIGUSR1 hyprlock || WAYLAND_DISPLAY=wayland-1 $screen-locker --immediate";
"${swayCfg.modifier}+Return" = "exec ${swayCfg.terminal}";
"${swayCfg.modifier}+Shift+q" = "kill";

# "${swayCfg.modifier}+${swayCfg.left}" = "focus left";
# "${swayCfg.modifier}+${swayCfg.down}" = "focus down";
# "${swayCfg.modifier}+${swayCfg.up}" = "focus up";
# "${swayCfg.modifier}+${swayCfg.right}" = "focus right";

# Additional bindings
# "${swayCfg.modifier}+Space" = "exec run-as-service ${launcher}";
"Control+Space" = "exec run-as-service ${launcher}";
"Super_L+Shift+Return" = "exec ${swayCfg.terminal} zellij";
"Super_L+Shift+P" = "exec ${color_picker}";
"${swayCfg.modifier}+b" = "exec ${browser}";
"Super_L+Shift+E" = "exec ${explorer}";
"${swayCfg.modifier}+e" = "exec ${swayCfg.terminal} yazi";
"${swayCfg.modifier}+Control+l" = mkForce "exec ${screen-locker} --immediate";
"${swayCfg.modifier}+t" = "exec ${swayCfg.terminal} btop";
"${swayCfg.modifier}+n" = "exec ${notification_center} -t -sw";
"${swayCfg.modifier}+v" = "exec ${cliphist}";
"${swayCfg.modifier}+w" = "exec ${looking-glass}";
# "${swayCfg.modifier}+I" = "exec ${pkgs.libnotify}/bin/notify-send ${window-inspector}";

# Kill window
"${swayCfg.modifier}+Q" = "kill";
"Control+Shift+q" = "kill";

# File screenshots
"Print" = "exec ${grimblast_active_file}";
"Shift+Print" = "exec ${grimblast_area_file}";
"Super_L+Print" = "exec ${grimblast_screen_file}";

# Area / Window screenshots
"Alt+Print" = "exec ${grimblast_active_swappy}";
"Alt+Control+Print" = "exec ${grimblast_area_swappy}";
"Alt+Super_L+Print" = "exec ${grimblast_screen_swappy}";

# Clipboard screenshots
"Control+Print" = "exec ${grimblast_active_clipboard}";
"Control+Shift+Print" = "exec ${grimblast_area_clipboard}";
"Super_L+Control+Print" = "exec ${grimblast_screen_clipboard}";

# Screen recording
"Super_L+Control+Alt+Print" = "exec ${screen-recorder} screen";
"Super_L+Control+Alt+Shift+Print" = "exec ${screen-recorder} area";

# Floating toggle
"Super_L+Alt+v" = "floating toggle";
"${swayCfg.modifier}+p" = "layout tabbed";
"${swayCfg.modifier}+j" = "split vertical";
"${swayCfg.modifier}+f" = "fullscreen";

# Focus and move windows
"Alt+left" = "focus left";
"Alt+right" = "focus right";
"Alt+up" = "focus up";
"Alt+down" = "focus down";
"Super_L+left" = "move left";
"Super_L+right" = "move right";
"Super_L+up" = "move up";
"Super_L+down" = "move down";

"Control+Shift+h" = "resize shrink width 10px";
"Control+Shift+l" = "resize grow width 10px";

# Workspace switching
"Control+Alt+right" = "workspace next";
"Control+Alt+left" = "workspace prev";
"Control+Alt+l" = "workspace next";
"Control+Alt+h" = "workspace prev";

# Moving to workspace
"Alt+Shift+Control+right" = "move container to workspace next";
"Alt+Shift+Control+left" = "move container to workspace prev";

# Scratchpad
"Super_L+Shift+grave" = "move container to scratchpad";
"Super_L+grave" = "scratchpad show";

# Inactive
"Alt+Shift+grave" = "move container to workspace special:inactive";
"Alt+grave" = "workspace special:inactive";

# Monitor focus
"Super_L+Alt+up" = "focus output up";
"Super_L+Alt+down" = "focus output down";
"Super_L+Alt+left" = "focus output left";
"Super_L+Alt+right" = "focus output right";

# Move workspace to monitor
"Hyper_L+down" = "move workspace to output down";
"Hyper_L+up" = "move workspace to output up";
"Hyper_L+left" = "move workspace to output left";
"Hyper_L+right" = "move workspace to output right";

XF86AudioRaiseVolume = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 2.5%+";
XF86AudioLowerVolume = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 2.5%-";
XF86AudioMute = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
XF86MonBrightnessUp = "exec light -A 5";
XF86MonBrightnessDown = "exec light -U 5";
XF86AudioMedia = "exec ${getExe pkgs.playerctl} play-pause";
XF86AudioPlay = "exec ${getExe pkgs.playerctl} play-pause";
XF86AudioStop = "exec ${getExe pkgs.playerctl} stop";
XF86AudioPrev = "exec ${getExe pkgs.playerctl} previous";
XF86AudioNext = "exec ${getExe pkgs.playerctl} next";
})
(lib.mkOptionDefault (
builtins.listToAttrs (
builtins.concatLists (
builtins.genList (
x:
let
ws =
let
c = (x + 1) / 10;
in
builtins.toString (x + 1 - (c * 10));
in
[
{
name = "Control+Alt+${ws}";
value = "workspace number ${ws}";
}
{
name = "Control+Alt+Super_L+${ws}";
value = "move container to workspace ${ws}";
}
{
name = "Super_L+Shift+${ws}";
value = "move container to workspace ${ws}";
}
]
) 10
)
)
))
];
};
};
};
Expand Down

0 comments on commit 41026ca

Please sign in to comment.