Skip to content

Support multiple post update hooks (example usage scripts)#5242

Open
markmcnaughton wants to merge 5 commits intobasecamp:devfrom
markmcnaughton:feat/support-multiple-post-update-hooks
Open

Support multiple post update hooks (example usage scripts)#5242
markmcnaughton wants to merge 5 commits intobasecamp:devfrom
markmcnaughton:feat/support-multiple-post-update-hooks

Conversation

@markmcnaughton
Copy link
Copy Markdown

@markmcnaughton markmcnaughton commented Apr 6, 2026

Summary

Documents an optional pattern for running several scripts after an Omarchy update by using a post-update.d/ directory, and adds example drop-in hooks so users can copy and adapt them.

Motivation

omarchy-hook post-update still runs a single executable at ~/.config/omarchy/hooks/post-update. Users who want more than one post-update action (notifications, backups, package tweaks, etc.) benefit from a small, predictable convention: executable scripts in post-update.d/, run in lexicographic order by path using an explicit LC_ALL=C sort (not raw glob order, which is not guaranteed sorted), without changing omarchy-hook itself.

What changed

  • config/omarchy/hooks/post-update.sample — Comments describe optional use of ~/.config/omarchy/hooks/post-update.d/ and include a ready-to-uncomment loop that:

    • uses nullglob so an empty directory does not leave a stray * path;
    • builds a sorted list (mapfile + printf + LC_ALL=C sort) so numeric prefixes like 10- and 20- run in a stable order;
    • runs only regular executable files (-f and -x), logs each script, and reports failures without stopping the rest of the chain.
  • config/omarchy/hooks/post-update.d/ — Example scripts (10-my-post-update-task-1.sample, 20-my-post-update-task-2.sample) demonstrate minimal valid bash hooks (e.g. desktop notifications), consistent with other *.sample hooks in this repo.

How to use (for reviewers / release notes)

  1. Copy defaults into ~/.config/omarchy/hooks/ as usual.
  2. Rename post-update.samplepost-update and, if you want multiple hooks, uncomment the post-update.d block in that file.
  3. Create ~/.config/omarchy/hooks/post-update.d/ if needed, copy examples, remove the .sample suffix, and chmod +x the scripts you want to run.

No changes to bin/omarchy-hook or omarchy-update-perform are required for this pattern.

Checklist

  • Sample comments match actual paths and behavior.
  • Example scripts are valid bash and pass shellcheck (if you run it in CI).

Copilot AI review requested due to automatic review settings April 6, 2026 05:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds documentation and example scripts for supporting multiple post-update hooks through an optional pattern using a post-update.d/ directory. The pattern allows users to organize multiple post-update scripts in a predictable, sortable convention without modifying the core omarchy-hook or omarchy-update-perform scripts.

Changes:

  • Documents an optional post-update hook pattern using an explicit LC_ALL=C sort for deterministic execution order with numeric-prefixed script names
  • Provides ready-to-uncomment bash code in post-update.sample that iterates through executable scripts in ~/.config/omarchy/hooks/post-update.d/, handling empty directories with nullglob and reporting failures without stopping the execution chain
  • Adds two minimal example hook scripts demonstrating valid bash structure and how to conditionally run desktop notifications

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
config/omarchy/hooks/post-update.sample Adds commented-out example code showing how to run multiple hooks from a directory with sorted execution and error handling
config/omarchy/hooks/post-update.d/10-my-post-update-task-1.sample Example hook script demonstrating the first task pattern with notify-send usage
config/omarchy/hooks/post-update.d/20-my-post-update-task-2.sample Example hook script demonstrating the second task pattern with consistent structure

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread config/omarchy/hooks/post-update.sample Outdated
@markmcnaughton markmcnaughton changed the title feat: Support multiple post update hooks (example usage scripts) Support multiple post update hooks (example usage scripts) Apr 6, 2026
Accepted suggestion

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 6, 2026 05:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants