Files
nixcfg/users/configs/desktop/sway/default.nix
2024-06-03 22:22:20 +01:00

178 lines
5.9 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 = {
bars = [
{
mode = "dock";
hiddenState = "hide";
position = "bottom";
workspaceButtons = true;
workspaceNumbers = true;
statusCommand = "${pkgs.i3status}/bin/i3status";
fonts = {
names = ["monospace"];
size = 12.0;
};
trayOutput = "primary";
colors = {
background = "#000000";
statusline = "#ffffff";
separator = "#666666";
focusedWorkspace = {
border = "#4c7899";
background = "#285577";
text = "#ffffff";
};
activeWorkspace = {
border = "#333333";
background = "#5f676a";
text = "#ffffff";
};
inactiveWorkspace = {
border = "#333333";
background = "#222222";
text = "#888888";
};
urgentWorkspace = {
border = "#2f343a";
background = "#900000";
text = "#ffffff";
};
bindingMode = {
border = "#2f343a";
background = "#900000";
text = "#ffffff";
};
};
}
];
input = {
"*" = {
xkb_layout = "gb";
xkb_options = "caps:escape";
tap = "enabled";
};
};
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" = "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}+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 swaylock -i ~/wallpapers/lock.png";
"${hyper}+Escape" = "exec swaylock -i ~/wallpapers/lock.png";
"${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";
};
};
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
'';
};
}