Files
nixcfg/users/configs/desktop/sway/default.nix
2024-09-29 20:43:28 +01:00

145 lines
4.7 KiB
Nix

{
config,
lib,
pkgs,
hostname,
...
}: let
mod = "Mod4";
hyper = "Control+Shift+Mod1";
in {
home = {
file = {
"bin/swayutils" = {
source = ../../../../scripts/swayutils;
executable = true;
};
};
};
wayland.windowManager.sway = {
enable = true;
config = {
bars = [
{
command = "waybar";
}
];
input = {
"*" = {
xkb_layout = "gb";
xkb_options = "caps:escape";
tap = "enabled";
natural_scroll = if hostname == "sidon" then "disabled" else "enabled";
};
"type:pointer" = {
accel_profile = "flat";
pointer_accel = "-0.2";
};
};
output = {
eDP-1 = {
scale = "1.33";
};
DP-3 = {
position = "0 0";
scale = "1.33";
};
HDMI-A-1 = {
scale = "1.33";
};
};
keybindings = {
"${mod}+Return" = "exec wezterm";
"${mod}+q" = "kill";
"${mod}+d" = "exec tofi-drun --drun-launch=true";
"${hyper}+Return" = "exec wezterm";
"${hyper}+q" = "kill";
"${hyper}+d" = "exec tofi-drun --drun-launch=true";
"${mod}+Shift+s" = "exec grim -g \"$(slurp)\"";
"${mod}+Shift+Space" = "floating toggle";
"${mod}+Space" = "focus mode_toggle";
"${mod}+h" = "focus left";
"${mod}+j" = "focus down";
"${mod}+k" = "focus up";
"${mod}+l" = "focus right";
"${hyper}+h" = "focus left";
"${hyper}+j" = "focus down";
"${hyper}+k" = "focus up";
"${hyper}+l" = "focus right";
"${mod}+Left" = "movewindow left";
"${mod}+Up" = "movewindow up";
"${mod}+Down" = "movewindow down";
"${mod}+Right" = "movewindow right";
"${hyper}+Left" = "movewindow left";
"${hyper}+Up" = "movewindow up";
"${hyper}+Down" = "movewindow down";
"${hyper}+Right" = "movewindow right";
"${mod}+Shift+h" = "exec ${config.home.homeDirectory}/bin/swayutils move prev";
"${mod}+Shift+l" = "exec ${config.home.homeDirectory}/bin/swayutils move next";
"${mod}+Control+h" = "exec ${config.home.homeDirectory}/bin/swayutils focus prev";
"${mod}+Control+l" = "exec ${config.home.homeDirectory}/bin/swayutils focus next";
"${hyper}+u" = "exec ${config.home.homeDirectory}/bin/swayutils move prev";
"${hyper}+i" = "exec ${config.home.homeDirectory}/bin/swayutils move next";
"${hyper}+m" = "exec ${config.home.homeDirectory}/bin/swayutils focus prev";
"${hyper}+Comma" = "exec ${config.home.homeDirectory}/bin/swayutils focus next";
"${hyper}+y" = "move left";
"${hyper}+o" = "move right";
"${mod}+Tab" = "workspace back_and_forth";
"${hyper}+Tab" = "workspace back_and_forth";
"${mod}+b" = "split h";
"${mod}+v" = "split v";
"${hyper}+b" = "split h";
"${hyper}+v" = "split v";
"${mod}+p" = "scratchpad show, resize set 80 ppt 80ppt, move position center";
"${hyper}+p" = "scratchpad show, resize set 80 ppt 80ppt, move position center";
"${mod}+Escape" = "exec swaylock -i ~/wallpapers/lock.png";
"${hyper}+Escape" = "exec swaylock -i ~/wallpapers/lock.png";
"${hyper}+f" = "fullscreen toggle";
"XF86AudioLowerVolume" = "exec wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%-";
"XF86AudioMute" = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
"XF86AudioRaiseVolume" = "exec wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+";
"XF86MonBrightnessUp" = "exec xbacklight -inc 10";
"XF86MonBrightnessDown" = "exec xbacklight -dec 10";
"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";
};
};
extraConfig = ''
bindgesture swipe:3:right exec ${config.home.homeDirectory}/bin/swayutils focus prev
bindgesture swipe:3:left exec ${config.home.homeDirectory}/bin/swayutils focus next
'';
};
}