summaryrefslogtreecommitdiffstats
path: root/usecases/desktop/graphical/sway.nix
diff options
context:
space:
mode:
Diffstat (limited to 'usecases/desktop/graphical/sway.nix')
-rw-r--r--usecases/desktop/graphical/sway.nix608
1 files changed, 319 insertions, 289 deletions
diff --git a/usecases/desktop/graphical/sway.nix b/usecases/desktop/graphical/sway.nix
index 815f787..7e66796 100644
--- a/usecases/desktop/graphical/sway.nix
+++ b/usecases/desktop/graphical/sway.nix
@@ -1,319 +1,346 @@
1_inputs: { 1_inputs:
2 lib, 2{ lib, pkgs, ... }:
3 pkgs, 3{
4 ...
5}: {
6 services.greetd = { 4 services.greetd = {
7 enable = true; 5 enable = true;
8 vt = 6; 6 vt = 6;
9 settings.default_session.command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd sway"; 7 settings.default_session.command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd sway";
10 }; 8 };
11 9
12 home-manager.users.minijackson = { 10 home-manager.users.minijackson =
13 config, 11 { config, osConfig, ... }:
14 osConfig, 12 {
15 ... 13 wayland.windowManager.sway = {
16 }: { 14 enable = true;
17 wayland.windowManager.sway = { 15
18 enable = true; 16 extraSessionCommands =
19 17 let
20 extraSessionCommands = let 18 schema = pkgs.gsettings-desktop-schemas;
21 schema = pkgs.gsettings-desktop-schemas; 19 datadir = "${schema}/share/gsettings-schemas/${schema.name}";
22 datadir = "${schema}/share/gsettings-schemas/${schema.name}"; 20 in
23 in '' 21 ''
24 # https://github.com/emersion/xdg-desktop-portal-wlr/issues/20 22 # https://github.com/emersion/xdg-desktop-portal-wlr/issues/20
25 export XDG_CURRENT_DESKTOP=sway 23 export XDG_CURRENT_DESKTOP=sway
26 # https://github.com/emersion/xdg-desktop-portal-wlr/pull/11 24 # https://github.com/emersion/xdg-desktop-portal-wlr/pull/11
27 export XDG_SESSION_TYPE=wayland 25 export XDG_SESSION_TYPE=wayland
28 26
29 # Makes gsettings work 27 # Makes gsettings work
30 export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS 28 export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS
31 29
32 export SDL_VIDEODRIVER=wayland 30 export SDL_VIDEODRIVER=wayland
33 31
34 export QT_QPA_PLATFORM=wayland 32 export QT_QPA_PLATFORM=wayland
35 export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 33 export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
36 ''; 34 '';
37 35
38 wrapperFeatures.gtk = true; 36 wrapperFeatures.gtk = true;
39 37
40 config = { 38 config = {
41 workspaceLayout = "tabbed"; 39 workspaceLayout = "tabbed";
42 40
43 # Using waybar 41 # Using waybar
44 bars = []; 42 bars = [ ];
45 43
46 colors = with osConfig.theme.colors; { 44 colors = with osConfig.theme.colors; {
47 focused = { 45 focused = {
48 border = lightBackground; 46 border = lightBackground;
49 background = lightBackground; 47 background = lightBackground;
50 text = foreground; 48 text = foreground;
51 indicator = dominant; 49 indicator = dominant;
52 childBorder = dominant; 50 childBorder = dominant;
51 };
52
53 focusedInactive = {
54 border = background;
55 background = background;
56 text = dimForeground;
57 indicator = dominant;
58 childBorder = background;
59 };
60
61 unfocused = {
62 border = background;
63 background = background;
64 text = dimForeground;
65 indicator = dominant;
66 childBorder = background;
67 };
68
69 urgent = {
70 border = brightRed;
71 background = brightRed;
72 text = foreground;
73 indicator = brightRed;
74 childBorder = brightRed;
75 };
76
77 placeholder = {
78 border = background0;
79 background = background0;
80 text = foreground;
81 indicator = background0;
82 childBorder = background0;
83 };
53 }; 84 };
54 85
55 focusedInactive = { 86 floating.criteria = [ { title = "Steam - News"; } ];
56 border = background; 87
57 background = background; 88 input = {
58 text = dimForeground; 89 "*" = {
59 indicator = dominant; 90 xkb_options = "compose:caps";
60 childBorder = background; 91 };
92
93 "1:1:AT_Translated_Set_2_keyboard" = {
94 xkb_layout = "fr";
95 xkb_variant = "oss";
96 xkb_options = "compose:caps";
97 xkb_numlock = "enabled";
98 };
99
100 "1452:514:Alps_Electric_M2452" = {
101 xkb_layout = "fr";
102 xkb_variant = "oss";
103 xkb_options = "compose:caps,lv3:rwin_switch";
104 xkb_numlock = "enabled";
105 };
106
107 "7764:8240:TypeMatrix.com_USB_Keyboard" = {
108 xkb_layout = "us";
109 xkb_variant = "dvorak";
110 xkb_options = "eurosign:e,compose:caps";
111 xkb_numlock = "enabled";
112 };
113
114 "1133:49948:Logitech_USB_Keyboard" = {
115 xkb_layout = "fr";
116 xkb_variant = "oss";
117 xkb_options = "eurosign:e,compose:caps";
118 xkb_numlock = "enabled";
119 };
120
121 "1102:4639:DELL0817:00_044E:121F_Mouse" = {
122 scroll_method = "on_button_down";
123 scroll_button = "button2";
124 };
61 }; 125 };
62 126
63 unfocused = { 127 keybindings =
64 border = background; 128 let
65 background = background; 129 modifier = config.wayland.windowManager.sway.config.modifier;
66 text = dimForeground; 130 inherit (lib) getExe;
67 indicator = dominant; 131 inherit (pkgs)
68 childBorder = background; 132 brightnessctl
69 }; 133 grim
70 134 pamixer
71 urgent = { 135 slurp
72 border = brightRed; 136 ;
73 background = brightRed; 137 in
74 text = foreground; 138 lib.mkOptionDefault {
75 indicator = brightRed; 139 "${modifier}+ampersand" = "workspace 1";
76 childBorder = brightRed; 140 "${modifier}+eacute" = "workspace 2";
77 }; 141 "${modifier}+quotedbl" = "workspace 3";
78 142 "${modifier}+apostrophe" = "workspace 4";
79 placeholder = { 143 "${modifier}+parenleft" = "workspace 5";
80 border = background0; 144 "${modifier}+minus" = "workspace 6";
81 background = background0; 145 "${modifier}+egrave" = "workspace 7";
82 text = foreground; 146 "${modifier}+underscore" = "workspace 8";
83 indicator = background0; 147 "${modifier}+ccedilla" = "workspace 9";
84 childBorder = background0; 148 "${modifier}+agrave" = "workspace 10";
149
150 "${modifier}+Shift+ampersand" = "move container to workspace 1";
151 "${modifier}+Shift+eacute" = "move container to workspace 2";
152 "${modifier}+Shift+quotedbl" = "move container to workspace 3";
153 "${modifier}+Shift+apostrophe" = "move container to workspace 4";
154 "${modifier}+Shift+parenleft" = "move container to workspace 5";
155 "${modifier}+Shift+minus" = "move container to workspace 6";
156 "${modifier}+Shift+egrave" = "move container to workspace 7";
157 "${modifier}+Shift+underscore" = "move container to workspace 8";
158 "${modifier}+Shift+ccedilla" = "move container to workspace 9";
159 "${modifier}+Shift+agrave" = "move container to workspace 10";
160
161 "${modifier}+Ctrl+h" = "move workspace to output left";
162 "${modifier}+Ctrl+j" = "move workspace to output down";
163 "${modifier}+Ctrl+k" = "move workspace to output up";
164 "${modifier}+Ctrl+l" = "move workspace to output right";
165
166 "${modifier}+Ctrl+Left" = "move workspace to output left";
167 "${modifier}+Ctrl+Down" = "move workspace to output down";
168 "${modifier}+Ctrl+Up" = "move workspace to output up";
169 "${modifier}+Ctrl+Right" = "move workspace to output right";
170
171 "${modifier}+n" = "split none";
172
173 "${modifier}+comma" = "exec swaync-client --close-latest";
174 "${modifier}+Shift+comma" = "exec swaync-client --close-all";
175 "${modifier}+period" = "exec swaync-client --toggle-panel";
176
177 "${modifier}+m" = "exec ${pkgs.swaylock}/bin/swaylock";
178
179 "${modifier}+c" = "exec rofi -show calc -modi calc -no-sort -no-persist-history -calc-command 'echo -n {result} | wl-copy'";
180 "${modifier}+p" = "exec rofi-pass";
181
182 "XF86AudioRaiseVolume" = "exec ${getExe pamixer} -i 5";
183 "XF86AudioLowerVolume" = "exec ${getExe pamixer} -d 5";
184 "XF86AudioMute" = "exec ${getExe pamixer} -t";
185
186 "XF86MonBrightnessUp" = "exec ${getExe brightnessctl} set -- +10%";
187 "XF86MonBrightnessDown" = "exec ${getExe brightnessctl} set -- -10%";
188
189 "Print" = "exec ${getExe grim}";
190 "Shift+Print" = "exec ${getExe slurp} | ${getExe grim} -g -";
191 };
192
193 menu = ''
194 rofi -show drun -terminal alacritty -modi "drun,run,emoji,keys"
195 '';
196
197 modifier = "Mod4";
198
199 output."*".bg = "${../../../res/wallpapers/wallpaper-1920x1080-kernel-card-black.png} fill";
200
201 startup = [ { command = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; } ];
202
203 terminal = "${pkgs.alacritty}/bin/alacritty";
204
205 window = {
206 border = 2;
207 hideEdgeBorders = "smart";
85 }; 208 };
86 }; 209 };
210 };
87 211
88 floating.criteria = [ 212 services.swaync = {
89 {title = "Steam - News";} 213 enable = true;
90 ]; 214
91 215 settings = {
92 input = { 216 widgets = [
93 "*" = { 217 "buttons-grid"
94 xkb_options = "compose:caps"; 218 "mpris"
95 }; 219 "volume"
96 220 "backlight"
97 "1:1:AT_Translated_Set_2_keyboard" = { 221 "inhibitors"
98 xkb_layout = "fr"; 222 "title"
99 xkb_variant = "oss"; 223 "dnd"
100 xkb_options = "compose:caps"; 224 "notifications"
101 xkb_numlock = "enabled"; 225 ];
102 }; 226 widget-config = {
103 227 buttons-grid.actions = [
104 "1452:514:Alps_Electric_M2452" = { 228 {
105 xkb_layout = "fr"; 229 label = "󰌾";
106 xkb_variant = "oss"; 230 command = "swaylock";
107 xkb_options = "compose:caps,lv3:rwin_switch"; 231 }
108 xkb_numlock = "enabled"; 232 {
109 }; 233 label = "󰜉";
110 234 command = "systemctl reboot";
111 "7764:8240:TypeMatrix.com_USB_Keyboard" = { 235 }
112 xkb_layout = "us"; 236 {
113 xkb_variant = "dvorak"; 237 label = "󰐥";
114 xkb_options = "eurosign:e,compose:caps"; 238 command = "systemctl poweroff";
115 xkb_numlock = "enabled"; 239 }
240 ];
241 volume = {
242 label = "󰕾";
243 show-per-app = true;
244 show-per-app-label = true;
245 };
116 }; 246 };
247 };
117 248
118 "1133:49948:Logitech_USB_Keyboard" = { 249 style = pkgs.substituteAll {
119 xkb_layout = "fr"; 250 src = ./swaync.css;
120 xkb_variant = "oss"; 251 inherit (osConfig.theme.colors)
121 xkb_options = "eurosign:e,compose:caps"; 252 background1
122 xkb_numlock = "enabled"; 253 background2
123 }; 254 background5
255 dimDominant
256 dominant
257 foreground
258 foreground3
259 softBackground
260 ;
261 };
262 };
124 263
125 "1102:4639:DELL0817:00_044E:121F_Mouse" = { 264 services.wlsunset = {
126 scroll_method = "on_button_down"; 265 enable = true;
127 scroll_button = "button2"; 266 latitude = "48.864716";
128 }; 267 longitude = "2.349014";
268 # Reduce blue light anyways
269 temperature = {
270 day = 4000;
271 night = 2500;
129 }; 272 };
273 };
130 274
131 keybindings = let 275 programs.swaylock = {
132 modifier = config.wayland.windowManager.sway.config.modifier; 276 enable = true;
133 inherit (lib) getExe; 277 settings =
134 inherit (pkgs) brightnessctl grim pamixer slurp; 278 let
135 in 279 inherit (osConfig.theme.colors)
136 lib.mkOptionDefault { 280 background
137 "${modifier}+ampersand" = "workspace 1"; 281 brightGreen
138 "${modifier}+eacute" = "workspace 2"; 282 brightOrange
139 "${modifier}+quotedbl" = "workspace 3"; 283 brightRed
140 "${modifier}+apostrophe" = "workspace 4"; 284 dominant
141 "${modifier}+parenleft" = "workspace 5"; 285 neutralOrange
142 "${modifier}+minus" = "workspace 6"; 286 neutralRed
143 "${modifier}+egrave" = "workspace 7"; 287 ;
144 "${modifier}+underscore" = "workspace 8"; 288 in
145 "${modifier}+ccedilla" = "workspace 9"; 289 {
146 "${modifier}+agrave" = "workspace 10"; 290 ignore-empty-password = true;
147 291 show-failed-attempts = true;
148 "${modifier}+Shift+ampersand" = "move container to workspace 1";
149 "${modifier}+Shift+eacute" = "move container to workspace 2";
150 "${modifier}+Shift+quotedbl" = "move container to workspace 3";
151 "${modifier}+Shift+apostrophe" = "move container to workspace 4";
152 "${modifier}+Shift+parenleft" = "move container to workspace 5";
153 "${modifier}+Shift+minus" = "move container to workspace 6";
154 "${modifier}+Shift+egrave" = "move container to workspace 7";
155 "${modifier}+Shift+underscore" = "move container to workspace 8";
156 "${modifier}+Shift+ccedilla" = "move container to workspace 9";
157 "${modifier}+Shift+agrave" = "move container to workspace 10";
158
159 "${modifier}+Ctrl+h" = "move workspace to output left";
160 "${modifier}+Ctrl+j" = "move workspace to output down";
161 "${modifier}+Ctrl+k" = "move workspace to output up";
162 "${modifier}+Ctrl+l" = "move workspace to output right";
163
164 "${modifier}+Ctrl+Left" = "move workspace to output left";
165 "${modifier}+Ctrl+Down" = "move workspace to output down";
166 "${modifier}+Ctrl+Up" = "move workspace to output up";
167 "${modifier}+Ctrl+Right" = "move workspace to output right";
168
169 "${modifier}+n" = "split none";
170
171 "${modifier}+comma" = "exec makoctl dismiss";
172 "${modifier}+Shift+comma" = "exec makoctl dismiss --all";
173 "${modifier}+period" = "exec makoctl menu rofi -dmenu -no-custom";
174
175 "${modifier}+m" = "exec ${pkgs.swaylock}/bin/swaylock";
176
177 "${modifier}+c" = "exec rofi -show calc -modi calc -no-sort -no-persist-history -calc-command 'echo -n {result} | wl-copy'";
178 "${modifier}+p" = "exec rofi-pass";
179
180 "XF86AudioRaiseVolume" = "exec ${getExe pamixer} -i 5";
181 "XF86AudioLowerVolume" = "exec ${getExe pamixer} -d 5";
182 "XF86AudioMute" = "exec ${getExe pamixer} -t";
183
184 "XF86MonBrightnessUp" = "exec ${getExe brightnessctl} set -- +10%";
185 "XF86MonBrightnessDown" = "exec ${getExe brightnessctl} set -- -10%";
186
187 "Print" = "exec ${getExe grim}";
188 "Shift+Print" = "exec ${getExe slurp} | ${getExe grim} -g -";
189 };
190 292
191 menu = '' 293 image = "${../../../res/wallpapers/wallpaper-1920x1080-install-gentoo.png}";
192 rofi -show drun -terminal alacritty -modi "drun,run,emoji,keys"
193 '';
194 294
195 modifier = "Mod4"; 295 font = "monospace";
196 296
197 output."*".bg = "${../../../res/wallpapers/wallpaper-1920x1080-kernel-card-black.png} fill"; 297 inside-color = "${lib.removePrefix "#" dominant}dd";
298 inside-clear-color = "${lib.removePrefix "#" neutralOrange}dd";
299 inside-ver-color = "${lib.removePrefix "#" neutralOrange}dd";
300 inside-wrong-color = "${lib.removePrefix "#" neutralRed}dd";
198 301
199 startup = [ 302 key-hl-color = "${lib.removePrefix "#" brightGreen}ee";
200 # TODO: use systemd user service 303 bs-hl-color = "${lib.removePrefix "#" neutralRed}ee";
201 {
202 command = "mako";
203 always = true;
204 }
205 {command = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";}
206 ];
207 304
208 terminal = "${pkgs.alacritty}/bin/alacritty"; 305 line-color = "${lib.removePrefix "#" background}ee";
306 line-clear-color = "${lib.removePrefix "#" background}ee";
307 line-ver-color = "${lib.removePrefix "#" background}ee";
308 line-wrong-color = "${lib.removePrefix "#" background}ee";
209 309
210 window = { 310 ring-color = "${lib.removePrefix "#" dominant}ee";
211 border = 2; 311 ring-clear-color = "${lib.removePrefix "#" brightOrange}ee";
212 hideEdgeBorders = "smart"; 312 ring-ver-color = "${lib.removePrefix "#" brightOrange}ee";
213 }; 313 ring-wrong-color = "${lib.removePrefix "#" brightRed}ee";
214 };
215 };
216 314
217 services.mako = let 315 separator-color = "${lib.removePrefix "#" background}ee";
218 inherit (osConfig.theme.colors) background0 dimDominant foreground neutralBlue;
219 in {
220 enable = true;
221 backgroundColor = background0;
222 borderColor = dimDominant;
223 borderSize = 2;
224 progressColor = neutralBlue;
225 textColor = foreground;
226
227 margin = "15";
228 padding = "7";
229
230 groupBy = "app-name";
231
232 extraConfig = ''
233 [mode=do-not-disturb]
234 invisible=1
235 '';
236 };
237 316
238 services.wlsunset = { 317 text-color = "${lib.removePrefix "#" background}ff";
239 enable = true; 318 text-clear-color = "${lib.removePrefix "#" background}ff";
240 latitude = "48.864716"; 319 text-ver-color = "${lib.removePrefix "#" background}ff";
241 longitude = "2.349014"; 320 text-wrong-color = "${lib.removePrefix "#" background}ff";
242 # Reduce blue light anyways
243 temperature = {
244 day = 4000;
245 night = 2500;
246 };
247 };
248 321
249 programs.swaylock = { 322 indicator-radius = 75;
250 enable = true; 323 indicator-thickness = 10;
251 settings = let 324 };
252 inherit
253 (osConfig.theme.colors)
254 background
255 brightGreen
256 brightOrange
257 brightRed
258 dominant
259 neutralOrange
260 neutralRed
261 ;
262 in {
263 ignore-empty-password = true;
264 show-failed-attempts = true;
265
266 image = "${../../../res/wallpapers/wallpaper-1920x1080-install-gentoo.png}";
267
268 font = "monospace";
269
270 inside-color = "${lib.removePrefix "#" dominant}dd";
271 inside-clear-color = "${lib.removePrefix "#" neutralOrange}dd";
272 inside-ver-color = "${lib.removePrefix "#" neutralOrange}dd";
273 inside-wrong-color = "${lib.removePrefix "#" neutralRed}dd";
274
275 key-hl-color = "${lib.removePrefix "#" brightGreen}ee";
276 bs-hl-color = "${lib.removePrefix "#" neutralRed}ee";
277
278 line-color = "${lib.removePrefix "#" background}ee";
279 line-clear-color = "${lib.removePrefix "#" background}ee";
280 line-ver-color = "${lib.removePrefix "#" background}ee";
281 line-wrong-color = "${lib.removePrefix "#" background}ee";
282
283 ring-color = "${lib.removePrefix "#" dominant}ee";
284 ring-clear-color = "${lib.removePrefix "#" brightOrange}ee";
285 ring-ver-color = "${lib.removePrefix "#" brightOrange}ee";
286 ring-wrong-color = "${lib.removePrefix "#" brightRed}ee";
287
288 separator-color = "${lib.removePrefix "#" background}ee";
289
290 text-color = "${lib.removePrefix "#" background}ff";
291 text-clear-color = "${lib.removePrefix "#" background}ff";
292 text-ver-color = "${lib.removePrefix "#" background}ff";
293 text-wrong-color = "${lib.removePrefix "#" background}ff";
294
295 indicator-radius = 75;
296 indicator-thickness = 10;
297 }; 325 };
298 };
299 326
300 xsession.importedVariables = [ 327 xsession.importedVariables = [
301 "DBUS_SESSION_BUS_ADDRESS" 328 "DBUS_SESSION_BUS_ADDRESS"
302 "DISPLAY" 329 "DISPLAY"
303 "SSH_AUTH_SOCK" 330 "SSH_AUTH_SOCK"
304 "XAUTHORITY" 331 "XAUTHORITY"
305 "XDG_DATA_DIRS" 332 "XDG_DATA_DIRS"
306 "XDG_RUNTIME_DIR" 333 "XDG_RUNTIME_DIR"
307 "XDG_SESSION_ID" 334 "XDG_SESSION_ID"
308 335
309 "WAYLAND_DISPLAY" 336 "WAYLAND_DISPLAY"
310 "SWAYSOCK" 337 "SWAYSOCK"
311 "I3SOCK" 338 "I3SOCK"
312 339
313 "XDG_CURRENT_DESKTOP" 340 "XDG_CURRENT_DESKTOP"
314 "XDG_SESSION_TYPE" 341 "XDG_SESSION_TYPE"
315 ]; 342 ];
316 }; 343 };
317 344
318 # TODO: polkit gnome 345 # TODO: polkit gnome
319 346
@@ -325,10 +352,13 @@ _inputs: {
325 ]; 352 ];
326 353
327 programs.xwayland.enable = true; 354 programs.xwayland.enable = true;
328 security.pam.services.swaylock = {}; 355 security.pam.services.swaylock = { };
329 356
330 xdg.portal = { 357 xdg.portal = {
331 wlr.enable = true; 358 wlr.enable = true;
332 config.sway.default = ["wlr" "gtk"]; 359 config.sway.default = [
360 "wlr"
361 "gtk"
362 ];
333 }; 363 };
334} 364}