-- Machine profile selection. -- -- Each profile owns the two things that genuinely differ between machines: -- the monitor layout and the workspace-to-monitor assignment. -- -- Selection order: -- 1. $HYPR_PROFILE, if set (e.g. `HYPR_PROFILE=laptop Hyprland`) -- 2. hostname match -- 3. fallback: "laptop" -- -- To add a machine: create configs/profiles/.lua and add it to `byHost`. local byHost = { mainPC = "pc", } local fallback = "laptop" local function hostname() -- Cheap file read at config-load time (not in a bind callback, so it is -- safe to block on). os.getenv("HOSTNAME") is not reliably exported. local f = io.open("/etc/hostname") if not f then return nil end local h = f:read("l") f:close() -- strip stray whitespace return h and h:match("^%s*(.-)%s*$") or nil end local host = hostname() local profile = os.getenv("HYPR_PROFILE") or byHost[host] or fallback require("configs.profiles." .. profile) return { name = profile, host = host }