nixos_config/home/modules/wm/sway/default.nix

144 lines
5.5 KiB
Nix
Raw Normal View History

{ pkgs, repoRoot, lib, ... }:
2026-03-10 21:50:51 +01:00
let
commands = import ../../../../lib/commands.nix { inherit pkgs; };
inherit (commands) uwsm lock term notify nag dmenu espanso key_mod key_mod_misc key_left key_right key_up key_down;
2026-03-10 21:50:51 +01:00
in
{
2026-03-10 21:05:35 +01:00
imports = [
2026-03-10 21:50:51 +01:00
./gtk.nix
./xdg.nix
./shells/default.nix
2026-03-10 21:50:51 +01:00
../../programs/foot.nix
2026-03-13 18:56:34 +01:00
../../programs/qutebrowser.nix
2026-03-10 21:50:51 +01:00
../../services/espanso.nix
../../services/gnome-keyring.nix
2026-03-10 21:05:35 +01:00
];
2026-03-10 21:50:51 +01:00
2025-08-24 16:05:54 +02:00
wayland.windowManager.sway = {
enable = true;
2025-12-11 20:23:32 +01:00
wrapperFeatures.gtk = true;
2025-08-24 16:05:54 +02:00
config = {
2026-03-10 21:50:51 +01:00
modifier = key_mod;
2025-12-01 22:40:14 +01:00
startup = [
2025-12-02 19:21:57 +01:00
{ command = "systemctl --user start libinput-gestures"; }
2025-12-01 22:40:14 +01:00
];
2026-01-19 18:22:45 +01:00
bars = [ ];
2025-08-24 16:05:54 +02:00
input = {
2026-03-06 15:09:04 +01:00
"type:keyboard" = {
2026-03-10 21:50:51 +01:00
xkb_options = "fkeys:basic_13-24";
2026-03-06 15:09:04 +01:00
};
2025-08-24 16:05:54 +02:00
"type:touchpad" = {
dwt = "enabled";
tap = "enabled";
natural_scroll = "disabled";
middle_emulation = "enabled";
click_method = "clickfinger";
clickfinger_button_map = "lrm";
scroll_factor = "0.6";
2025-08-24 16:05:54 +02:00
};
"type:mouse" = {
natural_scroll = "disabled";
2025-12-04 15:40:58 +01:00
accel_profile = "flat";
2026-01-08 18:05:08 +01:00
pointer_accel = "0.5";
2025-08-24 16:05:54 +02:00
};
"*" = {
xkb_layout = lib.mkDefault "se,us";
2025-12-04 15:40:58 +01:00
xkb_options = "grp:win_space_toggle";
2025-08-24 16:05:54 +02:00
};
2026-03-10 21:50:51 +01:00
};
2025-08-24 16:05:54 +02:00
keybindings = {
2026-03-10 21:50:51 +01:00
"F13" = "exec ${notify} -t 2000 \"$(${pkgs.xonsh}/bin/xonsh ${repoRoot}/util/toggle_mon.xsh)\"";
2026-03-06 15:09:04 +01:00
2025-12-01 22:40:14 +01:00
"${key_mod}+f" = "fullscreen";
2025-12-05 19:48:03 +01:00
"${key_mod}+Shift+f" = "floating toggle";
2025-08-24 16:05:54 +02:00
"${key_mod}+1" = "workspace number 1";
"${key_mod}+2" = "workspace number 2";
"${key_mod}+3" = "workspace number 3";
"${key_mod}+4" = "workspace number 4";
"${key_mod}+5" = "workspace number 5";
"${key_mod}+6" = "workspace number 6";
"${key_mod}+7" = "workspace number 7";
"${key_mod}+8" = "workspace number 8";
"${key_mod}+9" = "workspace number 9";
2025-12-01 22:40:14 +01:00
"${key_mod}+0" = "scratchpad show";
2025-08-24 16:05:54 +02:00
"${key_mod}+Shift+1" = "move container to workspace number 1; workspace 1";
"${key_mod}+Shift+2" = "move container to workspace number 2; workspace 2";
"${key_mod}+Shift+3" = "move container to workspace number 3; workspace 3";
"${key_mod}+Shift+4" = "move container to workspace number 4; workspace 4";
"${key_mod}+Shift+5" = "move container to workspace number 5; workspace 5";
"${key_mod}+Shift+6" = "move container to workspace number 6; workspace 6";
"${key_mod}+Shift+7" = "move container to workspace number 7; workspace 7";
"${key_mod}+Shift+8" = "move container to workspace number 8; workspace 8";
"${key_mod}+Shift+9" = "move container to workspace number 9; workspace 9";
2025-12-01 22:40:14 +01:00
"${key_mod}+Shift+0" = "move container to scratchpad; scratchpad show";
"${key_mod}+Ctrl+1" = "move container to workspace number 1";
"${key_mod}+Ctrl+2" = "move container to workspace number 2";
"${key_mod}+Ctrl+3" = "move container to workspace number 3";
"${key_mod}+Ctrl+4" = "move container to workspace number 4";
"${key_mod}+Ctrl+5" = "move container to workspace number 5";
"${key_mod}+Ctrl+6" = "move container to workspace number 6";
"${key_mod}+Ctrl+7" = "move container to workspace number 7";
"${key_mod}+Ctrl+8" = "move container to workspace number 8";
"${key_mod}+Ctrl+9" = "move container to workspace number 9";
"${key_mod}+Ctrl+0" = "move container to scratchpad";
2025-08-24 16:05:54 +02:00
2026-02-17 15:52:03 +01:00
"${key_mod}+b" = "splith";
"${key_mod}+v" = "splitv";
"${key_mod}+r" = "layout stacking";
"${key_mod}+w" = "layout tabbed";
"${key_mod}+e" = "layout toggle split";
"${key_mod}+Ctrl+${key_left}" = "focus left";
"${key_mod}+Ctrl+${key_right}" = "focus right";
"${key_mod}+Ctrl+${key_down}" = "focus down";
"${key_mod}+Ctrl+${key_up}" = "focus up";
2025-08-24 16:05:54 +02:00
"${key_mod}+Shift+${key_left}" = "move left";
"${key_mod}+Shift+${key_down}" = "move down";
"${key_mod}+Shift+${key_up}" = "move up";
"${key_mod}+Shift+${key_right}" = "move right";
2025-12-06 23:47:07 +01:00
"${key_mod}+Tab" = "focus right";
"${key_mod}+Shift+Tab" = "focus left";
"${key_mod}+Ctrl+Tab" = "move right";
"${key_mod}+Ctrl+Shift+Tab" = "move left";
2025-12-09 16:34:37 +01:00
"${key_mod}+${key_mod_misc}+Tab" = "workspace next";
"${key_mod}+${key_mod_misc}+Shift+Tab" = "workspace prev";
2025-12-06 23:47:07 +01:00
"Mod4+space" = "exec ${notify} -t 2000 \"$(${pkgs.xonsh}/bin/xonsh ${repoRoot}/util/toggle_xkb.xsh)\"";
2025-12-11 20:23:32 +01:00
"${key_mod}+Shift+q" = "kill";
2025-12-20 13:50:35 +01:00
"Alt+F4" = "kill";
2025-12-11 20:23:32 +01:00
2026-03-10 21:50:51 +01:00
"${key_mod}+Return" = "exec ${uwsm} ${term}";
"${key_mod}+s" = "exec ${uwsm} ${espanso} search";
"${key_mod}+Shift+e" = "exec ${uwsm} ${espanso} toggle";
2025-12-11 20:23:32 +01:00
2025-12-02 19:21:57 +01:00
"${key_mod}+Shift+s" = "exec grimshot savecopy area";
2025-12-11 20:23:32 +01:00
"${key_mod}+Ctrl+s" = "exec grimshot savecopy output";
2026-03-10 21:50:51 +01:00
"${key_mod}+XF86AudioPlay" = "exec ${notify} -t 2000 \"$(${pkgs.xonsh}/bin/xonsh ${repoRoot}/util/swap_sound_device.xsh)\"";
};
2025-08-24 16:05:54 +02:00
window = {
titlebar = false;
2025-12-10 21:43:34 +01:00
commands = [
2025-12-11 20:23:32 +01:00
{ criteria = { all = true; }; command = "inhibit_idle fullscreen"; }
2025-12-10 21:43:34 +01:00
];
2026-03-10 21:50:51 +01:00
};
2025-12-02 19:21:57 +01:00
assigns = {
2026-03-10 21:50:51 +01:00
"1" = [ { app_id = "chromium"; } ];
"2" = [ { class = "steam"; } ];
"3" = [ ];
"4" = [ { class = "VSCodium"; } ];
"5" = [ { app_id = "obsidian"; } ];
"6" = [ ];
"7" = [ ];
"8" = [ { app_id = "discord"; } ];
"9" = [ { app_id = "signal"; } ];
2025-12-02 19:21:57 +01:00
};
2026-03-10 21:50:51 +01:00
};
};
}