Route panel hotkeys through the shell IPC target so they survive reloads
Bar-widget panels (audio, bluetooth, network, power, monitor) used to be toggled via their own per-plugin IpcHandler targets. Quickshell resolves duplicate targets first-handler-wins, so after a plugin or bar reload the stale handler of the destroyed widget instance kept claiming the target and the hotkeys went dead. The shell root's IpcHandler lives outside the reload cycle, so summon, hide, and toggle now go through `omarchy-shell shell toggle <plugin>` and the shell routes to the live widget instance via the bar's slot registry. Panel plugins that are also panel/overlay/menu kinds keep using the panel loader path. Failures to find a live widget are logged so a widget missing from the bar layout stays diagnosable. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
6bb3cb666b
commit
e1cdc9005e
@@ -333,6 +333,44 @@ Item {
|
||||
return true
|
||||
}
|
||||
|
||||
// Resolve the live bar-widget instance for a plugin id (e.g. "omarchy.bluetooth").
|
||||
// Only widgets that expose popup open/close methods count; plain indicators
|
||||
// (clock, workspaces, tray) return null. Used by shell.summon/toggle so
|
||||
// panel hotkeys route through the bar instead of a per-target IpcHandler
|
||||
// that goes stale when the bar reloads its widget instances.
|
||||
function findPanelWidget(pluginId) {
|
||||
var id = String(pluginId || "")
|
||||
if (!id) return null
|
||||
for (var i = 0; i < moduleSlots.length; i++) {
|
||||
var slot = moduleSlots[i]
|
||||
if (!slot || !slot.activeItem) continue
|
||||
if (slot.moduleName !== id) continue
|
||||
var item = slot.activeItem
|
||||
if (typeof item.open !== "function" || typeof item.close !== "function" || item.opened === undefined) continue
|
||||
return item
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
function summonBarWidget(pluginId) {
|
||||
var item = findPanelWidget(pluginId)
|
||||
if (!item || typeof item.open !== "function") return false
|
||||
item.open()
|
||||
return true
|
||||
}
|
||||
|
||||
function hideBarWidget(pluginId) {
|
||||
var item = findPanelWidget(pluginId)
|
||||
if (!item || typeof item.close !== "function") return false
|
||||
item.close()
|
||||
return true
|
||||
}
|
||||
|
||||
function isBarWidgetOpen(pluginId) {
|
||||
var item = findPanelWidget(pluginId)
|
||||
return !!item && item.opened === true
|
||||
}
|
||||
|
||||
function entrySettings(entry) {
|
||||
return BarModel.entrySettings(entry)
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ BarWidget {
|
||||
active: root.inUse
|
||||
tooltipText: root.muted ? "Microphone muted" : (root.inUse ? "Microphone in use" : "Microphone live")
|
||||
onPressed: function(b) {
|
||||
if (b === Qt.MiddleButton) root.bar.run("omarchy-shell omarchy.audio toggle")
|
||||
if (b === Qt.MiddleButton) root.bar.run("omarchy-shell shell toggle omarchy.audio")
|
||||
else root.toggleMute()
|
||||
}
|
||||
onWheelMoved: function(delta) {
|
||||
|
||||
Reference in New Issue
Block a user