tangled
alpha
login
or
join now
wiro.world
/
dotfiles
2
fork
atom
yep, more dotfiles
2
fork
atom
overview
issues
1
pulls
1
pipelines
sway: cleanup config
wiro.world
2 months ago
89a9c0c6
11f3ff66
verified
This commit was signed with the committer's
known signature
.
wiro.world
SSH Key Fingerprint:
SHA256:SmMcWpNAnL+VAgItSawvXgdPVn7f1rsyAuB/5VNclKY=
+87
-80
1 changed file
expand all
collapse all
unified
split
home-manager
fragments
sway.nix
+87
-80
home-manager/fragments/sway.nix
···
108
108
xwayland = true; # explicit, op is true by default
109
109
110
110
config = {
111
111
-
modifier = "Mod4"; # Super key
111
111
+
modifier = "Super";
112
112
terminal = config.home.sessionVariables.TERMINAL;
113
113
114
114
defaultWorkspace = "workspace number 1";
···
187
187
bindkeysToCode = true;
188
188
keybindings =
189
189
let
190
190
+
mod = cfg-sway.modifier;
191
191
+
190
192
pamixer = lib.getExe pkgs.pamixer;
191
193
playerctl = lib.getExe pkgs.playerctl;
194
194
+
loginctl = lib.getExe' pkgs.systemd "loginctl";
192
195
brightnessctl = lib.getExe pkgs.brightnessctl;
196
196
+
nautilus = lib.getExe pkgs.nautilus;
193
197
makoctl = lib.getExe' pkgs.mako "makoctl";
194
198
195
199
grim = lib.getExe pkgs.grim;
196
200
slurp = lib.getExe pkgs.slurp;
201
201
+
swappy = lib.getExe pkgs.swappy;
197
202
wl-copy = lib.getExe' pkgs.wl-clipboard "wl-copy";
198
203
wl-paste = lib.getExe' pkgs.wl-clipboard "wl-paste";
199
204
in
200
200
-
lib.foldl (acc: val: acc // val) { }
201
201
-
(map
202
202
-
(modifier: {
203
203
-
"${modifier}+Return" = "exec ${cfg-sway.terminal}";
204
204
-
"${modifier}+Shift+Return" = "exec ${lib.getExe' pkgs.nautilus "nautilus"}";
205
205
-
"${modifier}+Shift+q" = "kill";
206
206
-
"${modifier}+d" = "exec ${cfg-sway.menu}";
207
207
-
"${modifier}+Space" = "exec ${makoctl} dismiss";
205
205
+
{
206
206
+
"${mod}+Return" = "exec ${cfg-sway.terminal}";
207
207
+
"${mod}+Shift+Return" = "exec ${nautilus}";
208
208
+
"${mod}+Shift+q" = "kill";
209
209
+
"${mod}+d" = "exec ${cfg-sway.menu}";
210
210
+
"${mod}+Space" = "exec ${makoctl} dismiss";
208
211
209
209
-
"${modifier}+Escape" = "exec ${lib.getExe' pkgs.systemd "loginctl"} lock-session";
210
210
-
"${modifier}+Alt+Escape" = "exec ${pkgs.writeShellScript "lock-screenshot.sh" ''
211
211
-
tmpimg=$(${lib.getExe' pkgs.coreutils "mktemp"} /tmp/lock-bg.XXX)
212
212
+
"${mod}+Escape" = "exec ${loginctl} lock-session";
213
213
+
"${mod}+Alt+Escape" = "exec ${pkgs.writeShellScript "lock-screenshot.sh" ''
214
214
+
tmpimg=$(${lib.getExe' pkgs.coreutils "mktemp"} /tmp/lock-bg.XXX)
212
215
213
213
-
# Give some time to hide the bar
214
214
-
sleep 1
216
216
+
# Give some time to hide the bar
217
217
+
sleep 1
215
218
216
216
-
${grim} $tmpimg
217
217
-
${lib.getExe pkgs.swaylock} --image $tmpimg
219
219
+
${grim} $tmpimg
220
220
+
${lib.getExe pkgs.swaylock} --image $tmpimg
218
221
219
219
-
rm $tmpimg
220
220
-
''}";
222
222
+
rm $tmpimg
223
223
+
''}";
221
224
222
222
-
"${modifier}+t" = ''input "type:touch" events toggle'';
225
225
+
"${mod}+t" = ''input "type:touch" events toggle'';
223
226
224
224
-
"${modifier}+${cfg-sway.left}" = "focus left";
225
225
-
"${modifier}+${cfg-sway.down}" = "focus down";
226
226
-
"${modifier}+${cfg-sway.up}" = "focus up";
227
227
-
"${modifier}+${cfg-sway.right}" = "focus right";
227
227
+
"${mod}+${cfg-sway.left}" = "focus left";
228
228
+
"${mod}+${cfg-sway.down}" = "focus down";
229
229
+
"${mod}+${cfg-sway.up}" = "focus up";
230
230
+
"${mod}+${cfg-sway.right}" = "focus right";
228
231
229
229
-
"${modifier}+Shift+${cfg-sway.left}" = "move left";
230
230
-
"${modifier}+Shift+${cfg-sway.down}" = "move down";
231
231
-
"${modifier}+Shift+${cfg-sway.up}" = "move up";
232
232
-
"${modifier}+Shift+${cfg-sway.right}" = "move right";
233
233
-
"${modifier}+b" = "split vertical";
234
234
-
"${modifier}+n" = "split horizontal";
232
232
+
"${mod}+Shift+${cfg-sway.left}" = "move left";
233
233
+
"${mod}+Shift+${cfg-sway.down}" = "move down";
234
234
+
"${mod}+Shift+${cfg-sway.up}" = "move up";
235
235
+
"${mod}+Shift+${cfg-sway.right}" = "move right";
236
236
+
"${mod}+b" = "split vertical";
237
237
+
"${mod}+n" = "split horizontal";
235
238
236
236
-
"${modifier}+Alt+${cfg-sway.left}" = "resize shrink width 60 px";
237
237
-
"${modifier}+Alt+${cfg-sway.down}" = "resize grow height 60 px";
238
238
-
"${modifier}+Alt+${cfg-sway.up}" = "resize shrink height 60 px";
239
239
-
"${modifier}+Alt+${cfg-sway.right}" = "resize grow width 60 px";
240
240
-
"${modifier}+f" = "fullscreen toggle";
241
241
-
"${modifier}+Shift+space" = "floating toggle";
242
242
-
# Change between tiling and floating focus
243
243
-
"${modifier}+Alt+space" = "focus mode_toggle";
244
244
-
"${modifier}+Alt+c" = "move position cursor";
245
245
-
"${modifier}+p" = "sticky toggle";
239
239
+
"${mod}+Alt+${cfg-sway.left}" = "resize shrink width 60 px";
240
240
+
"${mod}+Alt+${cfg-sway.down}" = "resize grow height 60 px";
241
241
+
"${mod}+Alt+${cfg-sway.up}" = "resize shrink height 60 px";
242
242
+
"${mod}+Alt+${cfg-sway.right}" = "resize grow width 60 px";
243
243
+
"${mod}+f" = "fullscreen toggle";
244
244
+
"${mod}+Shift+space" = "floating toggle";
245
245
+
# Change between tiling and floating focus
246
246
+
"${mod}+Alt+space" = "focus mode_toggle";
247
247
+
"${mod}+Alt+c" = "move position cursor";
248
248
+
"${mod}+p" = "sticky toggle";
246
249
247
247
-
# Screenshotting
248
248
-
"${modifier}+s" = ''exec ${grim} -g "$(${slurp})" - | ${wl-copy}'';
249
249
-
"${modifier}+Shift+s" = "exec ${wl-paste} | ${lib.getExe pkgs.swappy} --file - --output-file - | ${wl-copy}";
250
250
+
# Screenshotting
251
251
+
"${mod}+s" = ''exec ${grim} -g "$(${slurp})" - | ${wl-copy}'';
252
252
+
"${mod}+Shift+s" = "exec ${wl-paste} | ${swappy} --file - --output-file - | ${wl-copy}";
250
253
251
251
-
# Soundcontrol Keys
252
252
-
"--locked XF86AudioPrev" = "exec ${playerctl} previous";
253
253
-
"--locked XF86AudioNext" = "exec ${playerctl} next";
254
254
-
"--locked XF86AudioPlay" = "exec ${playerctl} play-pause";
255
255
-
"--locked XF86AudioStop" = "exec ${playerctl} stop";
256
256
-
"--locked XF86AudioRaiseVolume" = "exec ${pamixer} --unmute --increase 5";
257
257
-
"--locked XF86AudioLowerVolume" = "exec ${pamixer} --unmute --decrease 5";
258
258
-
"--locked XF86AudioMute" = "exec ${pamixer} --toggle-mute";
259
259
-
"--locked XF86AudioMicMute" = "exec ${pamixer} --default-source --toggle-mute";
260
260
-
"--locked XF86MonBrightnessUp" = "exec ${brightnessctl} --exponent set 5%+";
261
261
-
"--locked XF86MonBrightnessDown" = "exec ${brightnessctl} --exponent set 5%- --min-value=1";
262
262
-
"--locked XF86TouchpadToggle" = ''input "type:touchpad" events toggle enabled disabled_on_external_mouse'';
263
263
-
}
264
264
-
// lib.listToAttrs (lib.flatten (map
265
265
-
({ key-idx, workspace-idx }: [
266
266
-
{ name = "${modifier}+${toString key-idx}"; value = "workspace number ${toString workspace-idx}"; }
267
267
-
{ name = "${modifier}+Alt+${toString key-idx}"; value = "move container to workspace number ${toString workspace-idx}"; }
268
268
-
{ name = "${modifier}+Shift+${toString key-idx}"; value = "move container to workspace number ${toString workspace-idx}; workspace number ${toString workspace-idx}"; }
269
269
-
])
270
270
-
workspacesRange))
271
271
-
) [ cfg-sway.modifier ]);
254
254
+
# Soundcontrol Keys
255
255
+
"--locked XF86AudioPrev" = "exec ${playerctl} previous";
256
256
+
"--locked XF86AudioNext" = "exec ${playerctl} next";
257
257
+
"--locked XF86AudioPlay" = "exec ${playerctl} play-pause";
258
258
+
"--locked XF86AudioStop" = "exec ${playerctl} stop";
259
259
+
"--locked XF86AudioRaiseVolume" = "exec ${pamixer} --unmute --increase 5";
260
260
+
"--locked XF86AudioLowerVolume" = "exec ${pamixer} --unmute --decrease 5";
261
261
+
"--locked XF86AudioMute" = "exec ${pamixer} --toggle-mute";
262
262
+
"--locked XF86AudioMicMute" = "exec ${pamixer} --default-source --toggle-mute";
263
263
+
"--locked XF86MonBrightnessUp" = "exec ${brightnessctl} --exponent set 5%+";
264
264
+
"--locked XF86MonBrightnessDown" = "exec ${brightnessctl} --exponent set 5%- --min-value=1";
265
265
+
"--locked XF86TouchpadToggle" = ''input "type:touchpad" events toggle enabled disabled_on_external_mouse'';
266
266
+
}
267
267
+
// lib.listToAttrs (lib.flatten (map
268
268
+
({ key-idx, workspace-idx }: [
269
269
+
{ name = "${mod}+${toString key-idx}"; value = "workspace number ${toString workspace-idx}"; }
270
270
+
{ name = "${mod}+Alt+${toString key-idx}"; value = "move container to workspace number ${toString workspace-idx}"; }
271
271
+
{ name = "${mod}+Shift+${toString key-idx}"; value = "move container to workspace number ${toString workspace-idx}; workspace number ${toString workspace-idx}"; }
272
272
+
])
273
273
+
workspacesRange));
272
274
};
273
275
};
274
276
···
276
278
277
279
services.poweralertd.enable = true;
278
280
279
279
-
services.darkman = {
280
280
-
enable = true;
281
281
-
settings.usegeoclue = true;
281
281
+
services.darkman =
282
282
+
let
283
283
+
dconf = lib.getExe pkgs.dconf;
284
284
+
brightnessctl = lib.getExe pkgs.brightnessctl;
285
285
+
in
286
286
+
{
287
287
+
enable = true;
288
288
+
settings.usegeoclue = true;
282
289
283
283
-
darkModeScripts.gtk-theme = ''
284
284
-
# Change system theme scheme to dark
285
285
-
${lib.getExe pkgs.dconf} write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"
290
290
+
darkModeScripts.gtk-theme = ''
291
291
+
# Change system theme scheme to dark
292
292
+
${dconf} write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"
286
293
287
287
-
# Do not change brightness as I'm usually on my computer as this time
288
288
-
'';
294
294
+
# Do not change brightness as I'm usually on my computer as this time
295
295
+
'';
289
296
290
290
-
lightModeScripts.gtk-theme = ''
291
291
-
# Change system theme scheme to light
292
292
-
${lib.getExe pkgs.dconf} write /org/gnome/desktop/interface/color-scheme "'prefer-light'"
297
297
+
lightModeScripts.gtk-theme = ''
298
298
+
# Change system theme scheme to light
299
299
+
${dconf} write /org/gnome/desktop/interface/color-scheme "'prefer-light'"
293
300
294
294
-
# TODO: change config specialization
301
301
+
# TODO: change config specialization
295
302
296
296
-
# Prepare laptop for wake: set full brightness and disable kbd backlight
297
297
-
${lib.getExe pkgs.brightnessctl} --class backlight set 100%
298
298
-
${lib.getExe pkgs.brightnessctl} --class leds --device "*::kbd_backlight" set 0%
299
299
-
'';
300
300
-
};
303
303
+
# Prepare laptop for wake: set full brightness and disable kbd backlight
304
304
+
${brightnessctl} --class backlight set 100%
305
305
+
${brightnessctl} --class leds --device "*::kbd_backlight" set 0%
306
306
+
'';
307
307
+
};
301
308
302
309
services.gammastep = {
303
310
enable = true;