added comments for casual readers

This commit is contained in:
2026-11-08 17:23:28 +00:00
parent f8d74267a4
commit bab2ee0199
5 changed files with 49 additions and 12 deletions

View File

@@ -1,12 +1,33 @@
-- Process handle that returns stdout for the "hostname" command
local handle = io.popen("hostname")
-- Global variable, accessible in all other called files
Hostname = "default"
-- If "hostname" command returned something
if handle then
-- Set result to first line of output
local result = handle:read("*l")
-- Kill process
handle:close()
-- If the first line contains characters
if result then
Hostname = result:gsub("%s+", "") -- "HACKSTATION"
-- Set global variable and substitute any whitespace characters for nothing
Hostname = result:gsub("%s+", "") -- This removes spaces, newlines, tabs, etc.
end
end
pcall(dofile, os.getenv("HYPRLAND_ROOT") .. "/autoload.lua")
-- This differs from the video. In order to make it so that the config
-- still runs with an unset HYPRLAND_ROOT variable, it makes more sense to call
-- os.getenv in this file, and have HyprRoot be a global variable like Hostname
HyprRoot = os.getenv("HOME") .. "/.config/hypr"
-- If the HYPRLAND_ROOT var is set, use it, if not, use the default config location
if os.getenv("HYPRLAND_ROOT") then
HyprRoot = os.getenv("HYPRLAND_ROOT")
end
-- Call the autoloader using the config root location
pcall(dofile, HyprRoot .. "/autoload.lua")