Files
nixos-flake/home/i3.nix
2026-03-30 02:22:10 +09:00

98 lines
3.7 KiB
Nix

{ config, pkgs, lib, ... }:
let
modKey = "Mod4";
UP = "k";
DOWN = "j";
LEFT = "h";
RIGHT = "l";
MENU = "rofi -show drun";
TERM = "alacritty";
EXIT = "i3-nagbar -t warning -m 'Exit i3?' -B 'Yes' 'i3-msg exit'";
in
{
xsession.windowManager.i3 = {
enable = true;
config = {
defaultWorkspace = ''workspace number "1"'';
modifier = modKey;
menu = MENU;
terminal = TERM;
workspaceLayout = "tabbed";
gaps = {
smartBorders = "on";
smartGaps = true;
inner = 10;
};
startup = [
{ command = "fcitx5 -r"; always = true; notification = false; }
];
modes = {
resize = {
"${UP}" = "resize shrink height 10 px or 10 ppt";
"${DOWN}" = "resize grow height 10 px or 10 ppt";
"${LEFT}" = "resize shrink width 10 px or 10 ppt";
"${RIGHT}" = "resize grow width 10 px or 10 ppt";
Escape = "mode default";
};
};
keybindings = {
"${modKey}+Return" = "exec ${TERM}";
"${modKey}+d" = "exec ${MENU}";
"${modKey}+Shift+q" = "kill";
"${modKey}+${LEFT}" = "focus left";
"${modKey}+${RIGHT}" = "focus right";
"${modKey}+${UP}" = "focus up";
"${modKey}+${DOWN}" = "focus down";
"${modKey}+Shift+${LEFT}" = "move left";
"${modKey}+Shift+${RIGHT}" = "move right";
"${modKey}+Shift+${UP}" = "move up";
"${modKey}+Shift+${DOWN}" = "move down";
"${modKey}+y" = "split h";
"${modKey}+t" = "split v";
"${modKey}+f" = "fullscreen toggle";
"${modKey}+s" = "layout stacking";
"${modKey}+w" = "layout tabbed";
"${modKey}+e" = "layout toggle split";
"${modKey}+Shift+space" = "floating toggle";
"${modKey}+space" = "focus mode_toggle";
"${modKey}+minus" = "scratchpad show";
"${modKey}+Shift+minus" = "move scratchpad";
"${modKey}+n" = "workspace next";
"${modKey}+p" = "workspace prev";
"${modKey}+Shift+c" = "reload";
"${modKey}+Shift+r" = "restart";
"${modKey}+Shift+e" = "exec ${EXIT}";
"${modKey}+r" = "mode resize";
"${modKey}+1" = ''workspace number "1"'';
"${modKey}+2" = ''workspace number "2"'';
"${modKey}+3" = ''workspace number "3"'';
"${modKey}+4" = ''workspace number "4"'';
"${modKey}+5" = ''workspace number "5"'';
"${modKey}+6" = ''workspace number "6"'';
"${modKey}+7" = ''workspace number "7"'';
"${modKey}+8" = ''workspace number "8"'';
"${modKey}+9" = ''workspace number "9"'';
"${modKey}+0" = ''workspace number "10"'';
"${modKey}+Shift+1" = ''move container to workspace number "1"'';
"${modKey}+Shift+2" = ''move container to workspace number "2"'';
"${modKey}+Shift+3" = ''move container to workspace number "3"'';
"${modKey}+Shift+4" = ''move container to workspace number "4"'';
"${modKey}+Shift+5" = ''move container to workspace number "5"'';
"${modKey}+Shift+6" = ''move container to workspace number "6"'';
"${modKey}+Shift+7" = ''move container to workspace number "7"'';
"${modKey}+Shift+8" = ''move container to workspace number "8"'';
"${modKey}+Shift+9" = ''move container to workspace number "9"'';
"${modKey}+Shift+0" = ''move container to workspace number "10"'';
"XF86AudioRaiseVolume" = ''exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5%'';
"XF86AudioLowerVolume" = ''exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5%'';
"XF86AudioMute" = ''exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle'';
};
};
};
home.packages = with pkgs; [
rofi
];
}