From 1deab5040126e7fe6048a40594134850719524a7 Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Thu, 30 Dec 2021 17:18:10 -0500 Subject: [PATCH] Working on launch agents --- .../com.michael.clear-screenshots.plist | 29 +++++++++++++++++++ scripts/install_launch_agents | 20 +++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 macOS/LaunchAgents/com.michael.clear-screenshots.plist create mode 100755 scripts/install_launch_agents diff --git a/macOS/LaunchAgents/com.michael.clear-screenshots.plist b/macOS/LaunchAgents/com.michael.clear-screenshots.plist new file mode 100644 index 0000000..ecfd82f --- /dev/null +++ b/macOS/LaunchAgents/com.michael.clear-screenshots.plist @@ -0,0 +1,29 @@ + + + + + Label + com.micheal.clear-screenshots + ProgramArguments + + sh + -c + /Users/michael/.local/scripts/clear_screenshots + + StartCalendarInterval + + Day + 1 + Hour + 0 + Minute + 0 + Weekday + 0 + + UserName + michael + RunAtLoad + + + diff --git a/scripts/install_launch_agents b/scripts/install_launch_agents new file mode 100755 index 0000000..25d5b0b --- /dev/null +++ b/scripts/install_launch_agents @@ -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