forked from Shinonome/dots-hyprland
hl: create custom config files automatically
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
function is_file_exists(name)
|
||||
local f = io.open(name, "r")
|
||||
if f ~= nil then
|
||||
io.close(f)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function create_if_not_exists(path)
|
||||
if not is_file_exists(path) then
|
||||
os.execute("mkdir -p \"$(dirname \"" .. path .. "\")\"")
|
||||
os.execute("echo '-- This file will not be overwritten across dots-hyprland updates.\n-- The file name is for the sake of organization and does not matter\n-- See the corresponding files in ~/.config/hypr/hyprland for examples' > \"" .. path .. "\"")
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function workspace_in_group(i)
|
||||
local curr = hl.get_active_workspace().id
|
||||
local newVal = math.floor((curr - 1) / workspaceGroupSize) * workspaceGroupSize + i
|
||||
-- hl.notification.create({ text = "curr " .. curr .. " floor " .. math.floor(curr / 10) .. " new " .. newVal, duration = 5000 })
|
||||
return newVal
|
||||
end
|
||||
Reference in New Issue
Block a user