blob: 835e63334484f772e010fd785302daeb5fd037d8 (
plain) (
blame)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
# TODO(sterni) icons, GTK
# TODO(sterni) X11 cursor
{ config, pkgs, lib, ... }:
let
inherit (pkgs.vuizvui.profpatsch)
getBins
;
inherit (pkgs.writers)
writeDashBin
;
bins = (getBins pkgs.systemd [ "systemctl" ])
// (getBins pkgs.xurls [ "xurls" ])
// (getBins pkgs.bemenu [ "bemenu" ])
// (getBins pkgs.dbus [ "dbus-run-session" ])
// (getBins pkgs.sway [ "sway" "swaymsg" ])
;
# manual start script
startSway = writeDashBin "start-sway" ''
${bins.systemctl} --user import-environment
${bins.systemctl} --user start sway.service
'';
# sway scripts for systemd
swayService = writeDashBin "sway-service" ''
${bins.dbus-run-session} -- "${pkgs.sway}/bin/sway"
'';
exitSway = writeDashBin "exit-sway" ''
${bins.swaymsg} exit
${bins.systemctl} --user unset-environment WAYLAND_DISPLAY
${bins.systemctl} --user unset-environment DISPLAY
'';
# reduce repition in sway config by generating workspace switches
wsConfig = lib.concatMapStringsSep "\n" (n: ''
bindsym $mod+${toString n} workspace number ${toString n}
bindsym $mod+Shift+${toString n} move container to workspace number ${toString n}
'') [1 2 3 4 5 6 7 8 9];
# .Xresources file to fix DPI issues in Xwayland
xResources = pkgs.writeText "Xresources" ''
Xft.dpi: 96
'';
in
{
imports = [
./fonts.nix
];
config = {
programs.sway = {
enable = true;
extraPackages = with pkgs; [
vuizvui.sternenseemann.tep # emoji picker
bemenu # better dmenu
xwayland qt5.qtwayland
wl-clipboard # instead of xsel
grim slurp # screenshots
mako # notifications
];
wrapperFeatures = {
gtk = true;
base = true;
};
};
environment.sessionVariables = {
# TODO(sterni) get screen capture working in firefox
XDG_SESSION_TYPE = "wayland";
XDG_CURRENT_DESKTOP = "sway";
MOZ_ENABLE_WAYLAND = "1";
# SDL
SDL_VIDEODRIVER = "wayland";
# QT
QT_QPA_PLATFORM = "wayland";
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
};
services.dbus.packages = [ pkgs.mako ];
services.pipewire.enable = true;
xdg.portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
xdg-desktop-portal-gtk
];
gtkUsePortal = true;
};
environment.etc = {
"sway/config".text = ''
# correct DPI after hotplugging
exec ${pkgs.xorg.xrdb}/bin/xrdb -load ${xResources}
set $mod Mod4
#set $term ${pkgs.kitty}/bin/kitty
set $term ${pkgs.foot}/bin/foot
set $menu ${pkgs.bemenu}/bin/bemenu-run -l 5 -i
set $makoctl ${pkgs.mako}/bin/makoctl
# neo arrow keys
set $left i
set $right e
set $up l
set $down a
bindsym $mod+Shift+c reload
bindsym $mod+Return exec $term
bindsym $mod+d exec $menu
bindsym $mod+c exec $makoctl dismiss -a
bindsym $mod+g exec ${pkgs.vuizvui.sternenseemann.tep}/bin/tep copy -l 25 -p 'tep>' -i
bindsym $mod+Shift+q kill
bindsym $mod+h splith
bindsym $mod+v splitv
bindsym $mod+s layout stacking
bindsym $mod+t layout tabbed
bindsym $mod+n layout toggle split
bindsym $mod+f fullscreen
bindsym $mod+Shift+space floating toggle
bindsym $mod+space focus mode_toggle
floating_modifier $mod normal
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
bindsym $mod+p focus parent
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
mode "resize" {
bindsym $left resize shrink width 10px
bindsym $down resize grow height 10px
bindsym $up resize shrink height 10px
bindsym $right resize grow width 10px
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
# workspace shortcuts
${wsConfig}
set $pactl ${config.hardware.pulseaudio.package}/bin/pactl
bindsym XF86AudioRaiseVolume exec $pactl set-sink-volume @DEFAULT_SINK@ +5%
bindsym XF86AudioLowerVolume exec $pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym XF86AudioMute exec $pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym XF86AudioMicMute exec $pactl set-source-mute @DEFAULT_SOURCE@ toggle
set $brightnessctl ${pkgs.brightnessctl}/bin/brightnessctl
bindsym XF86MonBrightnessDown exec $brightnessctl set 5%-
bindsym XF86MonBrightnessUp exec $brightnessctl set +5%
bindsym $mod+0 exec ${pkgs.swaylock}/bin/swaylock -c FFC0CB -k -l
font "DejaVu Sans Mono normal 10"
gaps inner 10
output * bg #000000 solid_color
# class border backgr. text indicator
client.focused #ffffff #ffffff #000000 #d0d0d0
client.focused_inactive #000000 #000000 #ffffff #000000
client.unfocused #000000 #000000 #ffffff #000000
client.urgent #900000 #900000 #ffffff #900000
bar {
status_command ${pkgs.i3status}/bin/i3status
position top
colors {
font "DejaVu Sans Mono normal 10"
statusline #ffffff
background #000000
focused_workspace #ffffff #ffffff #000000
active_workspace #ffffff #ffffff #c4c4c4
inactive_workspace #000000 #000000 #ffffff
urgent_workspace #900000 #900000 #ffffff
}
}
'';
"xdg/i3status/config".text = ''
# TODO(sterni) replace i3status?
general {
output_format = "i3bar"
colors = true
interval = 1
}
order += "volume master"
order += "battery all"
order += "tztime dotdate"
order += "tztime dottime"
order += "tztime offset"
volume master {
format = "๐: %volume"
format_muted = "๐: %volume"
device = "pulse"
}
battery all {
format = "%status: %percentage"
status_chr = "โก"
status_bat = "๐"
status_unk = "โ"
status_full = "๐ฏ"
low_threshold = 10
}
tztime dotdate {
timezone = "UTC"
format = "%Y-%m-%d"
}
tztime dottime {
timezone = "UTC"
format = "%Hยท%M"
}
tztime offset {
format = "%z"
}
'';
};
vuizvui.programs.foot = {
enable = true;
settings = {
font = [
"Bitstream Vera Sans Mono"
{
font = "Noto Color Emoji";
options = { size = 8; };
}
];
key-bindings = {
scrollback-up-page = "Control+Shift+Page_Up";
scrollback-down-page = "Control+Shift+Page_Down";
search-start = "Control+Shift+F";
font-increase = "Control+Shift+plus";
font-decrease = "Control+Shift+minus";
font-reset = "Control+Shift+0";
pipe-visible = {
bind = "Control+Shift+e";
cmd = ''sh -c "${lib.concatStringsSep " | " [
bins.xurls
"tac"
"${bins.bemenu} -l 10"
"xargs -r $BROWSER"
]}"'';
};
};
mouse-bindings = {
primary-paste = "none";
};
mouse = {
alternate-scroll-mode = "no";
};
scrollback = {
lines = 10000;
indicator-position = "none";
};
};
};
environment.variables = {
XKB_DEFAULT_LAYOUT = "de";
XKB_DEFAULT_VARIANT = "neo";
# TODO(sterni) user env?
SWAYSOCK = "/run/user/${toString config.users.users.lukas.uid}/sway.sock";
};
environment.systemPackages = with pkgs; [
startSway
xdg_utils
networkmanagerapplet # for nm-connection-ediotr
imv zathura
foot
gnome3.nautilus
];
# allow ydotool to use /dev/uinput
# services.udev.extraRules = ''
# KERNEL=="uinput", GROUP:="uinput", MODE:="0660"
# '';
# users.groups.uinput = {};
# users.users.lukas.extraGroups = [ "uinput" ];
# based on https://nixos.wiki/Sway
systemd.user = {
services.sway = {
bindsTo = [ "graphical-session.target" ];
wants = [ "graphical-session-pre.target" ];
after = [ "graphical-session-pre.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${swayService}/bin/sway-service";
ExecStop = "${exitSway}/bin/exit-sway";
};
};
};
};
}
|