261 lines
8.5 KiB
Nix
261 lines
8.5 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
modifier = "Mod4";
|
|
left = "h";
|
|
down = "t";
|
|
up = "n";
|
|
right = "s";
|
|
|
|
lockImage = config.programs.wal.background;
|
|
lock-timeout = "300";
|
|
doff-timeout = "600";
|
|
opacity = "0.95";
|
|
|
|
grim-date-fmt = "+%Y-%m-%d-%H%M%S";
|
|
|
|
cmds = rec {
|
|
swaymsg = pkgs.sway + /bin/swaymsg;
|
|
kitty = pkgs.kitty + /bin/kitty;
|
|
wofi = pkgs.wofi + /bin/wofi;
|
|
swayidle = pkgs.swayidle + /bin/swayidle;
|
|
playerctl = pkgs.playerctl + /bin/playerctl;
|
|
pamixer = pkgs.pamixer + /bin/pamixer;
|
|
gopass = pkgs.gopass + /bin/gopass;
|
|
grim = pkgs.grim + /bin/grim;
|
|
slurp = pkgs.slurp + /bin/slurp;
|
|
wl-copy = pkgs.wl-clipboard + /bin/wl-copy;
|
|
jq = pkgs.jq + /bin/jq;
|
|
|
|
term = "${kitty} --single-instance";
|
|
initial-term = "${kitty} --session ~/.config/kitty/sessions/default.conf";
|
|
menu = "${wofi} --show drun";
|
|
passmenu =
|
|
"${gopass} list -f | ${wofi} --show dmenu | xargs ${gopass} show -c";
|
|
oathmenu =
|
|
"ykman oath code -s $(ykman oath list | wofi --show dmenu) | wl-copy";
|
|
screenshot = ''${grim} -g "$(${slurp})"'';
|
|
idle = ''
|
|
${swayidle} -w \
|
|
timeout ${lock-timeout} 'swaylock -f -i ${lockImage}' \
|
|
timeout ${doff-timeout} 'swaymsg "output * dpms off"' \
|
|
resume 'swaymsg "output * dpms on"' \
|
|
before-sleep 'swaylock -f -i ${lockImage}'
|
|
'';
|
|
swaydump = "${swaymsg} -t get_tree > ~/swaydump.json";
|
|
kill-current = ''
|
|
kill -9 "$(${swaymsg} -t get_tree | ${jq} '.. | (.nodes? // empty)[] | select(.focused==true) | .pid')"'';
|
|
};
|
|
|
|
in {
|
|
wayland.windowManager.sway = {
|
|
enable = true;
|
|
package = null;
|
|
|
|
config = {
|
|
inherit modifier left down up right;
|
|
|
|
bars = [ ];
|
|
|
|
gaps.inner = 16;
|
|
fonts = {
|
|
names = [ "Iosevka" ];
|
|
size = 12.0;
|
|
};
|
|
window.titlebar = true;
|
|
window.border = 0;
|
|
|
|
floating = {
|
|
inherit modifier;
|
|
border = 2;
|
|
criteria = let
|
|
classes = [ "zoom" "Keepassx2" "Sonata" ];
|
|
ids = [
|
|
"pavucontrol"
|
|
"blueman-manager"
|
|
"ario"
|
|
"zenity"
|
|
"yubico.com.yubioath-desktop"
|
|
];
|
|
in (map (class: { inherit class; }) classes)
|
|
++ (map (app_id: { inherit app_id; }) ids);
|
|
};
|
|
|
|
window.commands = [
|
|
{
|
|
criteria = { title = "."; };
|
|
command = "title_format '%title'";
|
|
}
|
|
{
|
|
criteria = { title = "Picture-in-Picture"; };
|
|
command =
|
|
"floating enable, sticky enable, move window position 0 px 0 px";
|
|
}
|
|
{
|
|
criteria = { title = ".* - Sharing Indicator"; };
|
|
command = "floating enable, move window position 0px 0px";
|
|
}
|
|
{
|
|
criteria = { class = "t-engine64"; };
|
|
command = "fullscreen enable";
|
|
}
|
|
{
|
|
criteria = { class = "Emacs"; };
|
|
command = "opacity ${opacity}";
|
|
}
|
|
{
|
|
criteria = { app_id = "kitty"; };
|
|
command = "opacity ${opacity}";
|
|
}
|
|
{
|
|
criteria = { class = "."; };
|
|
command = "inhibit_idle fullscreen";
|
|
}
|
|
{
|
|
criteria = { app_id = "."; };
|
|
command = "inhibit_idle fullscreen";
|
|
}
|
|
{
|
|
criteria = { app_id = "yubico.com."; };
|
|
command = "floating enable";
|
|
}
|
|
];
|
|
|
|
input."type:keyboard" = {
|
|
xkb_layout = "us";
|
|
xkb_options = "compose:ralt";
|
|
};
|
|
# Penguin wireless mouse
|
|
input."1578:16641:MOSART_Semi._2.4G_Keyboard_Mouse".natural_scroll =
|
|
"enabled";
|
|
# One by Wacom tablet
|
|
input."1386:891:Wacom_One_by_Wacom_M_Pen".left_handed = "enabled";
|
|
|
|
startup = [
|
|
{ command = "${pkgs.xorg.xrdb}/bin/xrdb -load ~/.Xresources"; }
|
|
{ command = "${pkgs.mako}/bin/mako"; }
|
|
{ command = cmds.idle; }
|
|
{ command = cmds.initial-term; }
|
|
{
|
|
command =
|
|
"systemctl --user import-environment SWAYSOCK && sleep 2 && systemctl --user restart waybar";
|
|
always = true;
|
|
}
|
|
];
|
|
|
|
keybindings = let mod = config.wayland.windowManager.sway.config.modifier;
|
|
in {
|
|
"${mod}+Return" = "exec ${cmds.term}";
|
|
"${mod}+d" = "exec ${cmds.menu}";
|
|
"${mod}+Shift+c" = "kill";
|
|
"${mod}+Shift+k" = "exec ${cmds.kill-current}";
|
|
"${mod}+p" = "exec ${cmds.passmenu}";
|
|
"${mod}+o" = "exec ${cmds.oathmenu}";
|
|
|
|
"${mod}+${left}" = "focus left";
|
|
"${mod}+${down}" = "focus down";
|
|
"${mod}+${up}" = "focus up";
|
|
"${mod}+${right}" = "focus right";
|
|
|
|
"${mod}+Left" = "focus left";
|
|
"${mod}+Down" = "focus down";
|
|
"${mod}+Up" = "focus up";
|
|
"${mod}+Right" = "focus right";
|
|
|
|
"${mod}+Shift+${left}" = "move left";
|
|
"${mod}+Shift+${down}" = "move down";
|
|
"${mod}+Shift+${up}" = "move up";
|
|
"${mod}+Shift+${right}" = "move right";
|
|
|
|
"${mod}+Shift+Left" = "move left";
|
|
"${mod}+Shift+Down" = "move down";
|
|
"${mod}+Shift+Up" = "move up";
|
|
"${mod}+Shift+Right" = "move right";
|
|
|
|
"${mod}+Ctrl+${left}" = "move workspace to output left";
|
|
"${mod}+Ctrl+${right}" = "move workspace to output right";
|
|
"${mod}+Ctrl+Left" = "move workspace to output left";
|
|
"${mod}+Ctrl+Right" = "move workspace to output right";
|
|
|
|
"${mod}+Shift+b" = "splith";
|
|
"${mod}+Shift+v" = "splitv";
|
|
"${mod}+a" = "focus parent";
|
|
"${mod}+i" = "focus child";
|
|
|
|
"${mod}+j" = "layout stacking";
|
|
"${mod}+w" = "layout tabbed";
|
|
"${mod}+e" = "layout toggle split";
|
|
|
|
"${mod}+f" = "fullscreen toggle";
|
|
"${mod}+Comma" = "border toggle";
|
|
"${mod}+Shift+p" = "sticky toggle";
|
|
"${mod}+Shift+space" = "floating toggle";
|
|
"${mod}+space" = "focus mode_toggle";
|
|
|
|
"${mod}+1" = "workspace number 1";
|
|
"${mod}+2" = "workspace number 2";
|
|
"${mod}+3" = "workspace number 3";
|
|
"${mod}+4" = "workspace number 4";
|
|
"${mod}+5" = "workspace number 5";
|
|
"${mod}+6" = "workspace number 6";
|
|
"${mod}+7" = "workspace number 7";
|
|
"${mod}+8" = "workspace number 8";
|
|
"${mod}+9" = "workspace number 9";
|
|
"${mod}+0" = "workspace number 10";
|
|
|
|
"${mod}+Shift+1" = "move container to workspace number 1";
|
|
"${mod}+Shift+2" = "move container to workspace number 2";
|
|
"${mod}+Shift+3" = "move container to workspace number 3";
|
|
"${mod}+Shift+4" = "move container to workspace number 4";
|
|
"${mod}+Shift+5" = "move container to workspace number 5";
|
|
"${mod}+Shift+6" = "move container to workspace number 6";
|
|
"${mod}+Shift+7" = "move container to workspace number 7";
|
|
"${mod}+Shift+8" = "move container to workspace number 8";
|
|
"${mod}+Shift+9" = "move container to workspace number 9";
|
|
"${mod}+Shift+0" = "move container to workspace number 10";
|
|
|
|
"${mod}+Shift+minus" = "move scratchpad";
|
|
"${mod}+minus" = "scratchpad show";
|
|
|
|
"${mod}+g" = "exec ${cmds.screenshot} - | ${cmds.wl-copy}";
|
|
"${mod}+Shift+g" = ''
|
|
exec ${cmds.screenshot} "Downloads/screenshot-$(date ${grim-date-fmt}).png"'';
|
|
|
|
"${mod}+l" = "exec pkill -USR1 swayidle";
|
|
"${mod}+Shift+e" =
|
|
"exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
|
|
|
|
"${mod}+r" = "mode resize";
|
|
|
|
# "Focus" mode: extra-wide margins
|
|
"${mod}+m" = "gaps horizontal current set 489";
|
|
"${mod}+Shift+m" = "gaps outer current set 0";
|
|
|
|
XF86AudioPlay = "exec ${cmds.playerctl} play-pause";
|
|
XF86AudioNext = "exec ${cmds.playerctl} next";
|
|
XF86AudioPrev = "exec ${cmds.playerctl} prev";
|
|
XF86AudioStop = "exec ${cmds.playerctl} stop";
|
|
XF86AudioRaiseVolume = "exec ${cmds.pamixer} --increase 5";
|
|
XF86AudioLowerVolume = "exec ${cmds.pamixer} --decrease 5";
|
|
};
|
|
};
|
|
|
|
extraConfig = ''
|
|
include "$HOME/.cache/wal/colors-sway"
|
|
|
|
client.focused $color1 $color1 $color3 $color4 $color1
|
|
client.focused_inactive $color4 $color4 $foreground
|
|
client.unfocused $color4 $color4 $foreground
|
|
client.urgent #2f343a #900000 #ffffff #900000 #900000
|
|
client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c
|
|
client.background $background
|
|
|
|
titlebar_padding 7 7
|
|
titlebar_border_thickness 3
|
|
title_align right
|
|
'';
|
|
};
|
|
|
|
home.packages = with pkgs; [ wofi light wl-clipboard ];
|
|
}
|