{ global = { pkgs, ... }: { programs = { wshowkeys.enable = true; sway.enable = true; dconf.enable = true; }; services.dbus.packages = with pkgs; [ dconf ]; xdg.portal = { enable = true; extraPortals = with pkgs; [ xdg-desktop-portal-wlr xdg-desktop-portal-gtk ]; }; }; home = { pkgs, lib, ... }: { xdg.configFile."sway/config".onChange = lib.mkForce ""; home = { sessionVariables = { MOZ_ENABLE_WAYLAND = "1"; MOZ_USE_XINPUT2 = "1"; SDL_VIDEODRIVER = "wayland"; QT_QPA_PLATFORM = "wayland"; QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; _JAVA_AWT_WM_NONREPARETING = "1"; XDG_SESSION_TYPE = "wayland"; XDG_CURRENT_DESKTOP = "sway"; }; file.".config/waybar" = { source = ./waybar; recursive = true; }; }; programs.waybar.enable = true; services.swayidle = let lockwall = pkgs.runCommand "lock_wall.jpg" { } '' ${pkgs.ffmpeg}/bin/ffmpeg -i ${./wall.jpg} -filter_complex 'gblur=sigma=3' $out -y ''; in { enable = true; timeouts = [ { timeout = 300; command = ''${pkgs.systemd}/bin/loginctl lock-session && ${pkgs.sway}/bin/swaymsg "output * dpms off"''; resumeCommand = ''${pkgs.sway}/bin/swaymsg "output * dpms on"''; } ]; events = [ { event = "before-sleep"; command = "${pkgs.systemd}/bin/loginctl lock-session"; } { event = "lock"; command = "${pkgs.swaylock}/bin/swaylock -f -i ${lockwall}"; } ]; }; wayland.windowManager.sway = { enable = true; xwayland = true; wrapperFeatures = { base = true; gtk = true; }; extraConfig = ''workspace 1''; config = let menuCmd = "${pkgs.wofi}/bin/wofi --show drun -i | xargs swaymsg exec --"; exitMd = ''Exit Mode:| (l)Log out | (r)Reboot | (p)Poweroff''; in rec { window = { border = 1; titlebar = false; }; gaps.smartBorders = "on"; modifier = "Mod4"; terminal = "alacritty"; input."type:keyboard".xkb_layout = "fr"; startup = [ # { command = "waybar -b bar-0"; } { command = "${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ on"; } { command = "${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ on"; } { command = "discord"; } { command = "thunderbird"; } { command = "mattermost-desktop"; } { command = "signal-desktop --"; } # { command = "${lib.getExe pkgs.element-desktop}"; } { command = ''sh -c "sleep 2 && exec keepassxc"''; } { command = "alacritty --class weechat --title weechat --command ${pkgs.weechat}/bin/weechat"; } ]; assigns = { "1" = [ { app_id = "firefox"; } ]; "9" = [ { app_id = "thunderbird"; } ]; "10" = [ { class = "Mattermost"; } { class = "Signal"; } { class = "discord"; } { class = "Element"; } { app_id = "weechat"; } ]; }; bars = [ { command = "waybar"; mode = "hide"; } ]; output."*".bg = "${./wall.jpg} fill"; seat."*"."hide_cursor" = "5000"; focus.wrapping = "yes"; colors = let # black = "#000000"; dark = "#111111"; adark = "#111111BB"; aadark = "#11111177"; # highl = "#222222"; gray = "#777777"; white = "#FFFFFF"; color = "#FFBB00"; urgent = "#FF0000"; in { focused = { border = adark; background = adark; text = white; indicator = color; childBorder = color; }; unfocused = { border = aadark; background = aadark; text = gray; indicator = dark; childBorder = dark; }; focusedInactive = { border = adark; background = adark; text = gray; indicator = dark; childBorder = dark; }; urgent = { border = urgent; background = urgent; text = white; indicator = urgent; childBorder = urgent; }; }; modes = { "display" = { "Left" = "output - transform 90"; "Down" = "output - transform normal"; "Up" = "output - transform 180"; "Right" = "output - transform 270"; "Shift+Left" = "output - transform flipped-90"; "Shift+Down" = "output - transform flipped"; "Shift+Up" = "output - transform flipped-180"; "Shift+Right" = "output - transform flipped-270"; "Escape" = ''mode default"''; }; "resize" = { "Left" = "resize shrink width 10px"; "Down" = "resize grow height 10px"; "Up" = "resize shrink height 10px"; "Right" = "resize grow width 10px"; "Escape" = ''mode default"''; }; "${exitMd}" = { "l" = "exec swaymsg exit"; "r" = "exec systemctl reboot"; "p" = "exec systemctl poweroff"; "Escape" = ''mode default"''; }; }; keybindings = { "${modifier}+Return" = "exec ${terminal}"; "${modifier}+q" = "kill"; "${modifier}+d" = "exec ${menuCmd}"; "${modifier}+Shift+f" = "exec firefox"; "${modifier}+Shift+v" = "exec virt-manager"; "${modifier}+Shift+c" = "reload"; "${modifier}+p" = ''exec ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp -d)" - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png''; "Print" = "exec ${pkgs.grim}/bin/grim - | ${pkgs.wl-clipboard}/bin/wl-copy -t image/png"; "${modifier}+x" = ''mode "display"''; "${modifier}+r" = ''mode "resize"''; "${modifier}+Shift+e" = ''mode "${exitMd}"''; "${modifier}+l" = "exec ${pkgs.systemd}/bin/loginctl lock-session"; "Ctrl+Shift+l" = ''exec ${pkgs.grim}/bin/grim /tmp/t_lock.png && ${pkgs.swaylock}/bin/swaylock -f -i /tmp/t_lock.png''; "${modifier}+Left" = "focus left"; "${modifier}+Down" = "focus down"; "${modifier}+Up" = "focus up"; "${modifier}+Right" = "focus right"; "${modifier}+ampersand" = "workspace 1"; "${modifier}+eacute" = "workspace 2"; "${modifier}+quotedbl" = "workspace 3"; "${modifier}+apostrophe" = "workspace 4"; "${modifier}+parenleft" = "workspace 5"; "${modifier}+minus" = "workspace 6"; "${modifier}+egrave" = "workspace 7"; "${modifier}+underscore" = "workspace 8"; "${modifier}+ccedilla" = "workspace 9"; "${modifier}+agrave" = "workspace 10"; "${modifier}+Shift+Left" = "move left"; "${modifier}+Shift+Down" = "move down"; "${modifier}+Shift+Up" = "move up"; "${modifier}+Shift+Right" = "move right"; "${modifier}+Shift+ampersand" = "move container to workspace 1"; "${modifier}+Shift+eacute" = "move container to workspace 2"; "${modifier}+Shift+quotedbl" = "move container to workspace 3"; "${modifier}+Shift+apostrophe" = "move container to workspace 4"; "${modifier}+Shift+parenleft" = "move container to workspace 5"; "${modifier}+Shift+minus" = "move container to workspace 6"; "${modifier}+Shift+egrave" = "move container to workspace 7"; "${modifier}+Shift+underscore" = "move container to workspace 8"; "${modifier}+Shift+ccedilla" = "move container to workspace 9"; "${modifier}+Shift+agrave" = "move container to workspace 10"; "${modifier}+b" = "splith"; "${modifier}+v" = "splitv"; "${modifier}+Shift+s" = "layout stacking"; "${modifier}+w" = "layout tabbed"; "${modifier}+s" = "layout toggle split"; "${modifier}+f" = "fullscreen"; "${modifier}+Shift+space" = "floating toggle"; "${modifier}+space" = "focus mode toggle"; "${modifier}+z" = "focus parent"; "${modifier}+Shift+z" = "focus child"; "${modifier}+Shift+F1" = "move scratchpad"; "${modifier}+F1" = "scratchpad show"; "XF86AudioRaiseVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"; "XF86AudioLowerVolume" = "exec ${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"; "XF86AudioMute" = "exec ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; "XF86AudioMicMute" = "exec ${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; "XF86MonBrightnessDown" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set 5%-"; "XF86MonBrightnessUp" = "exec ${pkgs.brightnessctl}/bin/brightnessctl set +5%"; }; }; }; }; }