nixos-configuration/home/sway.nix

154 lines
4.3 KiB
Nix

{ lib, pkgs, ... }:
let
mod = "Mod4";
ws1 = "1: www";
ws2 = "2: >_";
ws3 = "3: </>";
ws4 = "4: IM";
ws5 = "5: ./";
ws6 = "6: doc";
ws7 = "7: mail";
ws8 = "8";
ws9 = "9";
ws10 = "10: media";
mode_system = "System: L : | S : | P : | R : | E : ";
in {
imports = [
./gammastep.nix
];
home.packages = with pkgs; [
slurp # screenshot selection
grim # screenshots
wl-clipboard # copy/paste
swaybg # background images
];
# similar to i3-lock-fancy
programs.swaylock = {
enable = true;
package = pkgs.swaylock-effects;
settings = {
screenshots = true;
effect-blur = "7x5";
clock = true;
indicator = true;
indicator-thickness = 7;
};
};
wayland.windowManager.sway = {
enable = true;
swaynag.enable = true;
config = {
modifier = mod;
workspaceAutoBackAndForth = true;
fonts = {
names = [ "NotoSans-Regular" "FontAwesome" ];
style = "Monospace";
size = 12.0;
};
/* TODO: background
output = {
"*" = {
bg = "/home/me/media/Pictures/wallpapers/gargantua-black-3840x2160-11475.jpg fill";
};
};
*/
assigns = {
"${ws1}" = [ { app_id = "firefox"; } ];
"${ws5}" = [ { app_id="thunar"; } ];
"${ws7}" = [ { class="Thunderbird"; } ];
};
floating = {
criteria = [
{ window_role = "pop-up"; }
{ window_role = "task_dialog"; }
{ title = "Preferences$"; }
{ app_id = "org.keepassxc.KeePassXC"; }
{ app_id = "pavucontrol"; }
{ class = "^Pinentry-gtk-2$"; }
];
};
terminal = "alacritty";
keybindings = lib.mkOptionDefault {
"${mod}+b" = "split h";
"${mod}+v" = "split v";
"${mod}+s" = "layout stacking";
"${mod}+w" = "layout tabbed";
"${mod}+e" = "layout toggle split";
"${mod}+space" = "focus mode_toggle";
"${mod}+d" = "exec rofi -show drun";
"${mod}+Tab" = "exec rofi -show window";
"${mod}+1" = "workspace ${ws1}";
"${mod}+2" = "workspace ${ws2}";
"${mod}+3" = "workspace ${ws3}";
"${mod}+4" = "workspace ${ws4}; layout tabbed";
"${mod}+5" = "workspace ${ws5}";
"${mod}+6" = "workspace ${ws6}";
"${mod}+7" = "workspace ${ws7}; layout tabbed";
"${mod}+8" = "workspace ${ws8}";
"${mod}+9" = "workspace ${ws9}";
"${mod}+0" = "workspace ${ws10}";
"${mod}+Shift+1" = "move container to workspace ${ws1}";
"${mod}+Shift+2" = "move container to workspace ${ws2}";
"${mod}+Shift+3" = "move container to workspace ${ws3}";
"${mod}+Shift+4" = "move container to workspace ${ws4}";
"${mod}+Shift+5" = "move container to workspace ${ws5}";
"${mod}+Shift+6" = "move container to workspace ${ws6}";
"${mod}+Shift+7" = "move container to workspace ${ws7}";
"${mod}+Shift+8" = "move container to workspace ${ws8}";
"${mod}+Shift+9" = "move container to workspace ${ws9}";
"${mod}+Shift+0" = "move container to workspace ${ws10}";
"${mod}+Shift+r" = "reload";
"${mod}+r" = "mode \"resize\"";
"${mod}+x" = "mode \"${mode_system}\"";
"${mod}+Shift+x" = "exec swaylock";
};
modes = {
resize = {
h = "resize shrink width 10 px or 10 ppt";
j = "resize grow height 10 px or 10 ppt";
k = "resize shrink height 10 px or 10 ppt";
l = "resize grow width 10 px or 10 ppt";
Return = "mode \"default\"";
Escape = "mode \"default\"";
"${mod}+r" = "mode \"default\"";
};
"${mode_system}" = {
l = "exec ~/bin/lock.sh, mode \"default\"";
s = "exec $Lock systemctl suspend, mode \"default\"";
p = "exec systemctl poweroff -i, mode \"default\"";
r = "exec systemctl reboot, mode \"default\"";
e = "exec i3-msg exit, mode \"default\"";
# back to normal: Enter or Escape or mod+x again
Return = "mode \"default\"";
Escape = "mode \"default\"";
"${mod}+x" = "mode \"default\"";
};
};
window = {
hideEdgeBorders = "both";
# disable titlebar
titlebar = false;
};
};
};
}