{ lib, config, pkgs, ... }: let inherit (lib) mkIf mkEnableOption; cfg = config.horseman.wm.hyprland; homeCfg = config.horseman; in { imports = [ ./options.nix ./keybindings.nix ./animations.nix ]; options = { horseman.wm.hyprland.enable = mkEnableOption "Hyprland"; }; config = mkIf cfg.enable { programs.hyprland = { enable = true; xwayland.enable = true; }; security.polkit.enable = true; environment.systemPackages = with pkgs; [ brightnessctl eww fortune hypridle hyprlock hyprpaper hyprpolkitagent hyprshot jq networkmanagerapplet playerctl pulsemixer python312Packages.gpustat swaynotificationcenter wirelesstools wl-clipboard wofi xdg-desktop-portal-hyprland ]; horseman.wm.hyprland.config = { execOnce = [ "hyprpaper" "eww daemon" "hypridle" "hyprpaper" "swaync" "systemctl --user start hyprpolkitagent" "waybar" ]; env = [ "XCURSOR_SIZE,24" "HYPRCURSOR_SIZE,24" ]; windowrules = [ "suppressevent maximize, class:.*" "nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0" "rounding 0, floating:0 onworkspace:w[tv1]" "bordersize 0, floating:0 onworkspace:w[tv1]" "float, initialTitle:^Picture-in-Picture$" "center, initialTitle:^Picture-in-Picture$" "size 33% 33%, initialTitle:^Picture-in-Picture$" "float, initialClass:CImg" "float, initialTitle:GLFW" ]; workspaces = [ "w[tv1], gapsout:0, gapsin:0" ]; general = { gapsIn = 5; gapsOut = 5; borderSize = 2; resizeOnBorder = true; allowTearing = false; col.activeBorder = "rgba(b7bdf8ff)"; col.inactiveBorder = "rgba(b7bdf840)"; layout = "dwindle"; }; decoration = { rounding = 10; activeOpacity = 1.0; inactiveOpacity = 1.0; shadow = { enabled = true; range = 4; renderPower = 3; color = "rgba(1a1a1aee)"; }; blur = { enabled = true; size = 3; passes = 3; vibrancy = 0.1696; }; }; dwindle = { pseudotile = true; preserveSplit = true; }; master = { newStatus = "master"; }; misc = { forceDefaultWallpaper = 0; keyPressEnablesDPMS = true; newWindowTakesOverFullscreen = 2; enableSwallow = true; swallowRegex = "^kitty$"; }; input = { kbLayout = "us"; repeatRate = 50; repeatDelay = 300; followMouse = 1; sensitivity = 0.0; touchpad.naturalScroll = true; numlockByDefault = true; touchpad.dragLock = true; }; gestures = { workspaceSwipe = false; }; group = { autoGroup = false; dragIntoGroup = 1; col = { borderActive = config.horseman.wm.hyprland.config.general.col.activeBorder; # I don't wanna believe this can't be done better :( borderInactive = config.horseman.wm.hyprland.config.general.col.inactiveBorder; borderLockedActive = config.horseman.wm.hyprland.config.general.col.activeBorder; borderLockedInactive = config.horseman.wm.hyprland.config.general.col.inactiveBorder; }; groupbar = { fontSize = 14; height = 26; keepUpperGap = true; }; }; binds = { workspaceCenterOn = 1; dragThreshold = 0; }; ecosystem = { noDonationNag = true; }; monitors = { defaultMonitor = true; }; sleep = { lockCommand = "pidof hyprlock || hyprlock"; listeners = [ { timeout = 300; onTimeout = "hyprctl dispatch dpms off"; onResume = "hyprctl dispatch dpms on"; } { timeout = 310; onTimeout = "loginctl lock-session"; } ]; }; waybar = { formats = { horizontal = { "clock" = { format = "󰥔 {:%H:%M:%S}"; format-alt = "{:%a %d %b %Y}"; }; }; vertical = { "clock" = { format = "{:%H\n%M\n%S}"; format-alt = "{:%d\n%m\n%y}"; }; }; }; modules = { "clock" = { interval = 1; tooltip = false; }; "cpu" = { interval = 3; format = " {usage}%"; on-click = "kitty btop &"; }; "memory" = { interval = 3; format = " {percentage}%"; on-click = "kitty btop &"; }; "pulseaudio" = { format = " {volume}"; on-click = "kitty pulsemixer &"; }; "network" = { interval = 3; format = "{ipaddr}"; format-ethernet = " {ipaddr}"; format-disconnected = "󰣽 Disconnected"; format-wifi = "󰤨 {essid}"; tooltip = false; }; "battery" = { interval = 3; # TODO This needs to be fixed }; "hyprland/workspaces" = { format = "{icon}"; format-icons = { "active" = ""; "default" = ""; "empty" = ""; }; persistent-workspaces = { "*" = [1 2 3 4 5 6 7 8 9 10]; }; }; "group/power" = { orientation = "horizontal"; drawer = { }; modules = [ "custom/power" "custom/reboot" "custom/lock" "idle_inhibitor" ]; }; "custom/lock" = { format = "󰍁 "; tooltip = false; on-click = "hyprlock"; }; "custom/reboot" = { format = "󰜉 "; tooltip = false; on-click = "reboot"; }; "custom/power" = { format = " "; tooltip = false; on-click = "shutdown now"; }; "idle_inhibitor" = { tooltip = false; format = "{icon}"; format-icons = { deactivated = "󰒲 "; activated = "󰒳 "; }; }; }; }; }; services.logind.extraConfig = '' HandlePowerKey=ignore ''; }; }