Files
nixcfg/users/configs/desktop/sway/default.nix
2024-05-31 00:03:10 +01:00

128 lines
4.2 KiB
Nix

{
config,
lib,
pkgs,
...
}: let
closer = pkgs.writeShellApplication {
name = "closer";
runtimeInputs = with pkgs; [jq xdotool];
text = ''
if [ "$(hyprctl activewindow -j | jq -r ".class")" = "Steam" ]; then
xdotool getactivewindow windowunmap
else
sway killactive ""
fi
'';
};
mod = "Mod4";
hyper = "Control+Shift+Mod1";
in {
home = {
file = {
"bin/swayutils" = {
source = ../../../../scripts/swayutils;
executable = true;
};
};
};
wayland.windowManager.sway = {
enable = true;
config = {
input = {
"*" = {
xkb_layout = "gb";
xkb_options = "caps:escape";
};
};
output = {
eDP-1 = {
scale = "1.33";
};
};
keybindings = {
"${mod}+Return" = "exec kitty";
"${mod}+q" = "${closer}/bin/closer";
"${mod}+d" = "exec tofi-drun --drun-launch=true";
"${mod}+h" = "focus left";
"${mod}+j" = "focus down";
"${mod}+k" = "focus up";
"${mod}+l" = "focus right";
"${mod}+Left" = "movewindow left";
"${mod}+Up" = "movewindow up";
"${mod}+Down" = "movewindow down";
"${mod}+Right" = "movewindow right";
"${mod}+Shift+h" = "swayutils move prev";
"${mod}+Shift+l" = "swayutils move next";
"${mod}+Control+h" = "workspace prev";
"${mod}+Control+l" = "workspace 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}+Control+Return" = "exec --no-startup-id i3utils workspace new";
"${mod}+Control+Shift+Return" = "exec --no-startup-id i3utils workspace new -b";
"${mod}+Shift+Return" = "exec --no-startup-id i3utils workspace new -n, move next";
# "${mod}+Control+j" = "exec --no-startup-id $HOME/bin/scripts/godown";
# "${mod}+Control+k" = "exec --no-startup-id $HOME/bin/scripts/goup";
# "${mod}+Control+u" = "exec --no-startup-id $HOME/bin/scripts/godown";
# "${mod}+Control+i" = "exec --no-startup-id $HOME/bin/scripts/goup";
# "${mod}+Control+h" = "exec --no-startup-id i3utils workspace new -b";
"${hyper}+m" = "exec --no-startup-id $HOME/bin/scripts/godown";
"${hyper}+comma" = "exec --no-startup-id $HOME/bin/scripts/goup";
"${mod}+Shift+k" = "exec --no-startup-id i3utils window move prev";
"${mod}+Shift+j" = "exec --no-startup-id i3utils window move next";
"${hyper}+i" = "exec --no-startup-id i3utils window move prev";
"${hyper}+u" = "exec --no-startup-id i3utils window move next";
"${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 loginctl lock-session";
"${hyper}+Escape" = "exec loginctl lock-session";
"${hyper}+f" = "fullscreen toggle";
"XF86MonBrightnessUp" = "exec xbacklight -inc 10";
"XF86MonBrightnessDown" = "exec xbacklight -dec 10";
"XF86AudioMute" = "exec pamixer -t";
"XF86AudioLowerVolume" = "exec pamixer -d 5";
"XF86AudioRaiseVolume" = "exec pamixer -i 5";
"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";
};
};
};
}