diff options
Diffstat (limited to 'dotfiles-darwin')
| -rwxr-xr-x | dotfiles-darwin/bin/env.sh | 5 | ||||
| -rw-r--r-- | dotfiles-darwin/launchd/Makefile | 8 | ||||
| -rw-r--r-- | dotfiles-darwin/launchd/org.awhk.env.plist | 14 |
3 files changed, 27 insertions, 0 deletions
diff --git a/dotfiles-darwin/bin/env.sh b/dotfiles-darwin/bin/env.sh new file mode 100755 index 0000000..00c1bfa --- /dev/null +++ b/dotfiles-darwin/bin/env.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env zsh + +for env in PATH UNAME XDG_{{CACHE,CONFIG,DATA}_HOME,RUNTIME_DIR}; do + launchctl setenv ${env} ${(P)env} +done diff --git a/dotfiles-darwin/launchd/Makefile b/dotfiles-darwin/launchd/Makefile new file mode 100644 index 0000000..54d7b2a --- /dev/null +++ b/dotfiles-darwin/launchd/Makefile @@ -0,0 +1,8 @@ +export ENV_SH := $(realpath ../bin/env.sh) + +all: $(foreach plist, $(wildcard *.plist), ~/Library/LaunchAgents/${plist}) + +~/Library/LaunchAgents/%.plist: %.plist + envsubst < $< >$@ + -launchctl unload $@ 2>/dev/null + launchctl load $@ diff --git a/dotfiles-darwin/launchd/org.awhk.env.plist b/dotfiles-darwin/launchd/org.awhk.env.plist new file mode 100644 index 0000000..f2da1d5 --- /dev/null +++ b/dotfiles-darwin/launchd/org.awhk.env.plist @@ -0,0 +1,14 @@ +<?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>Program</key> + <string>${ENV_SH}</string> + + <key>RunAtLoad</key> + <true/> + </dict> +</plist> |
