nixos-config/backup/modules/users/sway/sway.nix

163 lines
5.6 KiB
Nix
Raw Normal View History

{ pkgs, config, lib, ... }:
let
cfg = config.wayland.windowManager.sway;
mod = "Mod4";
swaylockcmd = "${pkgs.swaylock}/bin/swaylock --ignore-empty-password --daemonize --show-failed-attempts --indicator-caps-lock --clock --image /home/erwin/Dropbox/Private/Wallpapers/2560x1440/arch.png --fade-in 0.5 --scaling fill";
in
{
modifier = mod;
assigns = {
"1" = [{ app_id = "firefox"; }];
"2" = [{ app_id = "Alacritty"; }];
"3" = [{ class = "Code"; }];
"10" = [{ class = "telegramdesktop"; } { class = "Signal"; }];
};
bars = [
{
command = "${pkgs.waybar}/bin/waybar";
}
];
left = "n";
down = "e";
up = "i";
right = "o";
floating = {
criteria = [{ app_id = "gnome-calculator"; }];
modifier = mod;
};
fonts = {
names = [ "MesloLGM Nerd Font" ];
style = "Regular";
size = 12.0;
};
gaps = {
inner = 10;
outer = 5;
smartBorders = "on";
};
input = {
"36125:40349:splitKB_Kyria" = {
xkb_options = "lv3:ralt_switch";
};
"1133:49291:Logitech_G502_HERO_SE" = {
natural_scroll = "enabled";
};
};
output = {
"Virtual-1" = {
bg = "~/.wallpapers/river-1920.png fill";
mode = "1920x1080@60Hz";
};
"DP-2" = {
bg = "~/.wallpapers/river-2560.png fill";
mode = "2560x1440@144Hz";
adaptive_sync = "on";
};
};
menu = "${pkgs.wofi}/bin/wofi --show drun -i | ${pkgs.findutils}/bin/xargs swaymsg exec --";
keybindings = {
"${cfg.config.modifier}+Return" = "exec ${cfg.config.terminal}";
"${cfg.config.modifier}+Shift+q" = "kill";
"${mod}+s" = "exec ${cfg.config.menu}";
"${mod}+Shift+s" = "exec ${pkgs.wofi}/bin/wofi --show run | ${pkgs.findutils}/bin/xargs swaymsg exec --";
"${cfg.config.modifier}+${cfg.config.left}" = "focus left";
"${cfg.config.modifier}+${cfg.config.down}" = "focus down";
"${cfg.config.modifier}+${cfg.config.up}" = "focus up";
"${cfg.config.modifier}+${cfg.config.right}" = "focus right";
"${cfg.config.modifier}+Left" = "focus left";
"${cfg.config.modifier}+Down" = "focus down";
"${cfg.config.modifier}+Up" = "focus up";
"${cfg.config.modifier}+Right" = "focus right";
"${cfg.config.modifier}+Shift+${cfg.config.left}" = "move left";
"${cfg.config.modifier}+Shift+${cfg.config.down}" = "move down";
"${cfg.config.modifier}+Shift+${cfg.config.up}" = "move up";
"${cfg.config.modifier}+Shift+${cfg.config.right}" = "move right";
"${cfg.config.modifier}+Shift+Left" = "move left";
"${cfg.config.modifier}+Shift+Down" = "move down";
"${cfg.config.modifier}+Shift+Up" = "move up";
"${cfg.config.modifier}+Shift+Right" = "move right";
"${mod}+h" = "split h";
"${mod}+v" = "split v";
"${mod}+t" = "fullscreen toggle";
"${cfg.config.modifier}+a" = "focus parent";
"${mod}+r" = "layout stacking";
"${cfg.config.modifier}+w" = "layout tabbed";
"${mod}+f" = "layout toggle split";
"${cfg.config.modifier}+Shift+space" = "floating toggle";
"${cfg.config.modifier}+space" = "focus mode_toggle";
"${cfg.config.modifier}+1" = "workspace number 1";
"${cfg.config.modifier}+2" = "workspace number 2";
"${cfg.config.modifier}+3" = "workspace number 3";
"${cfg.config.modifier}+4" = "workspace number 4";
"${cfg.config.modifier}+5" = "workspace number 5";
"${cfg.config.modifier}+6" = "workspace number 6";
"${cfg.config.modifier}+7" = "workspace number 7";
"${cfg.config.modifier}+8" = "workspace number 8";
"${cfg.config.modifier}+9" = "workspace number 9";
"${cfg.config.modifier}+Shift+1" =
"move container to workspace number 1";
"${cfg.config.modifier}+Shift+2" =
"move container to workspace number 2";
"${cfg.config.modifier}+Shift+3" =
"move container to workspace number 3";
"${cfg.config.modifier}+Shift+4" =
"move container to workspace number 4";
"${cfg.config.modifier}+Shift+5" =
"move container to workspace number 5";
"${cfg.config.modifier}+Shift+6" =
"move container to workspace number 6";
"${cfg.config.modifier}+Shift+7" =
"move container to workspace number 7";
"${cfg.config.modifier}+Shift+8" =
"move container to workspace number 8";
"${cfg.config.modifier}+Shift+9" =
"move container to workspace number 9";
"${cfg.config.modifier}+Shift+minus" = "move scratchpad";
"${cfg.config.modifier}+minus" = "scratchpad show";
"${cfg.config.modifier}+Shift+c" = "reload";
"${mod}+Shift+p" = "restart";
"${mod}+Shift+f" = "exec --no-startup-id ~/.config/wofi/session.sh";
"${mod}+l" = "exec ${swaylockcmd}";
"${mod}+p" = "mode resize";
"${mod}+Print" = "exec grim -o $(swaymsg -t get_outputs | ${pkgs.jq}/bin/jq -r '.[] | select(.focused) | .name')";
"${mod}+Shift+Print" = "exec grim -o $(swaymsg -t get_outputs | ${pkgs.jq}/bin/jq -r '.[] | select(.focused) | .name') - | ${pkgs.wl-clipboard}/bin/wl-copy -t \"image/png\" -f";
"${mod}+Shift+Ctrl+Print" = "exec grim -g \"$(${pkgs.slurp}/bin/slurp)\" - | ${pkgs.wl-clipboard}/bin/wl-copy -t \"image/png\" -f";
"${mod}+Shift+Alt+Print" = "exec grim -g \"$(${pkgs.slurp}/bin/slurp)\"";
"XF86AudioRaiseVolume" = "exec pamixer -ui 2 && pamixer --get-volume > $SWAYSOCK.wob";
"XF86AudioLowerVolume" = "exec pamixer -ud 2 && pamixer --get-volume > $SWAYSOCK.wob";
"XF86AudioMute" = "exec pamixer --toggle-mute && ( pamixer --get-mute && echo 0 > $SWAYSOCK.wob ) || pamixer --get-volume > $SWAYSOCK.wob";
"XF86Calculator" = "exec ${pkgs.gnome.gnome-calculator}/bin/gnome-calculator";
};
terminal = "${pkgs.alacritty}/bin/alacritty";
window = {
border = 1;
titlebar = false;
};
workspaceAutoBackAndForth = true;
}