aboutsummaryrefslogtreecommitdiff
path: root/Sources/phbar
diff options
context:
space:
mode:
authorTommaso Negri <me@tommasongr.com>2026-08-09 15:33:16 +0200
committerTommaso Negri <me@tommasongr.com>2026-08-09 15:33:16 +0200
commitd7bc6c009bb728aff82032162095228ce12e2495 (patch)
treed3b285cc6b0784d60deb419a7f54bb8209a26108 /Sources/phbar
parent1f915152b061e9c5d655e3e87f068e29cb4ff1a0 (diff)
downloadbar-d7bc6c009bb728aff82032162095228ce12e2495.tar.gz
bar-d7bc6c009bb728aff82032162095228ce12e2495.zip
pass block name to the command environment
Diffstat (limited to 'Sources/phbar')
-rw-r--r--Sources/phbar/Models/Block.swift8
1 files changed, 6 insertions, 2 deletions
diff --git a/Sources/phbar/Models/Block.swift b/Sources/phbar/Models/Block.swift
index 95c4ada..fe575e4 100644
--- a/Sources/phbar/Models/Block.swift
+++ b/Sources/phbar/Models/Block.swift
@@ -58,10 +58,14 @@ final class Block: ObservableObject, Identifiable {
}
/// Re-run the command and update the cells on the main actor.
- func runScript() {
+ func runScript(env: [String: String] = [:]) {
let command = self.command
+
+ var env = env
+ env.updateValue(name, forKey: "BLOCK")
+
Task.detached(priority: .utility) { [weak self] in
- let lines = Runner.run(command)
+ let lines = Runner.run(command, env: env)
await self?.apply(lines)
}
}