feat(audio-switcher): migrate to widget.actions and fix mute status logic (#200)

* refactor(audio-switcher): remove unused translation key

* feat(audio-switcher)!: migrate scroll handling to widget actions

* feat(audio-switcher): migrate click handling to widget actions

* refactor(audio-switcher): migrate to openSettings

* fix(audio-switcher): fix incorrect mute status check for input and output
This commit is contained in:
HiImKobeAnd
2026-08-05 17:33:35 -04:00
committed by GitHub
parent 88168f3b32
commit 718ccfc451
5 changed files with 13 additions and 88 deletions
+2 -11
View File
@@ -110,7 +110,7 @@ local function volumeCard(kind)
local isOutput = kind == "output"
local device = activeDevice(kind)
local volume = tonumber(isOutput and snapshot.outputVolume or snapshot.inputVolume) or 0
local muted = isOutput and snapshot.outputMuted == true or snapshot.inputMuted == true
local muted = (isOutput and snapshot.outputMuted == true) or (not isOutput and snapshot.inputMuted == true)
local icon = isOutput and (muted and "volume-off" or "volume") or (muted and "microphone-mute" or "microphone")
return ui.column({ flexGrow = 1, gap = 8, padding = 12, radius = 12, fill = "surface_variant/0.45" }, {
ui.row({ align = "center", gap = 8 }, {
@@ -461,16 +461,7 @@ function onRefresh() sendCommand("refresh") end
function onScanBluetooth() sendCommand("scan_bluetooth") end
function onCycleOutput() sendCommand("cycle_output") end
function onCycleInput() sendCommand("cycle_input") end
function onOpenSettingsClicked()
local started = noctalia.runAsync("noctalia msg settings-open plugins", function(result)
if result.timedOut == true or tonumber(result.exitCode) ~= 0 then
noctalia.notifyError(tr("title"), tr("errors.command_start"))
end
end, 5000)
if not started then
noctalia.notifyError(tr("title"), tr("errors.command_start"))
end
end
function onOpenSettingsClicked() noctalia.openSettings() end
function onShowOutputs()
activeTab = "output"