Use PATH for panel helper commands

This commit is contained in:
David Heinemeier Hansson
2026-06-24 13:40:16 +02:00
parent d136585ef4
commit beea78084e
8 changed files with 31 additions and 21 deletions
+5 -5
View File
@@ -378,9 +378,9 @@ Panel {
function setDefaultSink(node) { function setDefaultSink(node) {
if (!node) return if (!node) return
Pipewire.preferredDefaultAudioSink = node Pipewire.preferredDefaultAudioSink = node
if (root.bar && node.id !== undefined && node.name) { if (node.id !== undefined && node.name) {
Quickshell.execDetached([ Quickshell.execDetached([
root.bar.omarchyPath + "/bin/omarchy-audio-output-set-default", "omarchy-audio-output-set-default",
String(node.id), String(node.id),
String(node.name) String(node.name)
]) ])
@@ -390,9 +390,9 @@ Panel {
function setDefaultSource(node) { function setDefaultSource(node) {
if (!node) return if (!node) return
Pipewire.preferredDefaultAudioSource = node Pipewire.preferredDefaultAudioSource = node
if (root.bar && node.id !== undefined && node.name) { if (node.id !== undefined && node.name) {
Quickshell.execDetached([ Quickshell.execDetached([
root.bar.omarchyPath + "/bin/omarchy-audio-input-set-default", "omarchy-audio-input-set-default",
String(node.id), String(node.id),
String(node.name) String(node.name)
]) ])
@@ -500,7 +500,7 @@ Panel {
Process { Process {
id: sinkAvailabilityProc id: sinkAvailabilityProc
command: [root.bar ? root.bar.omarchyPath + "/bin/omarchy-audio-sink-availability" : "omarchy-audio-sink-availability"] command: ["omarchy-audio-sink-availability"]
stdout: StdioCollector { stdout: StdioCollector {
waitForEnd: true waitForEnd: true
onStreamFinished: root.updateSinkAvailability(text) onStreamFinished: root.updateSinkAvailability(text)
+3 -6
View File
@@ -136,9 +136,9 @@ Panel {
function setDefaultAudioSink(sink) { function setDefaultAudioSink(sink) {
if (!sink) return if (!sink) return
Pipewire.preferredDefaultAudioSink = sink Pipewire.preferredDefaultAudioSink = sink
if (root.bar && root.bar.omarchyPath && sink.id !== undefined && sink.name) { if (sink.id !== undefined && sink.name) {
Quickshell.execDetached([ Quickshell.execDetached([
root.bar.omarchyPath + "/bin/omarchy-audio-output-set-default", "omarchy-audio-output-set-default",
String(sink.id), String(sink.id),
String(sink.name) String(sink.name)
]) ])
@@ -194,10 +194,7 @@ Panel {
} }
function deviceCommand(action, address) { function deviceCommand(action, address) {
var command = root.bar && root.bar.omarchyPath return ["omarchy-bluetooth-device", action, address]
? root.bar.omarchyPath + "/bin/omarchy-bluetooth-device"
: "omarchy-bluetooth-device"
return [command, action, address]
} }
function runDeviceAction(device, action, pending) { function runDeviceAction(device, action, pending) {
+2 -1
View File
@@ -13,6 +13,7 @@ Panel {
ipcTarget: "omarchy.dropbox" ipcTarget: "omarchy.dropbox"
manageIpc: false manageIpc: false
property string omarchyPath: Quickshell.env("OMARCHY_PATH")
property string focusSection: "login" property string focusSection: "login"
property int fileIndex: 0 property int fileIndex: 0
property bool cursorActive: false property bool cursorActive: false
@@ -117,7 +118,7 @@ Panel {
Service { Service {
id: dropbox id: dropbox
settings: root.settings settings: root.settings
omarchyPath: root.bar ? root.bar.omarchyPath : Quickshell.env("OMARCHY_PATH") omarchyPath: root.omarchyPath
} }
Connections { Connections {
+1 -1
View File
@@ -287,7 +287,7 @@ Panel {
Process { Process {
id: stateProc id: stateProc
command: [root.bar ? root.bar.omarchyPath + "/bin/omarchy-monitor-state" : "omarchy-monitor-state"] command: ["omarchy-monitor-state"]
stdout: StdioCollector { stdout: StdioCollector {
waitForEnd: true waitForEnd: true
onStreamFinished: { onStreamFinished: {
+4 -4
View File
@@ -353,7 +353,7 @@ Panel {
} }
function dnsCommand(provider) { 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) if (provider) command += " " + Util.shellQuote(provider)
return command return command
} }
@@ -362,7 +362,7 @@ Panel {
if (!root.bar || !provider || actionProc.running) return if (!root.bar || !provider || actionProc.running) return
if (provider === "Custom") { 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.bar.run(launcher + " " + Util.shellQuote(root.dnsCommand(provider)))
root.close() root.close()
return return
@@ -473,7 +473,7 @@ Panel {
// Pulls everything we want about the active route's interface in one shot. // Pulls everything we want about the active route's interface in one shot.
Process { Process {
id: detailsProc id: detailsProc
command: [root.bar ? root.bar.omarchyPath + "/bin/omarchy-network-status" : "omarchy-network-status", "--verbose"] command: ["omarchy-network-status", "--verbose"]
stdout: StdioCollector { stdout: StdioCollector {
waitForEnd: true waitForEnd: true
onStreamFinished: root.updateDetails(text) onStreamFinished: root.updateDetails(text)
@@ -1293,7 +1293,7 @@ Panel {
// Bar.qml does not need to mirror network state. // Bar.qml does not need to mirror network state.
Process { Process {
id: networkProc id: networkProc
command: [root.bar ? root.bar.omarchyPath + "/bin/omarchy-network-status" : "omarchy-network-status"] command: ["omarchy-network-status"]
stdout: StdioCollector { stdout: StdioCollector {
waitForEnd: true waitForEnd: true
onStreamFinished: root.updateNetwork(text) onStreamFinished: root.updateNetwork(text)
+3 -3
View File
@@ -183,19 +183,19 @@ Panel {
Process { Process {
id: batteryProc 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") } stdout: StdioCollector { waitForEnd: true; onStreamFinished: root.updateKeyValue(text, "battery") }
} }
Process { Process {
id: profilesProc 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) } stdout: StdioCollector { waitForEnd: true; onStreamFinished: root.updateProfiles(text) }
} }
Process { Process {
id: systemProc 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") } stdout: StdioCollector { waitForEnd: true; onStreamFinished: root.updateKeyValue(text, "system") }
} }
+2 -1
View File
@@ -11,6 +11,7 @@ Panel {
ipcTarget: "omarchy.weather" ipcTarget: "omarchy.weather"
manageIpc: false manageIpc: false
property string omarchyPath: Quickshell.env("OMARCHY_PATH")
property var anchorItem: null property var anchorItem: null
property bool openedFromHotkey: false property bool openedFromHotkey: false
@@ -469,7 +470,7 @@ Panel {
// Poll the weather pill text/class every minute. Local to this widget. // Poll the weather pill text/class every minute. Local to this widget.
Process { Process {
id: weatherProc 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 { stdout: StdioCollector {
waitForEnd: true waitForEnd: true
onStreamFinished: root.updateWeather(text) onStreamFinished: root.updateWeather(text)
+11
View File
@@ -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"