From beea78084e9d6a03e5e2d4595b2636d9ce49dbe8 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 24 Jun 2026 13:40:16 +0200 Subject: [PATCH] Use PATH for panel helper commands --- shell/plugins/panels/audio/Panel.qml | 10 +++++----- shell/plugins/panels/bluetooth/Panel.qml | 9 +++------ shell/plugins/panels/dropbox/Panel.qml | 3 ++- shell/plugins/panels/monitor/Panel.qml | 2 +- shell/plugins/panels/network/Panel.qml | 8 ++++---- shell/plugins/panels/power/Panel.qml | 6 +++--- shell/plugins/panels/weather/Panel.qml | 3 ++- test/shell.d/panel-command-path-test.sh | 11 +++++++++++ 8 files changed, 31 insertions(+), 21 deletions(-) create mode 100644 test/shell.d/panel-command-path-test.sh diff --git a/shell/plugins/panels/audio/Panel.qml b/shell/plugins/panels/audio/Panel.qml index 6a68542d..35abd1dc 100644 --- a/shell/plugins/panels/audio/Panel.qml +++ b/shell/plugins/panels/audio/Panel.qml @@ -378,9 +378,9 @@ Panel { function setDefaultSink(node) { if (!node) return Pipewire.preferredDefaultAudioSink = node - if (root.bar && node.id !== undefined && node.name) { + if (node.id !== undefined && node.name) { Quickshell.execDetached([ - root.bar.omarchyPath + "/bin/omarchy-audio-output-set-default", + "omarchy-audio-output-set-default", String(node.id), String(node.name) ]) @@ -390,9 +390,9 @@ Panel { function setDefaultSource(node) { if (!node) return Pipewire.preferredDefaultAudioSource = node - if (root.bar && node.id !== undefined && node.name) { + if (node.id !== undefined && node.name) { Quickshell.execDetached([ - root.bar.omarchyPath + "/bin/omarchy-audio-input-set-default", + "omarchy-audio-input-set-default", String(node.id), String(node.name) ]) @@ -500,7 +500,7 @@ Panel { Process { id: sinkAvailabilityProc - command: [root.bar ? root.bar.omarchyPath + "/bin/omarchy-audio-sink-availability" : "omarchy-audio-sink-availability"] + command: ["omarchy-audio-sink-availability"] stdout: StdioCollector { waitForEnd: true onStreamFinished: root.updateSinkAvailability(text) diff --git a/shell/plugins/panels/bluetooth/Panel.qml b/shell/plugins/panels/bluetooth/Panel.qml index 85d3fc13..2c23e4c8 100644 --- a/shell/plugins/panels/bluetooth/Panel.qml +++ b/shell/plugins/panels/bluetooth/Panel.qml @@ -136,9 +136,9 @@ Panel { function setDefaultAudioSink(sink) { if (!sink) return Pipewire.preferredDefaultAudioSink = sink - if (root.bar && root.bar.omarchyPath && sink.id !== undefined && sink.name) { + if (sink.id !== undefined && sink.name) { Quickshell.execDetached([ - root.bar.omarchyPath + "/bin/omarchy-audio-output-set-default", + "omarchy-audio-output-set-default", String(sink.id), String(sink.name) ]) @@ -194,10 +194,7 @@ Panel { } function deviceCommand(action, address) { - var command = root.bar && root.bar.omarchyPath - ? root.bar.omarchyPath + "/bin/omarchy-bluetooth-device" - : "omarchy-bluetooth-device" - return [command, action, address] + return ["omarchy-bluetooth-device", action, address] } function runDeviceAction(device, action, pending) { diff --git a/shell/plugins/panels/dropbox/Panel.qml b/shell/plugins/panels/dropbox/Panel.qml index 2f43fbf4..92203a56 100644 --- a/shell/plugins/panels/dropbox/Panel.qml +++ b/shell/plugins/panels/dropbox/Panel.qml @@ -13,6 +13,7 @@ Panel { ipcTarget: "omarchy.dropbox" manageIpc: false + property string omarchyPath: Quickshell.env("OMARCHY_PATH") property string focusSection: "login" property int fileIndex: 0 property bool cursorActive: false @@ -117,7 +118,7 @@ Panel { Service { id: dropbox settings: root.settings - omarchyPath: root.bar ? root.bar.omarchyPath : Quickshell.env("OMARCHY_PATH") + omarchyPath: root.omarchyPath } Connections { diff --git a/shell/plugins/panels/monitor/Panel.qml b/shell/plugins/panels/monitor/Panel.qml index 46b7b2c0..75d19fc0 100644 --- a/shell/plugins/panels/monitor/Panel.qml +++ b/shell/plugins/panels/monitor/Panel.qml @@ -287,7 +287,7 @@ Panel { Process { id: stateProc - command: [root.bar ? root.bar.omarchyPath + "/bin/omarchy-monitor-state" : "omarchy-monitor-state"] + command: ["omarchy-monitor-state"] stdout: StdioCollector { waitForEnd: true onStreamFinished: { diff --git a/shell/plugins/panels/network/Panel.qml b/shell/plugins/panels/network/Panel.qml index 95676d19..8c7a26b1 100644 --- a/shell/plugins/panels/network/Panel.qml +++ b/shell/plugins/panels/network/Panel.qml @@ -353,7 +353,7 @@ Panel { } function dnsCommand(provider) { - var command = root.bar ? Util.shellQuote(root.bar.omarchyPath + "/bin/omarchy-dns") : "omarchy-dns" + var command = "omarchy-dns" if (provider) command += " " + Util.shellQuote(provider) return command } @@ -362,7 +362,7 @@ Panel { if (!root.bar || !provider || actionProc.running) return if (provider === "Custom") { - var launcher = Util.shellQuote(root.bar.omarchyPath + "/bin/omarchy-launch-floating-terminal-with-presentation") + var launcher = "omarchy-launch-floating-terminal-with-presentation" root.bar.run(launcher + " " + Util.shellQuote(root.dnsCommand(provider))) root.close() return @@ -473,7 +473,7 @@ Panel { // Pulls everything we want about the active route's interface in one shot. Process { id: detailsProc - command: [root.bar ? root.bar.omarchyPath + "/bin/omarchy-network-status" : "omarchy-network-status", "--verbose"] + command: ["omarchy-network-status", "--verbose"] stdout: StdioCollector { waitForEnd: true onStreamFinished: root.updateDetails(text) @@ -1293,7 +1293,7 @@ Panel { // Bar.qml does not need to mirror network state. Process { id: networkProc - command: [root.bar ? root.bar.omarchyPath + "/bin/omarchy-network-status" : "omarchy-network-status"] + command: ["omarchy-network-status"] stdout: StdioCollector { waitForEnd: true onStreamFinished: root.updateNetwork(text) diff --git a/shell/plugins/panels/power/Panel.qml b/shell/plugins/panels/power/Panel.qml index 3062eb5e..92d54dfa 100644 --- a/shell/plugins/panels/power/Panel.qml +++ b/shell/plugins/panels/power/Panel.qml @@ -183,19 +183,19 @@ Panel { Process { id: batteryProc - command: [root.bar ? root.bar.omarchyPath + "/bin/omarchy-battery-status" : "omarchy-battery-status", "--shell"] + command: ["omarchy-battery-status", "--shell"] stdout: StdioCollector { waitForEnd: true; onStreamFinished: root.updateKeyValue(text, "battery") } } Process { id: profilesProc - command: [root.bar ? root.bar.omarchyPath + "/bin/omarchy-powerprofiles-list" : "omarchy-powerprofiles-list", "--active-state"] + command: ["omarchy-powerprofiles-list", "--active-state"] stdout: StdioCollector { waitForEnd: true; onStreamFinished: root.updateProfiles(text) } } Process { id: systemProc - command: [root.bar ? root.bar.omarchyPath + "/bin/omarchy-system-stats" : "omarchy-system-stats"] + command: ["omarchy-system-stats"] stdout: StdioCollector { waitForEnd: true; onStreamFinished: root.updateKeyValue(text, "system") } } diff --git a/shell/plugins/panels/weather/Panel.qml b/shell/plugins/panels/weather/Panel.qml index 71d6a31f..991beb39 100644 --- a/shell/plugins/panels/weather/Panel.qml +++ b/shell/plugins/panels/weather/Panel.qml @@ -11,6 +11,7 @@ Panel { ipcTarget: "omarchy.weather" manageIpc: false + property string omarchyPath: Quickshell.env("OMARCHY_PATH") property var anchorItem: null property bool openedFromHotkey: false @@ -469,7 +470,7 @@ Panel { // Poll the weather pill text/class every minute. Local to this widget. Process { id: weatherProc - command: ["bash", "-lc", root.bar ? Util.shellQuote(root.bar.omarchyPath + "/shell/plugins/panels/weather/status.sh") : ""] + command: ["bash", "-lc", Util.shellQuote(root.omarchyPath + "/shell/plugins/panels/weather/status.sh")] stdout: StdioCollector { waitForEnd: true onStreamFinished: root.updateWeather(text) diff --git a/test/shell.d/panel-command-path-test.sh b/test/shell.d/panel-command-path-test.sh new file mode 100644 index 00000000..c8b6df10 --- /dev/null +++ b/test/shell.d/panel-command-path-test.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -euo pipefail + +source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh" + +if matches=$(rg -n 'root\.bar\.omarchyPath|/bin/omarchy-' "$ROOT/shell/plugins/panels" -g '*.qml'); then + fail "panels do not resolve omarchy helpers through bar paths" "$matches" +fi + +pass "panels avoid bar path resolution for omarchy helpers"