summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2025-02-22 11:05:43 +0000
committerGrégoire Duchêne <gduchene@awhk.org>2025-02-22 11:49:50 +0000
commitabdc8df1d2df5d2527865f765c57566336f48ef7 (patch)
treeb4c9dbe892fd129c94af8bd4bdb4ae35e377d509
parentf88d79c060c0067c590bcec2060b907de7c570cd (diff)
darwin/env.plist: Switch to JSON
-rw-r--r--dotfiles-darwin/launchd/Makefile7
-rw-r--r--dotfiles-darwin/launchd/org.awhk.env.json11
-rw-r--r--dotfiles-darwin/launchd/org.awhk.env.plist24
3 files changed, 15 insertions, 27 deletions
diff --git a/dotfiles-darwin/launchd/Makefile b/dotfiles-darwin/launchd/Makefile
index 54d7b2a..cad2e9a 100644
--- a/dotfiles-darwin/launchd/Makefile
+++ b/dotfiles-darwin/launchd/Makefile
@@ -1,8 +1,9 @@
export ENV_SH := $(realpath ../bin/env.sh)
+AGENTS_DIR := ~/Library/LaunchAgents
-all: $(foreach plist, $(wildcard *.plist), ~/Library/LaunchAgents/${plist})
+all: $(foreach plist, $(wildcard *.json), $(AGENTS_DIR)/$(plist:json=plist))
-~/Library/LaunchAgents/%.plist: %.plist
- envsubst < $< >$@
+$(AGENTS_DIR)/%.plist: %.json
+ plutil -convert xml1 -o $@ - <<< $$(envsubst < $<)
-launchctl unload $@ 2>/dev/null
launchctl load $@
diff --git a/dotfiles-darwin/launchd/org.awhk.env.json b/dotfiles-darwin/launchd/org.awhk.env.json
new file mode 100644
index 0000000..3745c97
--- /dev/null
+++ b/dotfiles-darwin/launchd/org.awhk.env.json
@@ -0,0 +1,11 @@
+{
+ "Label" : "org.awhk.env",
+ "ProgramArguments" : [
+ "/bin/zsh",
+ "-l",
+ "${ENV_SH}"
+ ],
+ "RunAtLoad" : true,
+ "StandardErrorPath" : "${HOME}/Library/Logs/org.awhk.env.log",
+ "StandardOutPath" : "${HOME}/Library/Logs/org.awhk.env.log"
+}
diff --git a/dotfiles-darwin/launchd/org.awhk.env.plist b/dotfiles-darwin/launchd/org.awhk.env.plist
deleted file mode 100644
index fd59a0c..0000000
--- a/dotfiles-darwin/launchd/org.awhk.env.plist
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
- <dict>
- <key>Label</key>
- <string>org.awhk.env</string>
-
- <key>ProgramArguments</key>
- <array>
- <string>/bin/zsh</string>
- <string>-l</string>
- <string>${ENV_SH}</string>
- </array>
-
- <key>StandardOutPath</key>
- <string>${HOME}/Library/Logs/org.awhk.env.log</string>
-
- <key>StandardErrorPath</key>
- <string>${HOME}/Library/Logs/org.awhk.env.log</string>
-
- <key>RunAtLoad</key>
- <true/>
- </dict>
-</plist>