Start extracting omarchy helpers for cumbersome lua calls
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
-- Shared helpers for Hyprland Lua configuration.
|
||||
|
||||
o = o or {}
|
||||
|
||||
local function shell_quote(value)
|
||||
return "'" .. tostring(value):gsub("'", "'\\''") .. "'"
|
||||
end
|
||||
|
||||
function o.bind(keys, description, dispatcher, options)
|
||||
local opts = options or {}
|
||||
|
||||
if description then
|
||||
opts.description = description
|
||||
end
|
||||
|
||||
if type(dispatcher) == "string" then
|
||||
dispatcher = hl.dsp.exec_cmd(dispatcher)
|
||||
end
|
||||
|
||||
hl.bind(keys, dispatcher, opts)
|
||||
end
|
||||
|
||||
function o.launch(command)
|
||||
return "uwsm-app -- " .. command
|
||||
end
|
||||
|
||||
function o.launch_webapp(url)
|
||||
return "omarchy-launch-webapp " .. shell_quote(url)
|
||||
end
|
||||
|
||||
function o.launch_webapp_sole(name, url)
|
||||
return "omarchy-launch-or-focus-webapp " .. shell_quote(name) .. " " .. shell_quote(url)
|
||||
end
|
||||
Reference in New Issue
Block a user