yep, more dotfiles

sway: cleanup config

wiro.world 89a9c0c6 11f3ff66

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