nix/programs/i3.nix

168 lines
6.2 KiB
Nix
Raw Normal View History

2024-06-15 21:59:32 +02:00
{ pkgs, ... }:
2024-06-13 15:38:40 +02:00
{
enable = true;
config = rec {
assigns = {
"2" = [
{ class = "discord"; }
{ class = "SchildiChat"; }
{ class = "element"; }
];
};
window = {
border = 1;
2024-06-13 15:38:40 +02:00
titlebar = false;
};
floating = {
2024-06-13 15:38:40 +02:00
border = 1;
titlebar = true;
criteria = [
{ class = "zenity"; }
{ class = "fceux"; }
{ title = "Friends List"; } # steam
];
2024-06-13 15:38:40 +02:00
};
gaps = {
inner = 0;
outer = 0;
};
2024-06-13 15:38:40 +02:00
fonts = {
names = ["JetBrains Mono NL"];
size = 10.0;
};
2024-06-15 21:59:32 +02:00
bars = [{
inherit fonts;
trayOutput = "primary";
statusCommand = "${pkgs.i3status}/bin/i3status";
}];
defaultWorkspace = "workspace number 1";
2024-06-13 15:38:40 +02:00
workspaceOutputAssign = [
2024-06-15 21:59:32 +02:00
{ workspace = "1"; output = "DP-3"; }
{ workspace = "2"; output = "HDMI-3"; }
2024-06-13 15:38:40 +02:00
];
focus = {
followMouse = true;
mouseWarping = true;
newWindow = "urgent";
2024-06-13 15:38:40 +02:00
};
2024-06-13 15:38:40 +02:00
startup = [
2024-06-21 17:54:41 +02:00
# { command = "picom &"; notification = false; }
2024-06-13 15:38:40 +02:00
{ command = "mpd &"; notification = false; }
{ command = "dunst &"; notification = false; }
{ command = "flameshot &"; notification = false; }
# { command = "lcd-bar startdaemon 192.168.1.12 &"; notification = false; }
# { command = "lcd-bar-status &"; notification = false; }
{ command = "i3bar-mouse &"; notification = false; }
# { command = "hydration.sh &"; notification = false; }
2024-06-15 21:59:32 +02:00
{ command = "i3-msg \"workspace 2; append_layout ~/.config/i3/workspace2.json\""; notification = false; }
2024-06-13 15:38:40 +02:00
{ command = "discord &"; notification = false; }
{ command = "element-desktop &"; notification = false; }
2024-06-15 21:59:32 +02:00
2024-06-21 17:54:41 +02:00
# { command = "xrandr --output DP-3 --mode 1920x1080 --rate 239.76 --primary --output HDMI-3 --mode 1920x1080 --rate 74.97 --right-of DP-3 &"; notification = false; }
2024-06-13 15:38:40 +02:00
];
modes = let
cmd_and_center = (cmd: "exec --no-startup-id i3-msg '${cmd}' && i3-center-mouse-on-focus");
in {
resize = {
"Left" = cmd_and_center "resize shrink width 10 px or 10 ppt";
"Right" = cmd_and_center "resize grow width 10 px or 10 ppt";
"Up" = cmd_and_center "resize shrink height 10 px or 10 ppt";
"Down" = cmd_and_center "resize grow height 10 px or 10 ppt";
"Escape" = "mode default";
};
};
2024-06-15 21:59:32 +02:00
modifier = "Mod4";
floating.modifier = "Mod4";
keybindings = let
2024-06-13 15:38:40 +02:00
mod = modifier;
execns = "exec --no-startup-id";
cmd_and_center = (cmd: "${execns} i3-msg '${cmd}' && i3custom-center-mouse-on-focus");
2024-06-13 15:38:40 +02:00
in {
# Program keybinds
"${mod}+Return" = "${execns} alacritty";
"${mod}+Shift+s" = "${execns} flameshot gui";
"${mod}+b" = "${execns} firefox";
"${mod}+d" = "${execns} rofi -show drun";
# hack, see i3 user doc for --release flag
"--release ${mod}+k" = "exec xkill";
2024-06-13 15:38:40 +02:00
# Volume control
"Ctrl+F9" = "${execns} pamixer --toggle-mute";
"Ctrl+F10" = "${execns} pamixer --decrease 5";
"Ctrl+F11" = "${execns} pamixer --increase 5";
2024-06-13 15:38:40 +02:00
# MPD controls
# "Ctrl+F5" = "exec ~/music/select_music.sh";
# "Ctrl+F6" = "exec mpc prev";
# "Ctrl+F7" = "exec mpc toggle";
# "Ctrl+F8" = "exec mpc next";
# "Ctrl+Shift+F6" = "exec mpc seek -3";
# "Ctrl+Shift+F7" = "exec mpc clear";
# "Ctrl+Shift+F8" = "exec mpc seek +3";
# "Ctrl+Shift+F10" = ''exec mpc volume -5 && dunstify "mpc $(mpc volume)" -r 420'';
# "Ctrl+Shift+F11" = ''exec mpc volume +5 && dunstify "mpc $(mpc volume)" -r 420'';
# General i3 keybindings
"${mod}+f" = cmd_and_center "fullscreen toggle";
2024-06-13 15:38:40 +02:00
"${mod}+r" = "mode resize";
"${mod}+Shift+q" = cmd_and_center "kill";
2024-06-13 15:38:40 +02:00
"${mod}+Shift+r" = "restart";
"${mod}+Shift+e" = "${execns} i3-nagbar -t warning -m 'exit?' -b 'yes' 'i3-msg exit'";
# Mouse bindings
2024-06-21 17:54:41 +02:00
# "--border --whole-window button8" = "${execns} i3custom-window-actions";
"${mod}+Left" = cmd_and_center "focus left";
"${mod}+Right" = cmd_and_center "focus right";
"${mod}+Up" = cmd_and_center "focus up";
"${mod}+Down" = cmd_and_center "focus down";
"${mod}+Shift+Left" = cmd_and_center "move left";
"${mod}+Shift+Right" = cmd_and_center "move right";
"${mod}+Shift+Up" = cmd_and_center "move up";
"${mod}+Shift+Down" = cmd_and_center "move down";
"${mod}+q" = cmd_and_center "layout stacking";
"${mod}+w" = cmd_and_center "layout tabbed";
"${mod}+e" = cmd_and_center "layout toggle split";
"${mod}+Shift+space" = "${execns} i3custom-floating-toggle && i3custom-center-mouse-on-focus";
"${mod}+space" = cmd_and_center "focus mode_toggle";
"${mod}+1" = cmd_and_center "workspace number 1";
"${mod}+2" = cmd_and_center "workspace number 2";
"${mod}+3" = cmd_and_center "workspace number 3";
"${mod}+4" = cmd_and_center "workspace number 4";
"${mod}+5" = cmd_and_center "workspace number 5";
"${mod}+6" = cmd_and_center "workspace number 6";
"${mod}+7" = cmd_and_center "workspace number 7";
"${mod}+8" = cmd_and_center "workspace number 8";
"${mod}+9" = cmd_and_center "workspace number 9";
"${mod}+0" = cmd_and_center "workspace number 10";
"${mod}+Shift+1" = cmd_and_center "move container to workspace number 1";
"${mod}+Shift+2" = cmd_and_center "move container to workspace number 2";
"${mod}+Shift+3" = cmd_and_center "move container to workspace number 3";
"${mod}+Shift+4" = cmd_and_center "move container to workspace number 4";
"${mod}+Shift+5" = cmd_and_center "move container to workspace number 5";
"${mod}+Shift+6" = cmd_and_center "move container to workspace number 6";
"${mod}+Shift+7" = cmd_and_center "move container to workspace number 7";
"${mod}+Shift+8" = cmd_and_center "move container to workspace number 8";
"${mod}+Shift+9" = cmd_and_center "move container to workspace number 9";
"${mod}+Shift+0" = cmd_and_center "move container to workspace number 10";
2024-06-13 15:38:40 +02:00
};
};
}