allow env variables expansion in config files

This commit is contained in:
2026-07-12 18:20:03 +02:00
parent 9a7710d675
commit 27fad1d67c
12 changed files with 290 additions and 14 deletions
@@ -82,6 +82,7 @@ extension PHBlock {
guard kind == .text else { return nil }
let command = command
let environment = self.environment
let lines: [Substring]? = await Task.detached(priority: .userInitiated) {
let process = Process()
@@ -92,8 +93,9 @@ extension PHBlock {
process.executableURL = URL(fileURLWithPath: "/bin/bash")
process.arguments = ["-c", command]
// Inherit the parent's environment (includes $PATH, etc.)
process.environment = ProcessInfo.processInfo.environment
// Scripts inherit phbar's process environment with the `[env]` section
// overlaid, so user-defined variables and PATH extensions are visible.
process.environment = environment.variables
if let gestureEvent {
let type = gestureEvent.type.rawValue
process.environment?.updateValue(type, forKey: PHGestureEvent.typeKey)