blob: 643430b406de18e1660ea40a28648efd14210db0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
{
pkgs,
lib,
...
}: let
vars = import ./variables.nix;
mod = "Mod4";
lock-screen = pkgs.writeShellScriptBin "lock-screen" ''
#!/usr/bin/env sh
set -eu
WALL="''${1:-$HOME/Pictures/wallpaper.png}"
TMP="/tmp/lockscreen.png"
RES=$(xrandr | awk '/\*/ {print $1; exit}')
magick "$WALL" -resize "''${RES}^" -gravity center -extent "$RES" "$TMP"
i3lock -i "$TMP"
'';
app-launcher = pkgs.writeShellScriptBin "app-launcher" ''
#!/usr/bin/env sh
BG='${vars.colors.background}'
FG='${vars.colors.foreground}'
ACCENT='${vars.colors.accent}'
TEXT='${vars.colors.text}'
dmenu_run -fn 'JetBrains Mono-12' -nb "$BG" -nf "$FG" -sb "$ACCENT" -sf "$TEXT"
'';
in {
xsession.windowManager.i3 = {
enable = true;
config = {
modifier = mod;
bars = [];
window = {
titlebar = false;
border = 3;
};
# Colors handled by Stylix
startup = [
{command = "sh -c 'feh --bg-scale ~/Pictures/wallpaper.png'";}
];
keybindings = lib.mkOptionDefault {
"${mod}+Return" = "exec ${pkgs.alacritty}/bin/alacritty";
"${mod}+d" = "exec ${app-launcher}/bin/app-launcher";
"${mod}+m" = "exec ${app-launcher}/bin/app-launcher";
"${mod}+Shift+m" = "exec alacritty -e nnn";
"${mod}+n" = "exec firefox";
"${mod}+q" = "kill";
"${mod}+Ctrl+l" = "exec ${lock-screen}/bin/lock-screen";
"${mod}+Shift+r" = "restart";
"${mod}+Ctrl+Shift+e" = "exec sh -c 'i3-msg exit'";
"${mod}+Shift+s" = "exec flameshot gui";
# Focus (vim bindings)
"${mod}+h" = "focus left";
"${mod}+j" = "focus down";
"${mod}+k" = "focus up";
"${mod}+l" = "focus right";
# Focus (arrow keys)
"${mod}+Left" = "focus left";
"${mod}+Down" = "focus down";
"${mod}+Up" = "focus up";
"${mod}+Right" = "focus right";
# Move (vim bindings)
"${mod}+Shift+h" = "move left";
"${mod}+Shift+j" = "move down";
"${mod}+Shift+k" = "move up";
"${mod}+Shift+l" = "move right";
# Move (arrow keys)
"${mod}+Shift+Left" = "move left";
"${mod}+Shift+Down" = "move down";
"${mod}+Shift+Up" = "move up";
"${mod}+Shift+Right" = "move right";
# Volume
"XF86AudioRaiseVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+";
"XF86AudioLowerVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-";
"XF86AudioMute" = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
"XF86AudioMicMute" = "exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle";
# Brightness
"XF86MonBrightnessUp" = "exec brightnessctl set 5%+";
"XF86MonBrightnessDown" = "exec brightnessctl set 5%-";
};
};
extraConfig = ''
smart_borders on
# Remove borders from notification windows
for_window [class="^Dunst$"] border none
for_window [class="^dunst$"] border none
'';
};
home.packages = with pkgs; [
dmenu
i3lock
imagemagick
polybar
alacritty
feh
nnn
];
}
|