Move to .d directories for hooks instead of a single file

Easier to manage especially with separate installs
This commit is contained in:
David Heinemeier Hansson
2026-05-07 09:59:18 +02:00
parent f0969c6793
commit fe0ea4de3e
6 changed files with 9 additions and 8 deletions
+1
View File
@@ -22,6 +22,7 @@ fi
if [[ -d $HOOK_DIR ]]; then
for hook in "$HOOK_DIR"/*; do
[[ -f $hook ]] || continue
[[ $hook == *.sample ]] && continue
bash "$hook" "$@"
done
fi
@@ -1,7 +1,7 @@
#!/bin/bash
# This hook is called with the current battery percentage when the low battery
# notification is sent. To put it into use, remove .sample from the name.
# notification is sent. To put it into use, remove .sample from this file name.
SOUND_FILE="/usr/share/sounds/freedesktop/stereo/dialog-warning.oga"
@@ -1,7 +1,7 @@
#!/bin/bash
# This hook is called with the snake-cased name of the font that has just been set.
# To put it into use, remove .sample from the name.
# To put it into use, remove .sample from this file name.
# Example: Show the name of the theme that was just set.
# Example: Show the name of the font that was just set.
# notify-send -u low "New font" "Your new font is $1"
@@ -1,7 +1,7 @@
#!/bin/bash
# This hook is called after an Omarchy system update has been performed.
# To put it into use, remove .sample from the name.
# To put it into use, remove .sample from this file name.
# Example: Show notification after the system has been updated.
# notify-send -u low "Update Performed" "Your system is now up to date"
@@ -1,7 +1,7 @@
#!/bin/bash
# This hook is called with the snake-cased name of the theme that has just been set.
# To put it into use, remove .sample from the name.
# To put it into use, remove .sample from this file name.
# Example: Show the name of the theme that was just set.
# notify-send -u low "New theme" "Your new theme is $1"
+3 -3
View File
@@ -1,7 +1,7 @@
echo "Add sample low battery notification hook"
mkdir -p ~/.config/omarchy/hooks
mkdir -p ~/.config/omarchy/hooks/battery-low.d
if [[ ! -f ~/.config/omarchy/hooks/battery-low.sample ]]; then
cp "$OMARCHY_PATH/config/omarchy/hooks/battery-low.sample" ~/.config/omarchy/hooks/battery-low.sample
if [[ ! -f ~/.config/omarchy/hooks/battery-low.d/play-warning-sound.sample ]]; then
cp "$OMARCHY_PATH/config/omarchy/hooks/battery-low.d/play-warning-sound.sample" ~/.config/omarchy/hooks/battery-low.d/play-warning-sound.sample
fi