{ config, pkgs, lib, ... }: let wallpaperScript = pkgs.writeShellScriptBin "random-wallpaper" '' pkill -f swaybg 2>/dev/null || true walp=$(find "$HOME/wallpapers" -type f \( -iname "*.jpg" -o -iname "*.png" \) | shuf -n 1) [ -n "$walp" ] && ${pkgs.swaybg}/bin/swaybg -m "fill" -i "$walp" & ''; in { home.packages = [wallpaperScript]; wayland.windowManager.sway = { enable = true; xwayland = true; config = rec { # vars modifier = "Mod4"; terminal = "foot"; menu = "exec $(tofi-run)"; # outputs output."*" = { resolution = "1920x1080"; scale = "1"; }; # startup startup = [ {command = "${wallpaperScript}/bin/random-wallpaper";} ]; # input input."type:keyboard" = { xkb_layout = "es,ru"; xkb_options = "grp:alt_space_toggle"; xkb_numlock = "enabled"; }; # gaps gaps = { inner = 3; outer = 3; }; # borders window.border = 0; floating.border = 0; # focus focus.followMouse = true; # keybindings keybindings = lib.mkOptionDefault { # screenshots "${modifier}+Shift+Print" = "exec ~/bin/sss screen"; "${modifier}+Print" = "exec ~/bin/sss area"; # launchers "${modifier}+space" = "exec ${menu}"; "${modifier}+w" = "exec ${wallpaperScript}/bin/random-wallpaper"; "${modifier}+t" = "exec ${terminal}"; "${modifier}+z" = "exec firefox"; "${modifier}+r" = "exec st"; # window "${modifier}+q" = "kill"; "${modifier}+v" = "floating toggle"; "${modifier}+s" = "sticky toggle"; # focus move "${modifier}+Left" = "focus left"; "${modifier}+Right" = "focus right"; "${modifier}+Up" = "focus up"; "${modifier}+Down" = "focus down"; # workspaces "${modifier}+1" = "workspace number 1"; "${modifier}+2" = "workspace number 2"; "${modifier}+3" = "workspace number 3"; "${modifier}+4" = "workspace number 4"; "${modifier}+5" = "workspace number 5"; "${modifier}+6" = "workspace number 6"; "${modifier}+7" = "workspace number 7"; "${modifier}+8" = "workspace number 8"; "${modifier}+9" = "workspace number 9"; "${modifier}+0" = "workspace number 10"; # move to workspace "${modifier}+Shift+1" = "move container to workspace number 1"; "${modifier}+Shift+2" = "move container to workspace number 2"; "${modifier}+Shift+3" = "move container to workspace number 3"; "${modifier}+Shift+4" = "move container to workspace number 4"; "${modifier}+Shift+5" = "move container to workspace number 5"; "${modifier}+Shift+6" = "move container to workspace number 6"; "${modifier}+Shift+7" = "move container to workspace number 7"; "${modifier}+Shift+8" = "move container to workspace number 8"; "${modifier}+Shift+9" = "move container to workspace number 9"; "${modifier}+Shift+0" = "move container to workspace number 10"; }; # resize mode modes.resize = { Left = "resize shrink width 10 px"; Right = "resize grow width 10 px"; Up = "resize shrink height 10 px"; Down = "resize grow height 10 px"; Escape = "mode default"; Return = "mode default"; }; bars = []; }; extraConfig = '' set $opacity 0.99 for_window [class=".*"] opacity $opacity for_window [app_id=".*"] opacity $opacity # borders default_border pixel 0 default_floating_border pixel 0 # colors client.focused #3a3a3a #000000 #ffffff #3a3a3a #3a3a3a client.focused_inactive #2a2a2a #000000 #bbbbbb #2a2a2a #2a2a2a client.unfocused #1e1e1e #000000 #888888 #1e1e1e #1e1e1e client.urgent #5a5a5a #000000 #ffffff #5a5a5a #5a5a5a client.placeholder #1e1e1e #000000 #888888 #1e1e1e #1e1e1e # mouse floating_modifier ${config.wayland.windowManager.sway.config.modifier} normal # cursor seat seat0 xcursor_theme macOS 24 ''; }; # env home.sessionVariables = { XCURSOR_THEME = "macOS"; XCURSOR_SIZE = "24"; XDG_CURRENT_DESKTOP = "sway"; }; }