Add hooks for theme set, font set, and post update (#2527)

Ala git hooks
This commit is contained in:
David Heinemeier Hansson
2025-10-18 16:11:49 +02:00
committed by GitHub
parent 63e3b3e32f
commit 24e76a3b90
7 changed files with 41 additions and 0 deletions

View File

@@ -28,6 +28,8 @@ if [[ -n "$font_name" && "$font_name" != "CNCLD" ]]; then
omarchy-restart-waybar
omarchy-restart-swayosd
omarchy-restart-walker
omarchy-hook font-set "$font_name"
else
echo "Font '$font_name' not found."
exit 1

14
bin/omarchy-hook Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
if [[ $# -lt 1 ]]; then
echo "Usage: omarchy-hook [name] [args...]"
exit 1
fi
HOOK=$1
HOOK_PATH="$HOME/.config/omarchy/hooks/$1"
shift
if [[ -f $HOOK_PATH ]]; then
bash "$HOOK_PATH" "$@"
fi

View File

@@ -39,3 +39,6 @@ omarchy-theme-set-browser
omarchy-theme-set-vscode
omarchy-theme-set-cursor
omarchy-theme-set-obsidian
# Call hook on theme set
omarchy-hook theme-set "$THEME_NAME"

View File

@@ -5,4 +5,5 @@ set -e
omarchy-update-available-reset
omarchy-update-system-pkgs
omarchy-migrate
omarchy-hook post-update
omarchy-update-restart

View File

@@ -0,0 +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.
# Example: Show the name of the theme that was just set.
# notify-send "New font" "Your new font is $1"

View File

@@ -0,0 +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.
# Example: Show notification after the system has been updated.
# notify-send "Update Performed" "Your system is now up to date"

View File

@@ -0,0 +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.
# Example: Show the name of the theme that was just set.
# notify-send "New theme" "Your new theme is $1"