{ config, lib, pkgs, inputs, ... }: let nathan = config.nathan; in with lib; { config = mkIf nathan.programs.swaywm.enable (let swaylock-package = inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.swaylock-effects; swaylock-command = '' ${swaylock-package}/bin/swaylock --screenshots --grace 30 --indicator --clock --timestr "%-I:%M:%S %p" --datestr "%A %Y-%M-%d" --effect-blur 20x3''; fuzzel-command = '' fuzzel -f "Iosevka Sans Quasi" -b "181818dd" -S "b9b9b9ff" -s "252525dd" -t "777777ff" -B 5 -r 5 -C "70b433dd"''; notif-package = inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.swaynotificationcenter; in { home.packages = with pkgs; [ # Locking and display management wdisplays swaylock-package swayidle # Clipboard wl-clipboard cliphist # Notifications notif-package # Terminal alacritty # glib for sound stuff glib # Glpaper for the background (glpaper.overrideAttrs (old: { src = fetchFromSourcehut { owner = "~scoopta"; repo = "glpaper"; vc = "hg"; rev = "14c158c495451bd9dbdc31a8dfc97388db5e7279"; hash = "sha256-jYOUmyXwTffzwUmYEY1SQx2ClZiRiMZLanveE9zWOLI="; }; })) # Screenshots (inputs.hyprland-contrib.packages.${pkgs.system}.grimblast.override { hyprland = config.wayland.windowManager.hyprland.package; }) # fuzzel for launcher fuzzel # for image viewing inputs.self.packages.${pkgs.system}.swayimg # For private browsing tor-browser-bundle-bin # For non-emacs pdf reading evince # Productivity libreoffice-fresh ## Sway addons font-awesome inputs.nixpkgs-unstable.legacyPackages.${pkgs.system}.hyprpaper swayosd # For fancy x11 scaling sommelier # Polkit libsForQt5.polkit-kde-agent polkit_gnome ]; ######################### ## Hyprland ######################### # Enable and configure hyperland wayland.windowManager.hyprland = { enable = true; xwayland = { enable = true; hidpi = false; }; recommendedEnvironment = true; systemdIntegration = false; extraConfig = builtins.readFile ../../../configs/hyprland.conf; }; # systemd session target # Specified manually so we can work around an issue with the loading systemd.user.targets.hyprland-session = { Unit = { Description = "Hyprland compositor session"; Documentation = [ "man:systemd.special(7)" ]; BindsTo = [ "graphical-session.target" ]; Wants = [ "graphical-session-pre.target" ]; After = [ "graphical-session-pre.target" ]; }; }; ######################### ## Hyprland Addons ######################### # Setup polkit as a service systemd.user.services.polkit-gnome = { Unit = { Description = "Polkit gnome authentication agent"; After = [ "graphical-session.target" ]; }; Service = { Type = "simple"; ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"; Restart = "on-failure"; }; Install = { WantedBy = [ "graphical-session.target" ]; }; }; # Setup swayosd as a service systemd.user.services.swayosd = { Unit = { Description = "Swayosd"; After = [ "graphical-session.target" ]; }; Service = { Type = "simple"; ExecStart = "${pkgs.swayosd}/bin/swayosd"; Restart = "on-failure"; }; Install = { WantedBy = [ "graphical-session.target" ]; }; }; ######################### ## SwayNotificationCenter (notifications) ######################### systemd.user.services.swaync = { Unit = { Description = "SwayNotificationCenter"; After = [ "graphical-session.target" ]; }; Service = { Type = "simple"; ExecStart = "${notif-package}/bin/swaync"; Restart = "on-failure"; }; Install = { WantedBy = [ "graphical-session.target" ]; }; }; ######################### ## Swayidle ######################### services.swayidle = { enable = true; timeouts = [ # Lock the screen after 5 minutes of inactivity { timeout = 300; command = builtins.replaceStrings [ "%" ] [ "%%" ] swaylock-command; } # Turn off the displays after 10 minutes of inactivity { timeout = 600; command = ''swaymsg "output * dpms off"''; resumeCommand = ''swaymsg "output * dpms on"''; } ]; }; systemd.user.services.swayidle = { Install = { WantedBy = [ "hyprland-session.target" ]; }; }; ######################### ## Waybar ######################### # https://github.com/DN-debug/waybar-examples/tree/main/waybar-examples/sway programs.waybar = { enable = true; package = inputs.nixpkgs-unstable.legacyPackages."${pkgs.system}".waybar.overrideAttrs (old: { mesonFlags = old.mesonFlags ++ [ "-Dexperimental=true" ]; }); systemd = { enable = false; }; settings = { mainBar = { layer = "top"; position = "top"; height = 30; spacing = 4; margin-top = 5; margin-bottom = 0; # modules-left = [ "wlr/workspaces" "hyprland/submap" ]; # modules-center = [ "hyprland/window" ]; # modules-right = [ "mpd" "clock" "tray" ]; modules-center = [ "custom/launcher" "wlr/workspaces" "mpd" # "hyprland/window" "idle_inhibitor" "pulseaudio" "network" "cpu" "memory" # "temperature" "tray" "clock" # "custom/power" ]; "custom/launcher" = { format = " "; on-click = fuzzel-command; on-click-right = "killall fuzzel"; }; "idle_inhibitor" = { format = "{icon}"; format-icons = { activated = ""; deactivated = ""; }; }; pulseaudio = { scroll-step = 1; format = "{volume}% {icon}"; format-bluetooth = "{volume}% {icon}"; format-bluetooth-muted = "{icon} {format_source}"; format-muted = "{format_source}"; format-source = ""; format-source-muted = ""; format-icons = { headphone = ""; hands-free = ""; headset = ""; phone = ""; portable = ""; car = ""; default = [ "" "" "" ]; }; on-click = "pavucontrol"; }; network = { # // "interface": "wlp2*", // (Optional) To force the use of this interface format-wifi = "{essid} ({signalStrength}%) "; format-ethernet = "Connected  "; tooltip-format = "{ifname} via {gwaddr} "; format-linked = "{ifname} (No IP) "; format-disconnected = "Disconnected ⚠"; format-alt = "{ifname}: {ipaddr}/{cidr}"; on-click-right = "bash ~/.config/rofi/wifi_menu/rofi_wifi_menu"; }; cpu = { format = "{usage}% "; tooltip = false; }; memory = { format = "{}% ({used}GB/{total}GB) "; }; "tray" = { icon-size = 20; spacing = 10; }; "clock" = { format = "{:%I:%M%p %Y-%m-%d}"; }; "mpd" = { format = "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S})"; format-disconnected = "Disconnected ❌"; format-stopped = "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ⏸"; consume-icons = { on = "🍴"; }; random-icons = { on = "🔀"; }; repeat-icons = { on = "🔁"; }; state-icons = { paused = "⏸"; playing = "▶"; }; }; }; }; style = builtins.readFile ../../../configs/waybar.css; }; # Override the service to run during graphical-session-pre.target systemd.user.services.waybar = { Unit = { Description = "Highly customizable Wayland bar for Sway and Wlroots based compositors."; Documentation = "https://github.com/Alexays/Waybar/wiki"; Before = [ "tray.target" ]; }; Service = { ExecStart = "${config.programs.waybar.package}/bin/waybar"; ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID"; ExecStartPost = "${pkgs.coreutils}/bin/sleep 1"; Restart = "on-failure"; KillMode = "mixed"; }; Install = { WantedBy = [ "graphical-session-pre.target" ]; }; }; ######################### ## EasyEffects ######################### services.easyeffects.enable = true; ######################### ## Create tray target to fix some things ######################### systemd.user.targets.tray = { Unit = { Description = "Home Manager System Tray"; Requires = [ "graphical-session-pre.target" "waybar.service" ]; After = [ "waybar.service" ]; }; }; ######################### ## Default applications ######################### xdg.mimeApps.defaultApplications = { # Make all supported images open in swayimg "image/jpeg" = [ "swayimg.desktop" ]; "image/png" = [ "swayimg.desktop" ]; "image/gif" = [ "swayimg.desktop" ]; "image/svg+xml" = [ "swayimg.desktop" ]; "image/webp" = [ "swayimg.desktop" ]; "image/avif" = [ "swayimg.desktop" ]; "image/tiff" = [ "swayimg.desktop" ]; "image/bmp" = [ "swayimg.desktop" ]; "application/pdf" = [ "org.gnome.Evince.desktop" ]; "text/html" = [ "firefox.desktop" ]; }; }); }