* Made a iio-hyprland plugin for noctalia kill iio-hyprland and restart it depending on the locked setting. The plugin has: -control center toggle -Bar wigdet for toggle of state --If rigth clicked this wigdet will open the panel -Panel for calling by msg --Panel also added possibally to specify lock direction -Bar wiget for open panel --Useful for touch - Tested with hyprland 0.55.4 and noctalia v5.0.0 - Should work with sway using iio-sway (not tested) * add en.json to translation unify settings keys for consistent naming update names add iio-service so tools work independently refactor code for readability and remove unused logic update readme add thumbnail * Updated plugin.toml names Reworked panel code * bump version * Make arrow buttons apply relative orientation instead of fixed original directions * fixed wrong labels * Delete iio_lock/iio_lock.luau * Delete iio_lock/iio_panel.luau * Delete iio_lock/shortcut.luau * make noctalia.getConfig the sole config accessor --------- Co-authored-by: Lemmy <studio@quadbyte.net>
40 lines
830 B
Luau
40 lines
830 B
Luau
--!nonstrict
|
|
|
|
local iio_tool = noctalia.getConfig("iio")
|
|
local locked = false
|
|
|
|
-- Detect initial state by checking whether the IIO tool is running
|
|
local function refresh_state()
|
|
noctalia.runAsync("pgrep -fx "..iio_tool, function(result)
|
|
local pid = noctalia.string.trim(result.stdout)
|
|
if pid ~= "" then
|
|
noctalia.state.set("iio-state",false)
|
|
else
|
|
noctalia.state.set("iio-state",true)
|
|
end
|
|
end)
|
|
end
|
|
|
|
refresh_state()
|
|
|
|
local function kill_iio()
|
|
noctalia.runAsync("pkill -x "..iio_tool)
|
|
end
|
|
|
|
local function start_iio()
|
|
noctalia.runAsync(iio_tool)
|
|
end
|
|
|
|
local function apply_lock_state()
|
|
if locked then
|
|
kill_iio()
|
|
else
|
|
start_iio()
|
|
end
|
|
end
|
|
|
|
noctalia.state.watch("iio-state", function (value)
|
|
locked = value
|
|
apply_lock_state()
|
|
end)
|