{ lib, config, ... }: let inherit (lib) mkOption types mkIf recursiveUpdate lists; inherit (lists) remove; # v0.49.0 # Parsing regex: /SConfigOptionDescription{\n? *\.value *= "(.*)",\n *\.description = ?\n? *"([\d\D]*?)",\n *\.type *= CONFIG_OPTION_(.*),\n *.data *= (.*),\n *},/gm cfg = config.horseman.wm.hyprland; homeCfg = config.horseman; keybinding = types.submodule { options = { flags = mkOption { type = types.listOf (types.enum ["l" "r" "c" "g" "o" "e" "m" "t" "i" "s" "d" "p"]); }; mods = mkOption { type = types.listOf types.str; }; key = mkOption { type = types.str; }; dispatcher = mkOption { type = types.str; }; params = mkOption { type = types.str; }; }; }; submapKeybinding = types.submodule { options = { flags = mkOption { type = types.listOf (types.enum ["l" "r" "c" "g" "o" "e" "m" "t" "i" "s" "d" "p"]); }; mods = mkOption { type = types.listOf types.str; }; key = mkOption { type = types.str; }; }; }; vec2 = types.submodule { options = { x = mkOption {type = types.int;}; y = mkOption {type = types.int;}; }; }; fontWeight = types.enum ["thin" "ultralight" "light" "semilight" "book" "normal" "medium" "semibold" "bold" "ultrabold" "heavy" "ultraheavy"]; in { options.horseman.wm.hyprland.config = { execOnce = mkOption { type = types.listOf types.str; default = []; }; env = mkOption { type = types.listOf types.str; default = []; }; windowrules = mkOption { type = types.listOf types.str; default = []; }; workspaces = mkOption { type = types.listOf types.str; default = []; }; animations = { beziers = mkOption { type = types.listOf (types.submodule { options = { name = mkOption {type = types.str;}; startX = mkOption {type = types.number;}; startY = mkOption {type = types.number;}; endX = mkOption {type = types.number;}; endY = mkOption {type = types.number;}; }; }); }; animations = mkOption { type = types.listOf (types.submodule { options = { name = mkOption {type = types.str;}; on = mkOption {type = types.bool;}; speed = mkOption { type = types.number; default = 0; }; curve = mkOption { type = types.str; default = ""; }; style = mkOption { type = types.str; default = ""; }; }; }); }; }; dwindle = { pseudotile = mkOption {type = types.bool;}; preserveSplit = mkOption {type = types.bool;}; }; master = { newStatus = mkOption {type = types.enum ["master" "slave" "inherit"];}; }; monitors = { defaultMonitor = mkOption {type = types.bool;}; bindWorkspaces = mkOption { type = types.enum ["no" "interlaced"]; default = "no"; }; displays = mkOption { type = types.listOf (types.submodule { options = { output = mkOption {type = types.str;}; resolution = mkOption { type = types.str; default = "highres"; }; refreshRate = mkOption { type = types.str; default = "highrr"; }; x = mkOption {type = types.int;}; y = mkOption {type = types.int;}; scale = mkOption { type = types.number; default = 1; }; transform = mkOption { type = types.enum [0 1 2 3 4 5 6 7]; default = 0; }; wallpaper = mkOption { type = types.nullOr types.path; default = null; }; bar = mkOption { type = types.enum ["" "left" "right" "top" "bottom"]; default = ""; }; }; }); }; }; keybindings = { binds = mkOption {type = types.listOf keybinding;}; submaps = mkOption { type = types.listOf (types.submodule { options = { name = mkOption {type = types.str;}; enterBind = mkOption {type = submapKeybinding;}; exitBind = mkOption {type = submapKeybinding;}; binds = mkOption {type = types.listOf keybinding;}; }; }); }; }; sleep = { lockCommand = mkOption {type = types.str;}; listeners = mkOption { type = types.listOf (types.submodule { options = { timeout = mkOption {type = types.ints.positive;}; onTimeout = mkOption {type = types.str;}; onResume = mkOption { type = types.str; default = ""; }; ignoreInhibit = mkOption { type = types.bool; default = false; }; }; }); }; }; waybar = { layout = { horizontal = { left = mkOption {type = types.listOf types.str;}; center = mkOption {type = types.listOf types.str;}; right = mkOption {type = types.listOf types.str;}; }; vertical = { left = mkOption {type = types.listOf types.str;}; center = mkOption {type = types.listOf types.str;}; right = mkOption {type = types.listOf types.str;}; }; }; formats = { horizontal = mkOption { type = types.attrs; }; vertical = mkOption { type = types.attrs; }; }; modules = mkOption { type = types.attrs; }; }; }; config = mkIf cfg.enable { horseman.dots = { fuzzel.enable = true; waybar.enable = true; hypr = { hyprland.enable = true; hypridle.enable = true; hyprpaper.enable = true; hyprlock.enable = true; }; }; home-manager.users.${homeCfg.username} = { programs.waybar = { enable = true; settings = let outputMap = location: ( remove null ( map (disp: if (disp.bar == location) then disp.output else null) cfg.config.monitors.displays ) ); in { topBar = recursiveUpdate { layer = "top"; position = "top"; output = outputMap "top"; modules-left = cfg.config.waybar.layout.horizontal.left; modules-center = cfg.config.waybar.layout.horizontal.center; modules-right = cfg.config.waybar.layout.horizontal.right; } (recursiveUpdate cfg.config.waybar.modules cfg.config.waybar.formats.horizontal); bottomBar = recursiveUpdate { layer = "top"; position = "bottom"; output = outputMap "bottom"; modules-left = cfg.config.waybar.layout.horizontal.left; modules-center = cfg.config.waybar.layout.horizontal.center; modules-right = cfg.config.waybar.layout.horizontal.right; } (recursiveUpdate cfg.config.waybar.modules cfg.config.waybar.formats.horizontal); rightBar = recursiveUpdate { layer = "top"; position = "right"; output = outputMap "right"; modules-left = cfg.config.waybar.layout.vertical.left; modules-center = cfg.config.waybar.layout.vertical.center; modules-right = cfg.config.waybar.layout.vertical.right; } (recursiveUpdate cfg.config.waybar.modules cfg.config.waybar.formats.vertical); leftBar = recursiveUpdate { layer = "top"; position = "left"; output = outputMap "left"; modules-left = cfg.config.waybar.layout.vertical.left; modules-center = cfg.config.waybar.layout.vertical.center; modules-right = cfg.config.waybar.layout.vertical.right; } (recursiveUpdate cfg.config.waybar.modules cfg.config.waybar.formats.vertical); }; }; }; }; }