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) {
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)
+3 -6
View File
@@ -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) {
+2 -1
View File
@@ -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 {
+1 -1
View File
@@ -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: {
+4 -4
View File
@@ -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)
+3 -3
View File
@@ -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") }
}
+2 -1
View File
@@ -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)
+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"