From 6365e1d1222ad98c444efabd4188debfcecac838 Mon Sep 17 00:00:00 2001 From: Jeena Date: Mon, 24 Aug 2026 09:57:32 +0900 Subject: [PATCH] refactor(hosts): never load example.lua; make it a pure template hyprland.lua now just uses its defaults when no hosts/.lua matches, instead of requiring hosts/example.lua. example.lua is kept only as a documented template for contributors. --- hypr/hosts/example.lua | 13 ++++++++----- hypr/hyprland.lua | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/hypr/hosts/example.lua b/hypr/hosts/example.lua index a5c4503..55456f9 100644 --- a/hypr/hosts/example.lua +++ b/hypr/hosts/example.lua @@ -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 --- hosts/.lua file. Keep this file empty (or add shared defaults). --- Create a file named after your host, e.g. hosts/MyHost.lua, to override --- host-specific settings. +-- Hyprland's Lua config only loads hosts/.lua matching the current +-- machine's hostname. If none matches, hyprland.lua simply uses its defaults. +-- This file is never required; it exists purely as a documented template. +-- +-- To add your own machine, copy this to hosts/.lua and fill it +-- in. The hostname lookup strips any domain suffix (e.g. "laptop.home" -> "laptop"). + return {} diff --git a/hypr/hyprland.lua b/hypr/hyprland.lua index 20a50d6..2fd3761 100644 --- a/hypr/hyprland.lua +++ b/hypr/hyprland.lua @@ -280,5 +280,6 @@ local hostname = (io.popen("hostname") or {}):read("*l") or "" hostname = hostname:gsub("%..*$", "") -- strip domain suffix local ok, err = pcall(require, "hosts." .. hostname) 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