Files
hyprland-dendritic/hyprland.lua

34 lines
1.1 KiB
Lua

-- 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
-- Set global variable and substitute any whitespace characters for nothing
Hostname = result:gsub("%s+", "") -- This removes spaces, newlines, tabs, etc.
end
end
-- 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")