173 lines
5.9 KiB
Nix
173 lines
5.9 KiB
Nix
{ config, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.home.i3_sway;
|
|
i3_cfg = config.xsession.windowManager.i3.config;
|
|
|
|
shared_config = recursiveUpdate rec {
|
|
modifier = "Mod4";
|
|
terminal = "kitty";
|
|
defaultWorkspace = "workspace number 1";
|
|
|
|
bars = [{
|
|
position = "bottom";
|
|
statusCommand = "i3status";
|
|
trayOutput = "primary"; # Enable system tray on primary output
|
|
}];
|
|
|
|
keybindings = {
|
|
"${shared_config.modifier}+Return" = "exec ${terminal}";
|
|
"${shared_config.modifier}+Shift+q" = "kill";
|
|
"${shared_config.modifier}+d" = "exec ${i3_cfg.menu}";
|
|
|
|
"${shared_config.modifier}+h" = "focus left";
|
|
"${shared_config.modifier}+j" = "focus down";
|
|
"${shared_config.modifier}+k" = "focus up";
|
|
"${shared_config.modifier}+l" = "focus right";
|
|
|
|
"${shared_config.modifier}+Shift+h" = "move left";
|
|
"${shared_config.modifier}+Shift+j" = "move down";
|
|
"${shared_config.modifier}+Shift+k" = "move up";
|
|
"${shared_config.modifier}+Shift+l" = "move right";
|
|
|
|
"${shared_config.modifier}+Left" = "focus left";
|
|
"${shared_config.modifier}+Down" = "focus down";
|
|
"${shared_config.modifier}+Up" = "focus up";
|
|
"${shared_config.modifier}+Right" = "focus right";
|
|
|
|
"${shared_config.modifier}+Shift+Left" = "move left";
|
|
"${shared_config.modifier}+Shift+Down" = "move down";
|
|
"${shared_config.modifier}+Shift+Up" = "move up";
|
|
"${shared_config.modifier}+Shift+Right" = "move right";
|
|
|
|
#"${shared_config.modifier}+h" = "split h";
|
|
"${shared_config.modifier}+v" = "split v";
|
|
"${shared_config.modifier}+f" = "fullscreen toggle";
|
|
|
|
"${shared_config.modifier}+s" = "layout stacking";
|
|
"${shared_config.modifier}+w" = "layout tabbed";
|
|
"${shared_config.modifier}+e" = "layout toggle split";
|
|
|
|
"${shared_config.modifier}+Shift+space" = "floating toggle";
|
|
"${shared_config.modifier}+space" = "focus mode_toggle";
|
|
|
|
"${shared_config.modifier}+a" = "focus parent";
|
|
|
|
"${shared_config.modifier}+Shift+minus" = "move scratchpad";
|
|
"${shared_config.modifier}+minus" = "scratchpad show";
|
|
|
|
"${shared_config.modifier}+1" = "workspace number 1";
|
|
"${shared_config.modifier}+2" = "workspace number 2";
|
|
"${shared_config.modifier}+3" = "workspace number 3";
|
|
"${shared_config.modifier}+4" = "workspace number 4";
|
|
"${shared_config.modifier}+5" = "workspace number 5";
|
|
"${shared_config.modifier}+6" = "workspace number 6";
|
|
"${shared_config.modifier}+7" = "workspace number 7";
|
|
"${shared_config.modifier}+8" = "workspace number 8";
|
|
"${shared_config.modifier}+9" = "workspace number 9";
|
|
"${shared_config.modifier}+0" = "workspace number 10";
|
|
|
|
"${shared_config.modifier}+Shift+1" =
|
|
"move container to workspace number 1";
|
|
"${shared_config.modifier}+Shift+2" =
|
|
"move container to workspace number 2";
|
|
"${shared_config.modifier}+Shift+3" =
|
|
"move container to workspace number 3";
|
|
"${shared_config.modifier}+Shift+4" =
|
|
"move container to workspace number 4";
|
|
"${shared_config.modifier}+Shift+5" =
|
|
"move container to workspace number 5";
|
|
"${shared_config.modifier}+Shift+6" =
|
|
"move container to workspace number 6";
|
|
"${shared_config.modifier}+Shift+7" =
|
|
"move container to workspace number 7";
|
|
"${shared_config.modifier}+Shift+8" =
|
|
"move container to workspace number 8";
|
|
"${shared_config.modifier}+Shift+9" =
|
|
"move container to workspace number 9";
|
|
"${shared_config.modifier}+Shift+0" =
|
|
"move container to workspace number 10";
|
|
|
|
"${shared_config.modifier}+Shift+c" = "reload";
|
|
"${shared_config.modifier}+Shift+r" = "restart";
|
|
|
|
"${shared_config.modifier}+r" = "mode resize";
|
|
|
|
"XF86MonBrightnessUp" = "exec brightnessctl s +5%";
|
|
"XF86MonBrightnessDown" = "exec brightnessctl s 5%-";
|
|
};
|
|
} cfg.extraSharedConfig;
|
|
in {
|
|
options.home.i3_sway = {
|
|
extraSharedConfig = mkOption {
|
|
default = {};
|
|
};
|
|
extraI3Config = mkOption {
|
|
default = {};
|
|
};
|
|
extraSwayConfig = mkOption {
|
|
default = {};
|
|
};
|
|
};
|
|
|
|
config = {
|
|
xsession.windowManager.i3 = let
|
|
base_i3_config = recursiveUpdate shared_config {
|
|
keybindings = {
|
|
"${shared_config.modifier}+Shift+e" =
|
|
"exec i3-nagbar -t warning -m 'Do you want to exit i3?' -b 'Yes' 'i3-msg exit'";
|
|
};
|
|
startup = [
|
|
# GNOME polkit authentication agent
|
|
{
|
|
command = "/run/current-system/sw/libexec/polkit-gnome-authentication-agent-1";
|
|
always = false;
|
|
notification = false;
|
|
}
|
|
# Picom compositor for smooth rendering and no tearing (important for Nvidia)
|
|
{
|
|
command = "picom -b";
|
|
always = false;
|
|
notification = false;
|
|
}
|
|
# NetworkManager system tray applet
|
|
{
|
|
command = "nm-applet";
|
|
always = false;
|
|
notification = false;
|
|
}
|
|
];
|
|
};
|
|
in {
|
|
enable = true;
|
|
config = recursiveUpdate base_i3_config cfg.extraI3Config;
|
|
};
|
|
|
|
wayland.windowManager.sway = let
|
|
base_sway_config = recursiveUpdate shared_config {
|
|
keybindings = {
|
|
"${shared_config.modifier}+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'";
|
|
};
|
|
input = {
|
|
"type:keyboard" = {
|
|
xkb_options = "caps:escape";
|
|
};
|
|
"type:touchpad" = {
|
|
tap = "enabled";
|
|
tap_button_map = "lrm";
|
|
drag = "enabled";
|
|
natural_scroll = "disabled";
|
|
dwt = "enabled";
|
|
};
|
|
};
|
|
};
|
|
in {
|
|
enable = true;
|
|
config = recursiveUpdate base_sway_config cfg.extraSwayConfig;
|
|
};
|
|
};
|
|
}
|