Files
nix-dotfiles-v2/home/noctalia-plugins/osk/toggle.luau
T

39 lines
1.0 KiB
Lua

local BIN = "wvkbd-mobintl"
-- Build the wvkbd flag string from the widget's style settings.
local function buildArgs()
local args = {}
local function add(value, flag)
if value ~= nil and value ~= "" then
table.insert(args, flag .. " " .. tostring(value))
end
end
add(barWidget.getConfig("height"), "-L")
add(barWidget.getConfig("rounding"), "-R")
add(barWidget.getConfig("alpha"), "--alpha")
add(barWidget.getConfig("bg"), "--bg")
add(barWidget.getConfig("fg"), "--fg")
add(barWidget.getConfig("press"), "--press")
add(barWidget.getConfig("text"), "--text")
add(barWidget.getConfig("layers"), "-l")
if barWidget.getConfig("non_exclusive") == true then
table.insert(args, "--non-exclusive")
end
return table.concat(args, " ")
end
function update()
noctalia.setUpdateInterval(60000)
barWidget.setGlyph("keyboard")
barWidget.setTooltip("Toggle wvkbd on-screen keyboard")
end
function onClick()
local launch = BIN .. " " .. buildArgs()
noctalia.runAsync("pkill -x " .. BIN .. " || setsid " .. launch)
end