omarchy/bin/omarchy-state
Ryan Hughes b2eb1b08a4
Add ~/.local/share/omarchy/bin to systemwide PATH (#602)
* Add omarchy to system path

* Remove unnecessary duplicate

* Remove path def since it's global now

* Migration for system-wide path

* Remove debug code

* Refresh after update

* Add common state script

* Restart on state detected

* Set state instead

* Export own path for menu
2025-08-10 19:58:44 +02:00

30 lines
732 B
Bash
Executable File

#!/bin/bash
STATE_DIR="$HOME/.local/state/omarchy"
mkdir -p "$STATE_DIR"
COMMAND="$1"
STATE_NAME="$2"
case "$COMMAND" in
set)
if [[ -z "$STATE_NAME" ]]; then
echo "Usage: omarchy-state set <state-name>" >&2
exit 1
fi
touch "$STATE_DIR/$STATE_NAME"
;;
clear)
if [[ -z "$STATE_NAME" ]]; then
echo "Usage: omarchy-state clear <state-name-or-pattern>" >&2
exit 1
fi
# Use find with -maxdepth 1 to match files in STATE_DIR
find "$STATE_DIR" -maxdepth 1 -type f -name "$STATE_NAME" -delete
;;
*)
echo "Usage: omarchy-state <set|clear> <state-name-or-pattern>" >&2
exit 1
;;
esac