refactor(hosts): never load example.lua; make it a pure template

hyprland.lua now just uses its defaults when no hosts/<hostname>.lua
matches, instead of requiring hosts/example.lua. example.lua is kept only
as a documented template for contributors.
This commit is contained in:
Jeena 2026-08-24 09:57:32 +09:00
parent 70807f473a
commit 6365e1d122
2 changed files with 10 additions and 6 deletions

View file

@ -1,7 +1,10 @@
-- example.lua - no-op host fallback (mirrors example.conf) -- example.lua — TEMPLATE for a per-host config file (NOT loaded at runtime).
-- --
-- Used by hyprland.lua when the machine's hostname does not match any -- Hyprland's Lua config only loads hosts/<hostname>.lua matching the current
-- hosts/<hostname>.lua file. Keep this file empty (or add shared defaults). -- machine's hostname. If none matches, hyprland.lua simply uses its defaults.
-- Create a file named after your host, e.g. hosts/MyHost.lua, to override -- This file is never required; it exists purely as a documented template.
-- host-specific settings. --
-- To add your own machine, copy this to hosts/<your-hostname>.lua and fill it
-- in. The hostname lookup strips any domain suffix (e.g. "laptop.home" -> "laptop").
return {} return {}

View file

@ -280,5 +280,6 @@ local hostname = (io.popen("hostname") or {}):read("*l") or ""
hostname = hostname:gsub("%..*$", "") -- strip domain suffix hostname = hostname:gsub("%..*$", "") -- strip domain suffix
local ok, err = pcall(require, "hosts." .. hostname) local ok, err = pcall(require, "hosts." .. hostname)
if not ok then if not ok then
require("hosts.example") -- No host file matches this machine; use the defaults already set above.
-- See hosts/example.lua for a template on adding your own host.
end end