* 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>
33 lines
742 B
Luau
33 lines
742 B
Luau
--!nonstrict
|
|
|
|
local locked = noctalia.state.get("iio-state")
|
|
local glyph_unlocked = noctalia.getConfig("unlocked")
|
|
local glyph_locked = noctalia.getConfig("locked")
|
|
local locked_text = noctalia.tr("widget.locked")
|
|
local unlocked_text = noctalia.tr("widget.unlocked")
|
|
|
|
local function render()
|
|
shortcut.setLabel(if locked then locked_text else unlocked_text)
|
|
if locked then
|
|
shortcut.setIcon(glyph_locked)
|
|
else
|
|
shortcut.setIcon(glyph_unlocked)
|
|
end
|
|
shortcut.setActive(locked)
|
|
end
|
|
|
|
noctalia.state.watch("iio-state", function (value)
|
|
locked = value
|
|
render()
|
|
end)
|
|
|
|
function onClick()
|
|
locked = not locked
|
|
noctalia.state.set("iio-state", locked)
|
|
render()
|
|
end
|
|
|
|
|
|
-- Initial state at load.
|
|
render()
|