Working on launch agents

This commit is contained in:
2021-12-30 17:18:10 -05:00
parent 5ba356655a
commit 1deab50401
2 changed files with 49 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?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>com.micheal.clear-screenshots</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>/Users/michael/.local/scripts/clear_screenshots</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Day</key>
<integer>1</integer>
<key>Hour</key>
<integer>0</integer>
<key>Minute</key>
<integer>0</integer>
<key>Weekday</key>
<integer>0</integer>
</dict>
<key>UserName</key>
<string>michael</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

20
scripts/install_launch_agents Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/sh
set -e
# Installs launchd agents for appropriately.
agent="$HOME/Library/LaunchAgents"
uid="$(id -u "$(whoami)")"
test -d "$agent"
for file in "$DOTFILES"/macOS/LaunchAgents/*.plist; do
filename="$(basename $file)"
path="$agent/$filename"
if ! test -e "$path"; then
echo "Installing Agent: $filename"
cp "$file" "$path"
launchctl enable "user/$uid/$filename"
fi
done