added comments for casual readers
This commit is contained in:
25
hyprland.lua
25
hyprland.lua
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user