From d2a4cc0c4d60cd3bce866f65643f89f7d2978d5e Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Fri, 1 May 2026 11:40:22 -0400 Subject: [PATCH] Add omarchy CLI (#5477) * Add omarchy CLI * Remove outdated or internal * Add bash completions for command * Add omarchy command documentation * Add missing docs * Correct to what's now right * Fix tests --------- Co-authored-by: David Heinemeier Hansson --- bin/omarchy | 1032 +++++++++++++++++ bin/omarchy-ac-present | 2 +- bin/omarchy-audio-input-mute | 2 +- bin/omarchy-audio-input-mute-thinkpad | 3 +- bin/omarchy-audio-input-mute-xps | 3 +- bin/omarchy-audio-output-switch | 2 +- bin/omarchy-battery-capacity | 3 +- bin/omarchy-battery-monitor | 2 +- bin/omarchy-battery-present | 3 +- bin/omarchy-battery-remaining | 3 +- bin/omarchy-battery-remaining-time | 2 +- bin/omarchy-battery-status | 3 +- bin/omarchy-branch-set | 3 +- bin/omarchy-brightness-display | 4 +- bin/omarchy-brightness-display-apple | 3 +- bin/omarchy-brightness-keyboard | 4 +- bin/omarchy-capture-screenrecording | 9 +- bin/omarchy-capture-screenshot | 8 +- bin/omarchy-channel-set | 15 +- bin/omarchy-cmd-missing | 2 +- bin/omarchy-cmd-present | 2 +- bin/omarchy-cmd-terminal-cwd | 4 +- bin/omarchy-config-direct-boot | 4 +- bin/omarchy-debug | 5 +- bin/omarchy-dev-add-migration | 3 +- bin/omarchy-dev-benchmark | 111 ++ bin/omarchy-dev-bin-metadata | 86 ++ bin/omarchy-drive-info | 3 +- bin/omarchy-drive-select | 2 +- bin/omarchy-drive-set-password | 3 +- bin/omarchy-first-run | 3 +- bin/omarchy-font-current | 4 +- bin/omarchy-font-list | 3 +- bin/omarchy-font-set | 5 +- bin/omarchy-haptic-touchpad | 2 + bin/omarchy-hibernation-available | 3 +- bin/omarchy-hibernation-remove | 4 +- bin/omarchy-hibernation-setup | 4 +- bin/omarchy-hook | 3 +- bin/omarchy-hw-asus-expertbook-b9406 | 2 +- bin/omarchy-hw-asus-rog | 2 +- bin/omarchy-hw-dell-xps-oled | 2 +- bin/omarchy-hw-external-monitors | 3 +- bin/omarchy-hw-framework16 | 2 +- bin/omarchy-hw-hybrid-gpu | 4 +- bin/omarchy-hw-intel | 2 +- bin/omarchy-hw-intel-ptl | 2 +- bin/omarchy-hw-match | 4 +- bin/omarchy-hw-recover-internal-monitor | 4 +- bin/omarchy-hw-surface | 2 +- bin/omarchy-hw-touchpad | 2 + bin/omarchy-hw-touchscreen | 2 + bin/omarchy-hw-vulkan | 2 +- ...hyprland-active-window-transparency-toggle | 2 +- bin/omarchy-hyprland-monitor-focused | 2 +- bin/omarchy-hyprland-monitor-internal | 3 + bin/omarchy-hyprland-monitor-internal-mirror | 3 + bin/omarchy-hyprland-monitor-scaling-cycle | 3 +- bin/omarchy-hyprland-monitor-watch | 3 +- bin/omarchy-hyprland-toggle | 3 +- bin/omarchy-hyprland-toggle-disabled | 3 +- bin/omarchy-hyprland-toggle-enabled | 3 +- bin/omarchy-hyprland-window-close-all | 3 +- bin/omarchy-hyprland-window-gaps-toggle | 2 +- bin/omarchy-hyprland-window-pop | 16 +- ...yprland-window-single-square-aspect-toggle | 2 +- bin/omarchy-hyprland-workspace-layout-toggle | 2 +- bin/omarchy-install-chromium-google-account | 3 +- bin/omarchy-install-dev-env | 6 +- bin/omarchy-install-docker-dbs | 4 +- bin/omarchy-install-dropbox | 2 +- bin/omarchy-install-geforce-now | 2 +- bin/omarchy-install-nordvpn | 3 +- bin/omarchy-install-once | 3 +- bin/omarchy-install-steam | 3 +- bin/omarchy-install-tailscale | 3 +- bin/omarchy-install-terminal | 4 +- bin/omarchy-install-vscode | 2 +- bin/omarchy-install-xbox-controllers | 3 +- bin/omarchy-launch-about | 2 +- bin/omarchy-launch-audio | 2 +- bin/omarchy-launch-bluetooth | 3 +- bin/omarchy-launch-browser | 4 +- bin/omarchy-launch-editor | 4 +- ...launch-floating-terminal-with-presentation | 4 +- bin/omarchy-launch-or-focus | 4 +- bin/omarchy-launch-or-focus-tui | 4 +- bin/omarchy-launch-or-focus-webapp | 4 +- bin/omarchy-launch-screensaver | 3 +- bin/omarchy-launch-tui | 3 +- bin/omarchy-launch-walker | 3 +- bin/omarchy-launch-webapp | 3 +- bin/omarchy-launch-wifi | 3 +- bin/omarchy-menu | 2 +- bin/omarchy-menu-keybindings | 2 +- bin/omarchy-menu-share | 6 +- bin/omarchy-migrate | 3 +- bin/omarchy-notification-dismiss | 3 +- bin/omarchy-npx-install | 7 +- bin/omarchy-pkg-add | 7 +- bin/omarchy-pkg-aur-accessible | 3 +- bin/omarchy-pkg-aur-add | 3 +- bin/omarchy-pkg-aur-install | 3 +- bin/omarchy-pkg-drop | 4 +- bin/omarchy-pkg-install | 3 +- bin/omarchy-pkg-missing | 3 +- bin/omarchy-pkg-present | 3 +- bin/omarchy-pkg-remove | 3 +- bin/omarchy-plymouth-preview | 3 + bin/omarchy-plymouth-reset | 5 +- bin/omarchy-plymouth-set | 4 + bin/omarchy-plymouth-set-by-theme | 4 + bin/omarchy-powerprofiles-init | 4 +- bin/omarchy-powerprofiles-list | 3 +- bin/omarchy-powerprofiles-set | 6 +- bin/omarchy-refresh-applications | 3 +- bin/omarchy-refresh-chromium | 2 +- bin/omarchy-refresh-config | 4 +- bin/omarchy-refresh-fastfetch | 2 +- bin/omarchy-refresh-hypridle | 2 +- bin/omarchy-refresh-hyprland | 2 +- bin/omarchy-refresh-hyprlock | 2 +- bin/omarchy-refresh-hyprsunset | 4 +- bin/omarchy-refresh-limine | 3 +- bin/omarchy-refresh-pacman | 5 +- bin/omarchy-refresh-plymouth | 3 +- bin/omarchy-refresh-sddm | 3 +- bin/omarchy-refresh-swayosd | 2 +- bin/omarchy-refresh-tmux | 2 +- bin/omarchy-refresh-walker | 3 +- bin/omarchy-refresh-waybar | 3 +- bin/omarchy-reinstall | 4 + bin/omarchy-reinstall-configs | 4 + bin/omarchy-reinstall-git | 3 + bin/omarchy-reinstall-pkgs | 4 + bin/omarchy-remove-dev-env | 5 +- bin/omarchy-remove-preinstalls | 3 +- bin/omarchy-restart-app | 4 +- bin/omarchy-restart-bluetooth | 2 +- bin/omarchy-restart-btop | 2 +- bin/omarchy-restart-hyprctl | 2 +- bin/omarchy-restart-hypridle | 2 +- bin/omarchy-restart-hyprsunset | 2 +- bin/omarchy-restart-mako | 2 +- bin/omarchy-restart-opencode | 2 +- bin/omarchy-restart-pipewire | 2 +- bin/omarchy-restart-swayosd | 2 + bin/omarchy-restart-terminal | 2 + bin/omarchy-restart-tmux | 2 +- bin/omarchy-restart-trackpad | 7 +- bin/omarchy-restart-walker | 2 + bin/omarchy-restart-waybar | 3 + bin/omarchy-restart-wifi | 2 +- bin/omarchy-restart-xcompose | 2 +- bin/omarchy-screensaver | 2 +- bin/omarchy-setup-dns | 4 + bin/omarchy-setup-fido2 | 4 + bin/omarchy-setup-fingerprint | 4 + bin/omarchy-show-done | 3 +- bin/omarchy-show-logo | 3 +- bin/omarchy-snapshot | 4 + bin/omarchy-state | 5 +- bin/omarchy-sudo-keepalive | 5 +- bin/omarchy-sudo-passwordless | 7 +- bin/omarchy-sudo-reset | 4 +- bin/omarchy-swayosd-brightness | 4 +- bin/omarchy-swayosd-client | 3 +- bin/omarchy-swayosd-kbd-brightness | 4 +- bin/omarchy-system-lock | 6 +- bin/omarchy-system-logout | 6 +- bin/omarchy-system-reboot | 5 +- bin/omarchy-system-shutdown | 5 +- bin/omarchy-theme-bg-install | 2 + bin/omarchy-theme-bg-next | 3 +- bin/omarchy-theme-bg-set | 4 +- bin/omarchy-theme-colors-from-alacritty | 3 + bin/omarchy-theme-current | 3 + bin/omarchy-theme-install | 5 +- bin/omarchy-theme-list | 3 + bin/omarchy-theme-refresh | 2 +- bin/omarchy-theme-remove | 5 +- bin/omarchy-theme-set | 4 + bin/omarchy-theme-set-browser | 2 + bin/omarchy-theme-set-gnome | 3 +- bin/omarchy-theme-set-keyboard | 2 + bin/omarchy-theme-set-keyboard-asus-rog | 2 + bin/omarchy-theme-set-keyboard-f16 | 2 + bin/omarchy-theme-set-obsidian | 2 +- bin/omarchy-theme-set-templates | 2 + bin/omarchy-theme-set-vscode | 2 +- bin/omarchy-theme-update | 2 + bin/omarchy-toggle | 3 +- bin/omarchy-toggle-enabled | 4 +- bin/omarchy-toggle-hybrid-gpu | 5 +- bin/omarchy-toggle-idle | 2 + bin/omarchy-toggle-nightlight | 4 +- bin/omarchy-toggle-notification-silencing | 2 + bin/omarchy-toggle-screensaver | 2 + bin/omarchy-toggle-suspend | 2 + bin/omarchy-toggle-touchpad | 3 + bin/omarchy-toggle-touchscreen | 5 +- bin/omarchy-toggle-waybar | 3 + bin/omarchy-tui-install | 3 + bin/omarchy-tui-remove | 3 + bin/omarchy-tui-remove-all | 3 +- bin/omarchy-tz-select | 3 + bin/omarchy-update | 5 + bin/omarchy-update-analyze-logs | 2 + bin/omarchy-update-aur-pkgs | 3 +- bin/omarchy-update-available | 3 +- bin/omarchy-update-available-reset | 3 +- bin/omarchy-update-branch | 3 + bin/omarchy-update-confirm | 2 + bin/omarchy-update-firmware | 4 +- bin/omarchy-update-git | 2 + bin/omarchy-update-keyring | 4 +- bin/omarchy-update-orphan-pkgs | 3 + bin/omarchy-update-perform | 3 + bin/omarchy-update-restart | 2 + bin/omarchy-update-system-pkgs | 3 + bin/omarchy-update-time | 3 + bin/omarchy-update-without-idle | 4 +- bin/omarchy-upload-log | 3 +- bin/omarchy-version | 3 + bin/omarchy-version-branch | 2 + bin/omarchy-version-channel | 2 + bin/omarchy-version-pkgs | 2 + bin/omarchy-voxtype-config | 3 + bin/omarchy-voxtype-install | 4 + bin/omarchy-voxtype-model | 3 + bin/omarchy-voxtype-remove | 4 + bin/omarchy-voxtype-status | 3 +- bin/omarchy-webapp-handler-hey | 4 + bin/omarchy-webapp-handler-zoom | 3 + bin/omarchy-webapp-install | 3 + bin/omarchy-webapp-remove | 3 + bin/omarchy-webapp-remove-all | 3 +- bin/omarchy-wifi-powersave | 4 + bin/omarchy-windows-vm | 5 + default/bash/completions | 53 + default/bash/init | 2 + test/omarchy-cli-test.sh | 260 +++++ 242 files changed, 2032 insertions(+), 289 deletions(-) create mode 100755 bin/omarchy create mode 100755 bin/omarchy-dev-benchmark create mode 100755 bin/omarchy-dev-bin-metadata create mode 100644 default/bash/completions create mode 100755 test/omarchy-cli-test.sh diff --git a/bin/omarchy b/bin/omarchy new file mode 100755 index 00000000..23629e72 --- /dev/null +++ b/bin/omarchy @@ -0,0 +1,1032 @@ +#!/bin/bash + +set -o pipefail + +OMARCHY_BIN_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) +METADATA_SCAN_LIMIT=80 + +COMMAND_KEYS=() +ROUTE_COLLISIONS=() +declare -A COMMAND_ROUTE +declare -A COMMAND_FALLBACK_ROUTE +declare -A COMMAND_BINARY +declare -A COMMAND_GROUP +declare -A COMMAND_NAME +declare -A COMMAND_SUMMARY +declare -A COMMAND_USAGE +declare -A COMMAND_ARGS +declare -A COMMAND_EXAMPLES +declare -A COMMAND_REQUIRES_SUDO +declare -A COMMAND_ALIASES +declare -A COMMAND_HAS_SUMMARY +declare -A COMMAND_METADATA_ERRORS +declare -A ROUTE_TO_KEY +declare -A ROUTE_IS_ALIAS +declare -A BINARY_TO_KEY +declare -A GROUP_DESCRIPTIONS + +GROUP_DESCRIPTIONS[ac]="AC power detection" +GROUP_DESCRIPTIONS[battery]="Battery status helpers" +GROUP_DESCRIPTIONS[branch]="Omarchy git branch management" +GROUP_DESCRIPTIONS[brightness]="Display and keyboard brightness" +GROUP_DESCRIPTIONS[capture]="Screenshots and screen recording" +GROUP_DESCRIPTIONS[channel]="Omarchy release channel management" +GROUP_DESCRIPTIONS[cmd]="Command and shortcut helpers" +GROUP_DESCRIPTIONS[config]="System configuration helpers" +GROUP_DESCRIPTIONS[debug]="Diagnostics and support logs" +GROUP_DESCRIPTIONS[dev]="Omarchy development tools" +GROUP_DESCRIPTIONS[drive]="Drive selection and encryption" +GROUP_DESCRIPTIONS[font]="Font management" +GROUP_DESCRIPTIONS[hibernation]="Hibernation setup and removal" +GROUP_DESCRIPTIONS[hook]="User hook runner" +GROUP_DESCRIPTIONS[hw]="Hardware detection and controls" +GROUP_DESCRIPTIONS[hyprland]="Hyprland window, monitor, and toggle controls" +GROUP_DESCRIPTIONS[install]="Optional software installers" +GROUP_DESCRIPTIONS[launch]="Application launchers" +GROUP_DESCRIPTIONS[menu]="Omarchy menu commands" +GROUP_DESCRIPTIONS[migrate]="Migration runner" +GROUP_DESCRIPTIONS[notification]="Notification helpers" +GROUP_DESCRIPTIONS[npx]="NPX package wrappers" +GROUP_DESCRIPTIONS[pkg]="Package management helpers" +GROUP_DESCRIPTIONS[plymouth]="Plymouth boot theme management" +GROUP_DESCRIPTIONS[powerprofiles]="Power profile management" +GROUP_DESCRIPTIONS[refresh]="Reset config to defaults" +GROUP_DESCRIPTIONS[reinstall]="Reinstall and reset workflows" +GROUP_DESCRIPTIONS[remove]="Removal workflows" +GROUP_DESCRIPTIONS[restart]="Restart Omarchy components" +GROUP_DESCRIPTIONS[setup]="Interactive setup wizards" +GROUP_DESCRIPTIONS[share]="Share clipboard, files, and folders" +GROUP_DESCRIPTIONS[snapshot]="System snapshots" +GROUP_DESCRIPTIONS[state]="Persistent Omarchy state" +GROUP_DESCRIPTIONS[sudo]="Sudo configuration helpers" +GROUP_DESCRIPTIONS[swayosd]="SwayOSD status display helpers" +GROUP_DESCRIPTIONS[system]="Reboot, shutdown, logout, and lock" +GROUP_DESCRIPTIONS[theme]="Theme management" +GROUP_DESCRIPTIONS[toggle]="Toggle Omarchy features" +GROUP_DESCRIPTIONS[tui]="Terminal UI launchers" +GROUP_DESCRIPTIONS[tz]="Timezone selection" +GROUP_DESCRIPTIONS[update]="Omarchy and system updates" +GROUP_DESCRIPTIONS[upload]="Upload helpers" +GROUP_DESCRIPTIONS[version]="Version and channel information" +GROUP_DESCRIPTIONS[voxtype]="Voxtype dictation" +GROUP_DESCRIPTIONS[webapp]="Web app launchers" +GROUP_DESCRIPTIONS[wifi]="Wi-Fi helpers" +GROUP_DESCRIPTIONS[windows]="Windows VM management" + +join_words() { + local separator="$1" + shift + local joined="" + + for word in "$@"; do + if [[ -z $joined ]]; then + joined="$word" + else + joined+="$separator$word" + fi + done + + printf '%s' "$joined" +} + +append_pipe_value() { + local current="$1" + local addition="$2" + + if [[ -z $current ]]; then + printf '%s' "$addition" + else + printf '%s|%s' "$current" "$addition" + fi +} + +register_route() { + local route="$1" + local key="$2" + local is_alias="${3:-false}" + + [[ -z $route || -z $key ]] && return + + if [[ -n ${ROUTE_TO_KEY[$route]} && ${ROUTE_TO_KEY[$route]} != "$key" ]]; then + ROUTE_COLLISIONS+=("$route -> ${ROUTE_TO_KEY[$route]} conflicts with $key") + return + fi + + ROUTE_TO_KEY["$route"]="$key" + if [[ $is_alias == "true" ]]; then + ROUTE_IS_ALIAS["$route"]="true" + fi +} + +register_command() { + local file="$1" + local file_binary="${file##*/}" + local group="" + local name="" + local summary="" + local usage="" + local binary="" + local args="" + local examples="" + local aliases="" + local requires_sudo="" + local line="" + local metadata_key="" + local metadata_value="" + local line_count=0 + local name_seen="false" + local fallback_summary="" + local has_summary="false" + local metadata_errors="" + + while IFS= read -r line && (( line_count < METADATA_SCAN_LIMIT )); do + line_count=$((line_count + 1)) + + if (( line_count == 1 )) && [[ $line == "#!"* ]]; then + continue + fi + + if [[ $line =~ ^[[:space:]]*$ ]]; then + continue + fi + + if [[ ! $line =~ ^[[:space:]]*# ]]; then + break + fi + + if [[ $line =~ ^[[:space:]]*#[[:space:]]*omarchy:([[:alnum:]_-]+)=(.*)$ ]]; then + metadata_key="${BASH_REMATCH[1]}" + metadata_value="${BASH_REMATCH[2]}" + metadata_value="${metadata_value%$'\r'}" + metadata_value="${metadata_value//$'\t'/ }" + + case "$metadata_key" in + group) + group="$metadata_value" + ;; + name) + name="$metadata_value" + name_seen="true" + ;; + summary) + summary="$metadata_value" + [[ -n $metadata_value ]] && has_summary="true" + ;; + args) + args="$metadata_value" + ;; + examples) + examples="$metadata_value" + ;; + alias | aliases) + aliases="$metadata_value" + ;; + requires-sudo) + requires_sudo="$metadata_value" + [[ $metadata_value == "true" ]] || metadata_errors=$(append_pipe_value "$metadata_errors" "requires-sudo must be omitted or true") + ;; + *) + ;; + esac + elif [[ -z $fallback_summary && $line =~ ^[[:space:]]*#[[:space:]]*(.+)$ ]]; then + fallback_summary="${BASH_REMATCH[1]}" + fallback_summary="${fallback_summary%$'\r'}" + fallback_summary="${fallback_summary//$'\t'/ }" + + if [[ -z $fallback_summary || $fallback_summary == omarchy:* ]]; then + fallback_summary="" + fi + fi + done <"$file" + + local stem="${file_binary#omarchy-}" + local fallback_group="$stem" + local fallback_name="" + local fallback_route="omarchy ${stem//-/ }" + + if [[ $stem == *-* ]]; then + fallback_group="${stem%%-*}" + fallback_name="${stem#*-}" + fallback_name="${fallback_name//-/ }" + fi + + [[ -z $binary ]] && binary="$file_binary" + [[ -z $group ]] && group="$fallback_group" + [[ $name_seen != "true" ]] && name="$fallback_name" + [[ -z $summary && -n $fallback_summary ]] && summary="$fallback_summary" + [[ -z $summary ]] && summary="Run the ${stem//-/ } command" + local route="omarchy $group" + if [[ -n $name ]]; then + route+=" $name" + fi + + if [[ -z $usage ]]; then + usage="$route" + if [[ -n $args ]]; then + usage+=" $args" + fi + fi + + [[ $requires_sudo == "true" ]] || requires_sudo="false" + + local key="$file_binary" + COMMAND_KEYS+=("$key") + COMMAND_ROUTE["$key"]="$route" + COMMAND_FALLBACK_ROUTE["$key"]="$fallback_route" + COMMAND_BINARY["$key"]="$binary" + COMMAND_GROUP["$key"]="$group" + COMMAND_NAME["$key"]="$name" + COMMAND_SUMMARY["$key"]="$summary" + COMMAND_USAGE["$key"]="$usage" + COMMAND_ARGS["$key"]="$args" + COMMAND_EXAMPLES["$key"]="$examples" + COMMAND_REQUIRES_SUDO["$key"]="$requires_sudo" + COMMAND_HAS_SUMMARY["$key"]="$has_summary" + COMMAND_METADATA_ERRORS["$key"]="$metadata_errors" + + BINARY_TO_KEY["$binary"]="$key" + register_route "$route" "$key" + register_route "$fallback_route" "$key" + + local old_ifs="$IFS" + local alias_route="" + IFS='|' + for alias_route in $aliases; do + alias_route="${alias_route# }" + alias_route="${alias_route% }" + [[ -z $alias_route || $alias_route == "$route" ]] && continue + register_route "$alias_route" "$key" true + COMMAND_ALIASES["$key"]=$(append_pipe_value "${COMMAND_ALIASES[$key]}" "$alias_route") + done + IFS="$old_ifs" +} + +load_commands() { + local file="" + + for file in "$OMARCHY_BIN_DIR"/omarchy-*; do + [[ -f $file && -x $file ]] || continue + register_command "$file" + done + +} + +load_command_by_binary() { + local binary="$1" + local file="$OMARCHY_BIN_DIR/$binary" + + [[ -f $file && -x $file ]] || return 1 + register_command "$file" +} + +load_child_commands_by_binary() { + local binary="$1" + local file="" + + for file in "$OMARCHY_BIN_DIR/$binary"-*; do + [[ -f $file && -x $file ]] || continue + register_command "$file" + done +} + +group_has_child_commands() { + local group="$1" + local file="" + + for file in "$OMARCHY_BIN_DIR/omarchy-$group"-*; do + [[ -f $file && -x $file ]] && return 0 + done + + return 1 +} + +group_has_binary_commands() { + local group="$1" + + [[ -x $OMARCHY_BIN_DIR/omarchy-$group ]] && return 0 + group_has_child_commands "$group" +} + +command_requires_args() { + local key="$1" + local args="${COMMAND_ARGS[$key]}" + local required="$args" + + while [[ $required =~ ^(.*)\[[^][]*\](.*)$ ]]; do + required="${BASH_REMATCH[1]}${BASH_REMATCH[2]}" + done + + required="${required// /}" + [[ -n $required ]] +} + +load_group_extra_commands() { + local group="$1" + + case "$group" in + install) + load_command_by_binary omarchy-pkg-add + ;; + system) + load_command_by_binary omarchy-lock-screen + ;; + esac +} + +load_group_commands() { + local group="$1" + local file="" + + if [[ -f $OMARCHY_BIN_DIR/omarchy-$group && -x $OMARCHY_BIN_DIR/omarchy-$group ]]; then + register_command "$OMARCHY_BIN_DIR/omarchy-$group" + fi + + for file in "$OMARCHY_BIN_DIR/omarchy-$group"-*; do + [[ -f $file && -x $file ]] || continue + register_command "$file" + done + + load_group_extra_commands "$group" +} + +resolve_direct_route() { + local argc="$1" + shift + local args=("$@") + local prefix_count=0 + local route="" + local binary="" + local candidate="" + + for (( prefix_count = argc; prefix_count >= 1; prefix_count-- )); do + route="omarchy $(join_words " " "${args[@]:0:prefix_count}")" + + binary="omarchy-$(join_words "-" "${args[@]:0:prefix_count}")" + candidate="$OMARCHY_BIN_DIR/$binary" + if [[ -f $candidate && -x $candidate ]]; then + DIRECT_RESOLVED_BINARY="$binary" + DIRECT_RESOLVED_COUNT="$prefix_count" + DIRECT_RESOLVED_ROUTE="$route" + return 0 + fi + done + + return 1 +} + +sorted_keys() { + local include_all="$1" + local key="" + + for key in "${COMMAND_KEYS[@]}"; do + printf '%s\t%s\n' "${COMMAND_ROUTE[$key]}" "$key" + done | sort -u | cut -f2- +} + +fallback_group_for_key() { + local key="$1" + local fallback="${COMMAND_FALLBACK_ROUTE[$key]#omarchy }" + + printf '%s' "${fallback%% *}" +} + +command_route_for_group() { + local key="$1" + local group="$2" + + if [[ $(fallback_group_for_key "$key") == "$group" && ${COMMAND_GROUP[$key]} != "$group" ]]; then + printf '%s' "${COMMAND_FALLBACK_ROUTE[$key]}" + else + printf '%s' "${COMMAND_ROUTE[$key]}" + fi +} + +command_usage_for_group() { + local key="$1" + local group="$2" + local route="" + + route=$(command_route_for_group "$key" "$group") + if [[ -n ${COMMAND_ARGS[$key]} ]]; then + route+=" ${COMMAND_ARGS[$key]}" + fi + + printf '%s' "$route" +} + +sorted_group_keys() { + local group="$1" + local include_all="$2" + local key="" + local fallback_group="" + local route="" + + for key in "${COMMAND_KEYS[@]}"; do + fallback_group=$(fallback_group_for_key "$key") + if [[ ${COMMAND_GROUP[$key]} != "$group" && $fallback_group != "$group" ]]; then + continue + fi + + route=$(command_route_for_group "$key" "$group") + printf '%s\t%s\n' "$route" "$key" + done | sort -u | cut -f2- +} + +examples_as_lines() { + local examples="$1" + local old_ifs="$IFS" + local example="" + IFS='|' + + for example in $examples; do + example="${example# }" + example="${example% }" + [[ -n $example ]] && printf '%s\n' "$example" + done + + IFS="$old_ifs" +} + +pipe_values_as_lines() { + local values="$1" + local old_ifs="$IFS" + local value="" + IFS='|' + + for value in $values; do + value="${value# }" + value="${value% }" + [[ -n $value ]] && printf '%s\n' "$value" + done + + IFS="$old_ifs" +} + +show_group_list() { + local sorted_group="" + + printf '%s\n' "${!GROUP_DESCRIPTIONS[@]}" | sort | while IFS= read -r sorted_group; do + [[ -n $sorted_group ]] || continue + printf ' %-14s %s\n' "$sorted_group" "${GROUP_DESCRIPTIONS[$sorted_group]}" + done +} + +show_main_help() { + cat <<'EOF' +Omarchy command center + +Usage: + omarchy [args...] + omarchy commands [--all] [--json] [--check] + omarchy --help + omarchy --help + +Common commands: + omarchy update Update Omarchy and system packages + omarchy theme list List available themes + omarchy theme set Apply a theme + omarchy font list List available fonts + omarchy capture screenshot Take a screenshot + omarchy debug Print debugging information + +Groups: +EOF + show_group_list + cat <<'EOF' + +Discovery: + omarchy commands List all commands + omarchy commands --all Include commands explicitly marked hidden + omarchy commands --json Machine-readable command list + omarchy commands --check Validate command metadata and routes + omarchy dev benchmark Measure CLI response times + omarchy dev bin metadata Show bin metadata fields and defaults +EOF +} + +show_commands_help() { + cat <<'EOF' +Usage: + omarchy commands [--all] [--json] [--markdown] [--check] + +List commands known to the Omarchy command center. + +Options: + --all Accepted for compatibility + --json Emit machine-readable JSON + --markdown Emit a Markdown command table + --check Validate command metadata and route collisions +EOF +} + +print_command_table() { + local rows="$1" + local max_width=0 + local width=0 + local command="" + local rest="" + local summary="" + + while IFS=$'\t' read -r command rest; do + [[ -n $command ]] || continue + width=${#command} + (( width > max_width )) && max_width=$width + done <<<"$rows" + + while IFS=$'\t' read -r command rest; do + [[ -n $command ]] || continue + + printf ' %-*s %s\n' "$max_width" "$command" "$rest" + done <<<"$rows" +} + +show_commands() { + local include_all="$1" + local key="" + local route="" + local usage="" + local rows="" + local alias_rows="" + + if [[ $include_all == "true" ]]; then + echo "Omarchy commands (all):" + else + echo "Omarchy commands:" + fi + + while IFS= read -r key; do + [[ -n $key ]] || continue + usage="${COMMAND_USAGE[$key]}" + rows+="$usage"$'\t'"${COMMAND_SUMMARY[$key]}"$'\n' + done < <(sorted_keys "$include_all") + + print_command_table "$rows" + + for route in "${!ROUTE_IS_ALIAS[@]}"; do + key="${ROUTE_TO_KEY[$route]}" + alias_rows+="$route"$'\t'"${COMMAND_ROUTE[$key]}"$'\n' + done + + if [[ -n $alias_rows ]]; then + echo "" + echo "Aliases:" + print_command_table "$(printf '%s' "$alias_rows" | sort)" + fi +} + +markdown_escape() { + local value="$1" + value="${value//|/\\|}" + printf '%s' "$value" +} + +show_commands_markdown() { + local include_all="$1" + local key="" + + echo "| Command | Binary | Summary |" + echo "| --- | --- | --- |" + + while IFS= read -r key; do + [[ -n $key ]] || continue + printf '| `%s` | `%s` | %s |\n' \ + "$(markdown_escape "${COMMAND_USAGE[$key]}")" \ + "$(markdown_escape "${COMMAND_BINARY[$key]}")" \ + "$(markdown_escape "${COMMAND_SUMMARY[$key]}")" + done < <(sorted_keys "$include_all") +} + +emit_command_records() { + local include_all="$1" + local key="" + + while IFS= read -r key; do + [[ -n $key ]] || continue + printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' \ + "${COMMAND_ROUTE[$key]}" \ + "${COMMAND_BINARY[$key]}" \ + "${COMMAND_GROUP[$key]}" \ + "${COMMAND_NAME[$key]}" \ + "${COMMAND_SUMMARY[$key]}" \ + "${COMMAND_REQUIRES_SUDO[$key]}" \ + "${COMMAND_ARGS[$key]}" \ + "${COMMAND_EXAMPLES[$key]}" \ + "${COMMAND_ALIASES[$key]}" \ + "${COMMAND_FALLBACK_ROUTE[$key]}" \ + "${COMMAND_USAGE[$key]}" + done < <(sorted_keys "$include_all") +} + +commands_json_filter() { + cat <<'EOF' +[inputs | split("\t") | { + route: .[0], + binary: .[1], + group: .[2], + name: .[3], + summary: .[4], + requires_sudo: (.[5] == "true"), + args: .[6], + examples: (.[7] | split("|") | map(gsub("^ +| +$"; "")) | map(select(length > 0))), + aliases: (.[8] | split("|") | map(gsub("^ +| +$"; "")) | map(select(length > 0))), + filename_route: .[9], + routes: ([.[0], .[9]] + (.[8] | split("|") | map(gsub("^ +| +$"; "")) | map(select(length > 0))) | unique) +}] | {ok: true, commands: .} +EOF +} + +show_commands_json() { + local include_all="$1" + + emit_command_records "$include_all" | jq -Rn "$(commands_json_filter)" +} + +show_commands_check() { + local failures=0 + local collision="" + local key="" + local error="" + + for collision in "${ROUTE_COLLISIONS[@]}"; do + echo "Route collision: $collision" >&2 + failures=$((failures + 1)) + done + + for key in "${COMMAND_KEYS[@]}"; do + if [[ ${COMMAND_HAS_SUMMARY[$key]} != "true" ]]; then + echo "Missing metadata summary: ${COMMAND_BINARY[$key]}" >&2 + failures=$((failures + 1)) + fi + + if [[ -n ${COMMAND_METADATA_ERRORS[$key]} ]]; then + while IFS= read -r error; do + [[ -n $error ]] || continue + echo "Invalid metadata in ${COMMAND_BINARY[$key]}: $error" >&2 + failures=$((failures + 1)) + done < <(pipe_values_as_lines "${COMMAND_METADATA_ERRORS[$key]}") + fi + + if [[ ! -x $OMARCHY_BIN_DIR/${COMMAND_BINARY[$key]} ]]; then + echo "Missing binary: ${COMMAND_BINARY[$key]}" >&2 + failures=$((failures + 1)) + fi + done + + if (( failures > 0 )); then + echo "Command metadata check failed ($failures issues)" >&2 + return 1 + fi + + echo "Command metadata check passed (${#COMMAND_KEYS[@]} commands)" +} + +show_command_json() { + local key="$1" + + printf '%s\n' "$key" | while IFS= read -r key; do + printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' \ + "${COMMAND_ROUTE[$key]}" \ + "${COMMAND_BINARY[$key]}" \ + "${COMMAND_GROUP[$key]}" \ + "${COMMAND_NAME[$key]}" \ + "${COMMAND_SUMMARY[$key]}" \ + "${COMMAND_REQUIRES_SUDO[$key]}" \ + "${COMMAND_ARGS[$key]}" \ + "${COMMAND_EXAMPLES[$key]}" \ + "${COMMAND_ALIASES[$key]}" \ + "${COMMAND_FALLBACK_ROUTE[$key]}" \ + "${COMMAND_USAGE[$key]}" + done | jq -Rn "$(commands_json_filter) | {ok: true, command: .commands[0]}" +} + +parse_commands_args() { + local include_all="false" + local json="false" + local markdown="false" + local check="false" + + shift + + while (( $# > 0 )); do + case "$1" in + --all) + include_all="true" + ;; + --json) + json="true" + ;; + --markdown) + markdown="true" + ;; + --check) + check="true" + ;; + --help | -h) + show_commands_help + return 0 + ;; + *) + echo "Unknown option for omarchy commands: $1" >&2 + show_commands_help >&2 + return 2 + ;; + esac + shift + done + + if [[ $check == "true" ]]; then + show_commands_check + elif [[ $json == "true" ]]; then + show_commands_json "$include_all" + elif [[ $markdown == "true" ]]; then + show_commands_markdown "$include_all" + else + show_commands "$include_all" + fi +} + +group_exists() { + local group="$1" + local key="" + + for key in "${COMMAND_KEYS[@]}"; do + if [[ ${COMMAND_GROUP[$key]} == "$group" && -n ${COMMAND_NAME[$key]} ]]; then + return 0 + fi + done + + return 1 +} + +show_group_help() { + local group="$1" + local include_all="${2:-false}" + local key="" + local rows="" + local title="${GROUP_DESCRIPTIONS[$group]}" + + if [[ -n $title ]]; then + echo "${group^} commands — $title:" + else + echo "${group^} commands:" + fi + + while IFS= read -r key; do + [[ -n $key ]] || continue + rows+="$(command_usage_for_group "$key" "$group")"$'\t'$'\t'"${COMMAND_SUMMARY[$key]}"$'\n' + done < <(sorted_group_keys "$group" "$include_all") + + if [[ -n $rows ]]; then + print_command_table "$rows" + else + echo " No documented commands found. Try: omarchy commands --all" + fi +} + +show_related_commands() { + local key="$1" + local group="${COMMAND_GROUP[$key]}" + local child_key="" + local rows="" + + [[ -z ${COMMAND_NAME[$key]} ]] || return + + while IFS= read -r child_key; do + [[ -n $child_key && $child_key != "$key" ]] || continue + rows+="$(command_usage_for_group "$child_key" "$group")"$'\t'$'\t'"${COMMAND_SUMMARY[$child_key]}"$'\n' + done < <(sorted_group_keys "$group" false) + + if [[ -n $rows ]]; then + echo "" + echo "Related commands:" + print_command_table "$rows" + fi +} + +show_command_help() { + local key="$1" + local aliases="${COMMAND_ALIASES[$key]}" + local examples="${COMMAND_EXAMPLES[$key]}" + local args="${COMMAND_ARGS[$key]}" + local example="" + local alias="" + + echo "Usage:" + echo " ${COMMAND_USAGE[$key]}" + echo "" + echo "${COMMAND_SUMMARY[$key]}" + + if [[ -n $args ]]; then + echo "" + echo "Arguments:" + echo " $args" + fi + + if [[ -n $examples ]]; then + echo "" + echo "Examples:" + while IFS= read -r example; do + printf ' %s\n' "$example" + done < <(examples_as_lines "$examples") + fi + + if [[ -n $aliases ]]; then + echo "" + echo "Aliases:" + while IFS= read -r alias; do + printf ' %s\n' "$alias" + done < <(pipe_values_as_lines "$aliases") + fi + + echo "" + echo "Binary:" + echo " ${COMMAND_BINARY[$key]}" + + if [[ ${COMMAND_FALLBACK_ROUTE[$key]} != "${COMMAND_ROUTE[$key]}" ]]; then + echo "" + echo "Filename route:" + echo " ${COMMAND_FALLBACK_ROUTE[$key]}" + fi + + show_related_commands "$key" +} + +resolve_route() { + local argc="$1" + shift + local args=("$@") + local prefix_count=0 + local route="" + local key="" + + for (( prefix_count = argc; prefix_count >= 1; prefix_count-- )); do + route="omarchy $(join_words " " "${args[@]:0:prefix_count}")" + key="${ROUTE_TO_KEY[$route]}" + + if [[ -n $key ]]; then + RESOLVED_KEY="$key" + RESOLVED_COUNT="$prefix_count" + RESOLVED_ROUTE="$route" + return 0 + fi + done + + return 1 +} + +suggest_command() { + local first="$1" + local candidate="" + + for candidate in "${!ROUTE_TO_KEY[@]}"; do + candidate="${candidate#omarchy }" + if [[ $candidate == "$first"* ]]; then + printf '%s' "${candidate%% *}" + return 0 + fi + done + + return 1 +} + +dispatch_fast_or_help() { + local args=("$@") + local remaining=() + local key="" + local binary_path="" + + if resolve_direct_route "$#" "${args[@]}"; then + remaining=("${args[@]:DIRECT_RESOLVED_COUNT}") + binary_path="$OMARCHY_BIN_DIR/$DIRECT_RESOLVED_BINARY" + + if (( ${#remaining[@]} > 0 )) && [[ ${remaining[0]} == "--help" || ${remaining[0]} == "-h" ]]; then + if ! load_command_by_binary "$DIRECT_RESOLVED_BINARY"; then + echo "Binary is missing or not executable: $DIRECT_RESOLVED_BINARY" >&2 + return 127 + fi + + if (( DIRECT_RESOLVED_COUNT == 1 )); then + load_child_commands_by_binary "$DIRECT_RESOLVED_BINARY" + fi + + key="${BINARY_TO_KEY[$DIRECT_RESOLVED_BINARY]}" + if [[ " ${remaining[*]} " == *" --json "* ]]; then + show_command_json "$key" + else + show_command_help "$key" + fi + return 0 + fi + + if (( ${#remaining[@]} == 0 )); then + load_command_by_binary "$DIRECT_RESOLVED_BINARY" + key="${BINARY_TO_KEY[$DIRECT_RESOLVED_BINARY]}" + + if [[ -n $key ]] && command_requires_args "$key"; then + if (( DIRECT_RESOLVED_COUNT == 1 )) && group_has_child_commands "$1"; then + load_group_commands "$1" + show_group_help "$1" + else + show_command_help "$key" + fi + return 0 + fi + fi + + exec "$binary_path" "${remaining[@]}" + fi + + if (( $# == 1 )) && group_has_binary_commands "$1"; then + load_group_commands "$1" + show_group_help "$1" + return 0 + fi + + if (( $# >= 2 )) && [[ $2 == "--help" || $2 == "-h" ]] && group_has_binary_commands "$1"; then + load_group_commands "$1" + show_group_help "$1" + return 0 + fi + + load_commands + dispatch_or_help "$@" +} + +dispatch_or_help() { + local args=("$@") + local remaining=() + local key="" + local binary_path="" + local suggestion="" + + if resolve_route "$#" "${args[@]}"; then + key="$RESOLVED_KEY" + remaining=("${args[@]:RESOLVED_COUNT}") + + if (( ${#remaining[@]} > 0 )) && [[ ${remaining[0]} == "--help" || ${remaining[0]} == "-h" ]]; then + if [[ " ${remaining[*]} " == *" --json "* ]]; then + show_command_json "$key" + else + show_command_help "$key" + fi + return 0 + fi + + binary_path="$OMARCHY_BIN_DIR/${COMMAND_BINARY[$key]}" + if [[ ! -x $binary_path ]]; then + echo "Binary is missing or not executable: ${COMMAND_BINARY[$key]}" >&2 + return 127 + fi + + if (( ${#remaining[@]} == 0 )) && command_requires_args "$key"; then + if (( RESOLVED_COUNT == 1 )) && group_exists "$1"; then + show_group_help "$1" + else + show_command_help "$key" + fi + return 0 + fi + + exec "$binary_path" "${remaining[@]}" + fi + + if (( $# == 1 )) && group_exists "$1"; then + show_group_help "$1" + return 0 + fi + + if (( $# >= 2 )) && [[ $2 == "--help" || $2 == "-h" ]] && group_exists "$1"; then + show_group_help "$1" + return 0 + fi + + echo "Unknown Omarchy command: omarchy ${args[*]}" >&2 + suggestion=$(suggest_command "${args[0]}") + if [[ -n $suggestion ]]; then + echo "Did you mean: omarchy $suggestion ?" >&2 + fi + echo "Run 'omarchy commands --all' to discover available commands." >&2 + return 127 +} + +main() { + if (( $# == 0 )); then + show_main_help + return 0 + fi + + case "$1" in + --help | -h) + show_main_help + ;; + commands) + load_commands + parse_commands_args "$@" + ;; + *) + dispatch_fast_or_help "$@" + ;; + esac +} + +main "$@" diff --git a/bin/omarchy-ac-present b/bin/omarchy-ac-present index a2f632a9..df205ae8 100755 --- a/bin/omarchy-ac-present +++ b/bin/omarchy-ac-present @@ -1,6 +1,6 @@ #!/bin/bash -# Returns true if AC power is connected. +# omarchy:summary=Returns true if AC power is connected. for ac in /sys/class/power_supply/AC* /sys/class/power_supply/ADP*; do [[ -r $ac/online && $(cat "$ac/online") == "1" ]] && exit 0 diff --git a/bin/omarchy-audio-input-mute b/bin/omarchy-audio-input-mute index c7577b2d..c0ab990c 100755 --- a/bin/omarchy-audio-input-mute +++ b/bin/omarchy-audio-input-mute @@ -1,6 +1,6 @@ #!/bin/bash -# Toggle microphone mute. Dell XPS and ThinkPad systems get special handling for the hardware LED. +# omarchy:summary=Toggle microphone mute. Dell XPS and ThinkPad systems get special handling for the hardware LED. if omarchy-hw-match "XPS"; then omarchy-audio-input-mute-xps diff --git a/bin/omarchy-audio-input-mute-thinkpad b/bin/omarchy-audio-input-mute-thinkpad index 2b8a6f74..d06c4cf6 100755 --- a/bin/omarchy-audio-input-mute-thinkpad +++ b/bin/omarchy-audio-input-mute-thinkpad @@ -1,7 +1,6 @@ #!/bin/bash -# Toggle microphone mute on ThinkPad systems. Uses wpctl for reliable toggling -# and syncs the platform::micmute LED via brightnessctl. +# omarchy:summary=Toggle microphone mute on ThinkPad systems. Uses wpctl for reliable toggling wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle >/dev/null diff --git a/bin/omarchy-audio-input-mute-xps b/bin/omarchy-audio-input-mute-xps index 16b2da19..85d1cbb5 100755 --- a/bin/omarchy-audio-input-mute-xps +++ b/bin/omarchy-audio-input-mute-xps @@ -1,7 +1,6 @@ #!/bin/bash -# Toggle microphone mute on Dell XPS systems. Uses wpctl for reliable toggling -# and syncs the ALSA capture switch so the hardware mic mute LED follows state. +# omarchy:summary=Toggle microphone mute on Dell XPS systems. Uses wpctl for reliable toggling wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle >/dev/null diff --git a/bin/omarchy-audio-output-switch b/bin/omarchy-audio-output-switch index 7d1ea015..f5f94d44 100755 --- a/bin/omarchy-audio-output-switch +++ b/bin/omarchy-audio-output-switch @@ -1,6 +1,6 @@ #!/bin/bash -# Switch between audio outputs while preserving the mute status. By default mapped to Super + Mute. +# omarchy:summary=Switch between audio outputs while preserving the mute status. By default mapped to Super + Mute. sinks=$(pactl -f json list sinks | jq '[.[] | select((.ports | length == 0) or ([.ports[]? | .availability != "not available"] | any))]') sinks_count=$(echo "$sinks" | jq '. | length') diff --git a/bin/omarchy-battery-capacity b/bin/omarchy-battery-capacity index fa4b4c03..10e54794 100755 --- a/bin/omarchy-battery-capacity +++ b/bin/omarchy-battery-capacity @@ -1,7 +1,6 @@ #!/bin/bash -# Returns the battery full capacity in Wh (rounded to whole number). -# Used by omarchy-battery-status for displaying battery capacity. +# omarchy:summary=Returns the battery full capacity in Wh (rounded to whole number). battery_info=$(upower -i $(upower -e | grep BAT)) diff --git a/bin/omarchy-battery-monitor b/bin/omarchy-battery-monitor index 6b348b11..63b33277 100755 --- a/bin/omarchy-battery-monitor +++ b/bin/omarchy-battery-monitor @@ -1,6 +1,6 @@ #!/bin/bash -# Designed to be run by systemd timer every 30 seconds and alerts if battery is low +# omarchy:summary=Designed to be run by systemd timer every 30 seconds and alerts if battery is low BATTERY_THRESHOLD=10 NOTIFICATION_FLAG="/run/user/$UID/omarchy_battery_notified" diff --git a/bin/omarchy-battery-present b/bin/omarchy-battery-present index 2b052a7a..fb221e8c 100755 --- a/bin/omarchy-battery-present +++ b/bin/omarchy-battery-present @@ -1,7 +1,6 @@ #!/bin/bash -# Returns true if a battery is present on the system. -# Used by the battery monitor and other battery-related checks. +# omarchy:summary=Returns true if a battery is present on the system. for bat in /sys/class/power_supply/BAT*; do [[ -r $bat/present ]] && diff --git a/bin/omarchy-battery-remaining b/bin/omarchy-battery-remaining index 26ea718f..d9b451f2 100755 --- a/bin/omarchy-battery-remaining +++ b/bin/omarchy-battery-remaining @@ -1,7 +1,6 @@ #!/bin/bash -# Returns the battery percentage remaining as an integer. -# Used by the battery monitor and the Ctrl + Shift + Super + B hotkey. +# omarchy:summary=Returns the battery percentage remaining as an integer. upower -i $(upower -e | grep BAT) | awk '/percentage/ { print int($2) diff --git a/bin/omarchy-battery-remaining-time b/bin/omarchy-battery-remaining-time index c4f39593..7aa77b11 100755 --- a/bin/omarchy-battery-remaining-time +++ b/bin/omarchy-battery-remaining-time @@ -1,6 +1,6 @@ #!/bin/bash -# Returns the battery time remaining (to empty or full) in a compact format. +# omarchy:summary=Returns the battery time remaining (to empty or full) in a compact format. battery_info=$(upower -i $(upower -e | grep BAT)) diff --git a/bin/omarchy-battery-status b/bin/omarchy-battery-status index 021c0aa4..0390df1f 100755 --- a/bin/omarchy-battery-status +++ b/bin/omarchy-battery-status @@ -1,7 +1,6 @@ #!/bin/bash -# Returns a formatted battery status string with percentage and power draw/charge. -# Used by the battery notification hotkey (Ctrl + Shift + Super + B). +# omarchy:summary=Returns a formatted battery status string with percentage and power draw/charge. battery_info=$(upower -i $(upower -e | grep BAT)) diff --git a/bin/omarchy-branch-set b/bin/omarchy-branch-set index 87d19bda..931bca25 100755 --- a/bin/omarchy-branch-set +++ b/bin/omarchy-branch-set @@ -1,6 +1,7 @@ #!/bin/bash -# Set the branch for Omarchy's git repository. +# omarchy:summary=Set the branch for Omarchy's git repository. +# omarchy:args= if (($# == 0)); then echo "Usage: omarchy-branch-set [master|rc|dev]" diff --git a/bin/omarchy-brightness-display b/bin/omarchy-brightness-display index c7048568..7c421737 100755 --- a/bin/omarchy-brightness-display +++ b/bin/omarchy-brightness-display @@ -1,7 +1,7 @@ #!/bin/bash -# Adjust brightness on the most likely display device. -# Usage: omarchy-brightness-display +# omarchy:summary=Adjust brightness on the most likely display device. +# omarchy:args= step="${1:-+5%}" diff --git a/bin/omarchy-brightness-display-apple b/bin/omarchy-brightness-display-apple index 64006820..71b297ea 100755 --- a/bin/omarchy-brightness-display-apple +++ b/bin/omarchy-brightness-display-apple @@ -1,6 +1,7 @@ #!/bin/bash -# Adjust the brightness on Apple Studio Displays and Apple XDR Displays using asdcontrol. +# omarchy:summary=Adjust the brightness on Apple Studio Displays and Apple XDR Displays using asdcontrol. +# omarchy:requires-sudo=true if (( $# == 0 )); then echo "Adjust Apple Display Brightness by passing +5000 or -5000 (or any range from 0-60000)" diff --git a/bin/omarchy-brightness-keyboard b/bin/omarchy-brightness-keyboard index 7e7e738b..f161da47 100755 --- a/bin/omarchy-brightness-keyboard +++ b/bin/omarchy-brightness-keyboard @@ -1,7 +1,7 @@ #!/bin/bash -# Adjust keyboard backlight brightness using available steps. -# Usage: omarchy-brightness-keyboard +# omarchy:summary=Adjust keyboard backlight brightness using available steps. +# omarchy:args= direction="${1:-up}" diff --git a/bin/omarchy-capture-screenrecording b/bin/omarchy-capture-screenrecording index f07914ca..68af8d63 100755 --- a/bin/omarchy-capture-screenrecording +++ b/bin/omarchy-capture-screenrecording @@ -1,9 +1,10 @@ #!/bin/bash -# Start and stop a screenrecording, which will be saved to ~/Videos by default. -# Alternative location can be set via OMARCHY_SCREENRECORD_DIR or XDG_VIDEOS_DIR ENVs. -# Resolution is capped to 4K for monitors above 4K, native otherwise. -# Override via --resolution= (e.g. --resolution=1920x1080, --resolution=0x0 for native). +# omarchy:summary=Start or stop screen recording +# omarchy:group=capture +# omarchy:args=[--with-desktop-audio] [--with-microphone-audio] [--with-webcam] [--webcam-device=] [--resolution=] [--stop-recording] +# omarchy:examples=omarchy screenrecord | omarchy capture screenrecord --with-desktop-audio +# omarchy:aliases=omarchy screenrecord [[ -f ~/.config/user-dirs.dirs ]] && source ~/.config/user-dirs.dirs OUTPUT_DIR="${OMARCHY_SCREENRECORD_DIR:-${XDG_VIDEOS_DIR:-$HOME/Videos}}" diff --git a/bin/omarchy-capture-screenshot b/bin/omarchy-capture-screenshot index 99e2976a..627eda07 100755 --- a/bin/omarchy-capture-screenshot +++ b/bin/omarchy-capture-screenshot @@ -1,8 +1,10 @@ #!/bin/bash -# Take a screenshot of the whole screen, a specific window, or a user-drawn region. -# Saves to ~/Pictures by default, but that can be changed via OMARCHY_SCREENSHOT_DIR or XDG_PICTURES_DIR ENVs. -# Editor defaults to Satty but can be changed via --editor= or OMARCHY_SCREENSHOT_EDITOR env +# omarchy:summary=Take a screenshot +# omarchy:group=capture +# omarchy:args=[smart|region|windows|fullscreen] [slurp|copy] [--editor=] +# omarchy:examples=omarchy screenshot | omarchy capture screenshot region +# omarchy:aliases=omarchy screenshot [[ -f ~/.config/user-dirs.dirs ]] && source ~/.config/user-dirs.dirs OUTPUT_DIR="${OMARCHY_SCREENSHOT_DIR:-${XDG_PICTURES_DIR:-$HOME/Pictures}}" diff --git a/bin/omarchy-channel-set b/bin/omarchy-channel-set index 8494f973..b6c15d71 100755 --- a/bin/omarchy-channel-set +++ b/bin/omarchy-channel-set @@ -1,17 +1,8 @@ #!/bin/bash -# Set the Omarchy channel, which dictates what git branch and package repository is used. -# -# Stable uses the master branch, which only sees updates on official releases, and -# the stable package repository, which typically lags the edge by a month to ensure -# better compatibility. -# -# Edge tracks the latest package repository, but still relies on the master branch, -# so new packages which require config changes may cause conflicts or errors. -# -# Dev tracks the active development dev branch, which may include partial or broken updates, -# as well as the latest package repository. This should only be used by Omarchy developers -# and people with a lot of experience managing Linux systems. +# omarchy:summary=Set the Omarchy channel, which dictates what git branch and package repository is used. +# omarchy:args= +# omarchy:requires-sudo=true if (($# == 0)); then echo "Usage: omarchy-channel-set [stable|rc|edge|dev]" diff --git a/bin/omarchy-cmd-missing b/bin/omarchy-cmd-missing index 6f14ec29..470d69c3 100755 --- a/bin/omarchy-cmd-missing +++ b/bin/omarchy-cmd-missing @@ -1,6 +1,6 @@ #!/bin/bash -# Returns true if any of the commands passed in as arguments are missing on the system. +# omarchy:summary=Check whether any required commands are missing for cmd in "$@"; do if ! command -v "$cmd" &>/dev/null; then diff --git a/bin/omarchy-cmd-present b/bin/omarchy-cmd-present index f1e96be2..4e758760 100755 --- a/bin/omarchy-cmd-present +++ b/bin/omarchy-cmd-present @@ -1,6 +1,6 @@ #!/bin/bash -# Returns true if all the commands passed in as arguments exit on the system. +# omarchy:summary=Check whether all required commands are available for cmd in "$@"; do command -v "$cmd" &>/dev/null || exit 1 diff --git a/bin/omarchy-cmd-terminal-cwd b/bin/omarchy-cmd-terminal-cwd index 81fb91c2..d0f731a4 100755 --- a/bin/omarchy-cmd-terminal-cwd +++ b/bin/omarchy-cmd-terminal-cwd @@ -1,9 +1,7 @@ #!/bin/bash -# Returns the current working directory of the active terminal window, -# so a new terminal window can be started in the same directory. +# omarchy:summary=Print the current working directory of the active terminal window -# Go from current active terminal to its child shell process and run cwd there terminal_pid=$(hyprctl activewindow | awk '/pid:/ {print $2}') shell_pid=$(pgrep -P "$terminal_pid" | tail -n1) diff --git a/bin/omarchy-config-direct-boot b/bin/omarchy-config-direct-boot index 50f3ba62..ebd618b9 100755 --- a/bin/omarchy-config-direct-boot +++ b/bin/omarchy-config-direct-boot @@ -1,7 +1,7 @@ #!/bin/bash -# Add or remove an EFI boot entry for the Omarchy UKI, allowing the system to boot directly -# without a bootloader like Limine. Requires UEFI firmware and a built UKI. +# omarchy:summary=Add or remove an EFI boot entry for the Omarchy UKI, allowing the system to boot directly +# omarchy:requires-sudo=true if [[ ! -d /sys/firmware/efi ]]; then echo "Error: System is not booted in UEFI mode" >&2 diff --git a/bin/omarchy-debug b/bin/omarchy-debug index 23b6630d..830caa1b 100755 --- a/bin/omarchy-debug +++ b/bin/omarchy-debug @@ -1,6 +1,9 @@ #!/bin/bash -# Return exhaustive debugging information about the system to help diagnose problems. +# omarchy:summary=Print debugging information +# omarchy:args=[--no-sudo] [--print] +# omarchy:examples=omarchy debug --print --no-sudo +# omarchy:requires-sudo=true NO_SUDO=false PRINT_ONLY=false diff --git a/bin/omarchy-dev-add-migration b/bin/omarchy-dev-add-migration index 3ca47a2f..bff94502 100755 --- a/bin/omarchy-dev-add-migration +++ b/bin/omarchy-dev-add-migration @@ -1,7 +1,6 @@ #!/bin/bash -# Creates a new Omarchy migration named after the unix timestamp of the last commit. -# Only intended for Omarchy developers. +# omarchy:summary=Creates a new Omarchy migration named after the unix timestamp of the last commit. cd ~/.local/share/omarchy migration_file="$HOME/.local/share/omarchy/migrations/$(git log -1 --format=%cd --date=unix).sh" diff --git a/bin/omarchy-dev-benchmark b/bin/omarchy-dev-benchmark new file mode 100755 index 00000000..1108e798 --- /dev/null +++ b/bin/omarchy-dev-benchmark @@ -0,0 +1,111 @@ +#!/bin/bash + +# omarchy:summary=Measure Omarchy CLI response times +# omarchy:args=[--repeat=] +# omarchy:examples=omarchy dev benchmark | omarchy dev benchmark --repeat=10 + +set -euo pipefail + +OMARCHY_BIN_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) +CLI="$OMARCHY_BIN_DIR/omarchy" +REPEAT=5 + +show_help() { + cat <<'EOF' +Usage: + omarchy dev benchmark [--repeat=] + +Measure response times for common Omarchy CLI surfaces. + +Options: + --repeat= Number of times to run each case (default: 5) +EOF +} + +now_us() { + local now="${EPOCHREALTIME/./}" + printf '%s' "$now" +} + +format_ms() { + local us="$1" + printf '%d.%03d' "$(( us / 1000 ))" "$(( us % 1000 ))" +} + +run_case() { + local label="$1" + shift + local total_us=0 + local min_us=0 + local max_us=0 + local elapsed_us=0 + local start_us=0 + local end_us=0 + local status=0 + + for (( i = 1; i <= REPEAT; i++ )); do + start_us=$(now_us) + if "$@" >/dev/null; then + status=0 + else + status=$? + fi + end_us=$(now_us) + + if (( status != 0 )); then + printf '%-34s failed (exit %d)\n' "$label" "$status" + return "$status" + fi + + elapsed_us=$(( end_us - start_us )) + total_us=$(( total_us + elapsed_us )) + + if (( i == 1 || elapsed_us < min_us )); then + min_us=$elapsed_us + fi + + if (( elapsed_us > max_us )); then + max_us=$elapsed_us + fi + done + + printf '%-34s avg %8s ms min %8s ms max %8s ms\n' \ + "$label" \ + "$(format_ms "$(( total_us / REPEAT ))")" \ + "$(format_ms "$min_us")" \ + "$(format_ms "$max_us")" +} + +while (( $# > 0 )); do + case "$1" in + --repeat=*) + REPEAT="${1#*=}" + ;; + --help | -h) + show_help + exit 0 + ;; + *) + echo "Unknown option: $1" >&2 + show_help >&2 + exit 2 + ;; + esac + shift +done + +if [[ ! $REPEAT =~ ^[0-9]+$ ]] || (( REPEAT < 1 )); then + echo "--repeat must be a positive integer" >&2 + exit 2 +fi + +printf 'Omarchy CLI benchmark (%d runs each)\n\n' "$REPEAT" +run_case "omarchy" "$CLI" +run_case "omarchy --help" "$CLI" --help +run_case "omarchy commands" "$CLI" commands +run_case "omarchy commands --json" "$CLI" commands --json +run_case "omarchy commands --all --json" "$CLI" commands --all --json +run_case "omarchy theme set --help" "$CLI" theme set --help +run_case "omarchy screenshot --help" "$CLI" screenshot --help +run_case "omarchy restart --help" "$CLI" restart --help +run_case "omarchy theme current" "$CLI" theme current diff --git a/bin/omarchy-dev-bin-metadata b/bin/omarchy-dev-bin-metadata new file mode 100755 index 00000000..c63667b9 --- /dev/null +++ b/bin/omarchy-dev-bin-metadata @@ -0,0 +1,86 @@ +#!/bin/bash + +# omarchy:summary=Show Omarchy bin metadata fields and defaults +# omarchy:args=[--json] + +set -euo pipefail + +show_json() { + jq -n '{ + ok: true, + defaults: { + group: "first filename segment after omarchy-", + name: "remaining filename segments with dashes converted to spaces", + route: "omarchy ", + binary: "filename", + requires_sudo: false + }, + fields: [ + {name: "summary", required: true, type: "string", note: "One-line human and agent-facing description."}, + {name: "group", required: false, type: "string", note: "Only set when the route group should differ from the filename-derived group."}, + {name: "name", required: false, type: "string", note: "Only set when the route name should differ from the filename-derived name. May be empty for root commands."}, + {name: "args", required: false, type: "string", note: "Only set when the command accepts arguments."}, + {name: "examples", required: false, type: "string", note: "Pipe-separated examples."}, + {name: "aliases", required: false, type: "string", note: "Pipe-separated alternate routes, e.g. omarchy screenshot."}, + {name: "requires-sudo", required: false, type: "true", default: false, note: "Only include when true."} + ] + }' +} + +show_help() { + cat <<'EOF' +Omarchy bin metadata + +Metadata lives in the top comment block of each executable bin/omarchy-* file. +Keep it slim: define only fields that are required or override defaults. + +Required: + # omarchy:summary= + +Inferred defaults: + group first filename segment after omarchy- + name remaining filename segments, with dashes converted to spaces + route omarchy + binary filename + requires-sudo false + +Optional fields: + # omarchy:group= route override only + # omarchy:name= route override only; may be empty + # omarchy:args= only if the command accepts args + # omarchy:examples= | pipe-separated examples + # omarchy:aliases= | pipe-separated alternate routes + # omarchy:requires-sudo=true only when true + +Do not define: + binary inferred from filename + usage derived from route + args + false flags or empty args + +Examples: + # omarchy:summary=Restart Walker and related user services + + # omarchy:summary=Take a screenshot + # omarchy:group=capture + # omarchy:args=[smart|region|windows|fullscreen] [slurp|copy] [--editor=] + # omarchy:examples=omarchy screenshot | omarchy capture screenshot region + # omarchy:aliases=omarchy screenshot +EOF +} + +case "${1:-}" in +--json) + show_json + ;; +--help | -h) + show_help + ;; +"") + show_help + ;; +*) + echo "Unknown option: $1" >&2 + show_help >&2 + exit 2 + ;; +esac diff --git a/bin/omarchy-drive-info b/bin/omarchy-drive-info index 4943975d..88793c6a 100755 --- a/bin/omarchy-drive-info +++ b/bin/omarchy-drive-info @@ -1,6 +1,7 @@ #!/bin/bash -# Returns drive information about a given volumne, like /dev/nvme0, which is used by omarchy-drive-select. +# omarchy:summary=Print drive information such as size, model, and mount details +# omarchy:args= if (($# == 0)); then echo "Usage: omarchy-drive-info [/dev/drive]" diff --git a/bin/omarchy-drive-select b/bin/omarchy-drive-select index 14afcc22..117cde4d 100755 --- a/bin/omarchy-drive-select +++ b/bin/omarchy-drive-select @@ -1,6 +1,6 @@ #!/bin/bash -# Select a drive from a list with info that includes space and brand. Used by omarchy-drive-set-password. +# omarchy:summary=Select a drive from a list with info that includes space and brand. Used by omarchy-drive-set-password. if (($# == 0)); then drives=$(lsblk -dpno NAME | grep -E '/dev/(sd|hd|vd|nvme|mmcblk|xv)') diff --git a/bin/omarchy-drive-set-password b/bin/omarchy-drive-set-password index cac42d58..3fdf9b08 100755 --- a/bin/omarchy-drive-set-password +++ b/bin/omarchy-drive-set-password @@ -1,6 +1,7 @@ #!/bin/bash -# Set a new encryption password for a drive selected. +# omarchy:summary=Set a new encryption password for a drive selected. +# omarchy:requires-sudo=true encrypted_drives=$(blkid -t TYPE=crypto_LUKS -o device) diff --git a/bin/omarchy-first-run b/bin/omarchy-first-run index 67a0c321..909e9210 100755 --- a/bin/omarchy-first-run +++ b/bin/omarchy-first-run @@ -1,6 +1,7 @@ #!/bin/bash -# Finish the installation of Omarchy with items that can only be done after logging in. +# omarchy:summary=Finish the installation of Omarchy with items that can only be done after logging in. +# omarchy:requires-sudo=true set -e diff --git a/bin/omarchy-font-current b/bin/omarchy-font-current index dfb3ddd6..ead8c3a3 100755 --- a/bin/omarchy-font-current +++ b/bin/omarchy-font-current @@ -1,6 +1,6 @@ #!/bin/bash -# Returns the name of the current monospace font being used by extracting it from the Waybar stylesheet. -# This can be changed using omarchy-font-set. +# omarchy:summary=Show current monospace font +# omarchy:examples=omarchy font current grep -oP 'font-family:\s*["'\'']?\K[^;"'\'']+' ~/.config/waybar/style.css | head -n1 diff --git a/bin/omarchy-font-list b/bin/omarchy-font-list index f2bc5e53..a79a3464 100755 --- a/bin/omarchy-font-list +++ b/bin/omarchy-font-list @@ -1,5 +1,6 @@ #!/bin/bash -# Returns a list of all the monospace fonts available on the system that can be set using omarchy-font-set. +# omarchy:summary=List available monospace fonts +# omarchy:examples=omarchy font list | omarchy font set "CaskaydiaMono Nerd Font" fc-list :spacing=100 -f "%{family[0]}\n" | grep -v -i -E 'emoji|signwriting|omarchy' | sort -u diff --git a/bin/omarchy-font-set b/bin/omarchy-font-set index 6b5bf190..2327d341 100755 --- a/bin/omarchy-font-set +++ b/bin/omarchy-font-set @@ -1,7 +1,8 @@ #!/bin/bash -# Set the system-wide monospace font that should be used by the terminal, hyprlock, waybar, swayosd, etc. -# The font name must be one of the ones returned by omarchy-font-list. +# omarchy:summary=Set the system monospace font +# omarchy:args= +# omarchy:examples=omarchy font list | omarchy font set "CaskaydiaMono Nerd Font" font_name="$1" diff --git a/bin/omarchy-haptic-touchpad b/bin/omarchy-haptic-touchpad index f0240116..a98bd90a 100755 --- a/bin/omarchy-haptic-touchpad +++ b/bin/omarchy-haptic-touchpad @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +# omarchy:summary=Run the Synaptics touchpad haptic feedback daemon + """Haptic feedback daemon for Synaptics touchpads with Manual Trigger. Monitors touchpad button press events and sends haptic pulses via HID diff --git a/bin/omarchy-hibernation-available b/bin/omarchy-hibernation-available index 32be61b6..701a8f72 100755 --- a/bin/omarchy-hibernation-available +++ b/bin/omarchy-hibernation-available @@ -1,6 +1,7 @@ #!/bin/bash -# Check if hibernation is supported +# omarchy:summary=Check if hibernation is supported + if [[ ! -f /sys/power/image_size ]]; then exit 1 fi diff --git a/bin/omarchy-hibernation-remove b/bin/omarchy-hibernation-remove index 2901a88a..49bad5bd 100755 --- a/bin/omarchy-hibernation-remove +++ b/bin/omarchy-hibernation-remove @@ -1,7 +1,7 @@ #!/bin/bash -# Removes hibernation setup: disables swap, removes swapfile, removes fstab entry, -# removes resume hook, and removes suspend-then-hibernate configuration. +# omarchy:summary=Remove hibernation setup including swap and boot resume settings +# omarchy:requires-sudo=true MKINITCPIO_CONF="/etc/mkinitcpio.conf.d/omarchy_resume.conf" diff --git a/bin/omarchy-hibernation-setup b/bin/omarchy-hibernation-setup index 482e5470..d88978d4 100755 --- a/bin/omarchy-hibernation-setup +++ b/bin/omarchy-hibernation-setup @@ -1,7 +1,7 @@ #!/bin/bash -# Creates a swap file in the btrfs subvolume, adds the swap file to /etc/fstab, -# adds a resume hook to mkinitcpio, and configures suspend-then-hibernate. +# omarchy:summary=Set up hibernation with swap and boot resume configuration +# omarchy:requires-sudo=true if [[ ! -f /sys/power/image_size ]]; then echo -e "Hibernation is not supported on your system" >&2 diff --git a/bin/omarchy-hook b/bin/omarchy-hook index fb670f02..85b5a180 100755 --- a/bin/omarchy-hook +++ b/bin/omarchy-hook @@ -1,6 +1,7 @@ #!/bin/bash -# Run a named hook, like post-update (available in ~/.config/omarchy/hooks/post-update). +# omarchy:summary=Run a named hook, like post-update (available in ~/.config/omarchy/hooks/post-update). +# omarchy:args=[name] [args...] set -e diff --git a/bin/omarchy-hw-asus-expertbook-b9406 b/bin/omarchy-hw-asus-expertbook-b9406 index fa936a70..f44af543 100755 --- a/bin/omarchy-hw-asus-expertbook-b9406 +++ b/bin/omarchy-hw-asus-expertbook-b9406 @@ -1,5 +1,5 @@ #!/bin/bash -# Detect ASUS ExpertBook B9406 series laptops on Intel Panther Lake. +# omarchy:summary=Detect ASUS ExpertBook B9406 series laptops on Intel Panther Lake. omarchy-hw-match "B9406" && omarchy-hw-intel-ptl diff --git a/bin/omarchy-hw-asus-rog b/bin/omarchy-hw-asus-rog index 6897d734..99e02525 100755 --- a/bin/omarchy-hw-asus-rog +++ b/bin/omarchy-hw-asus-rog @@ -1,6 +1,6 @@ #!/bin/bash -# Detect whether the computer is an Asus ROG machine. +# omarchy:summary=Detect whether the computer is an Asus ROG machine. [[ $(cat /sys/class/dmi/id/sys_vendor 2>/dev/null) == "ASUSTeK COMPUTER INC." ]] && grep -q "ROG" /sys/class/dmi/id/product_family 2>/dev/null diff --git a/bin/omarchy-hw-dell-xps-oled b/bin/omarchy-hw-dell-xps-oled index 80141b8a..70163e95 100755 --- a/bin/omarchy-hw-dell-xps-oled +++ b/bin/omarchy-hw-dell-xps-oled @@ -1,6 +1,6 @@ #!/bin/bash -# Match Dell XPS systems with LG OLED panel on Intel Panther Lake (Xe3) GPU. +# omarchy:summary=Match Dell XPS systems with LG OLED panel on Intel Panther Lake (Xe3) GPU. omarchy-hw-match "XPS" \ && omarchy-hw-intel-ptl \ diff --git a/bin/omarchy-hw-external-monitors b/bin/omarchy-hw-external-monitors index b5dc967b..08ab52ff 100755 --- a/bin/omarchy-hw-external-monitors +++ b/bin/omarchy-hw-external-monitors @@ -1,7 +1,6 @@ #!/bin/bash -# Returns true when an external monitor is physically connected. -# Uses kernel DRM state so the result is independent of Hyprland's startup timing. +# omarchy:summary=Returns true when an external monitor is physically connected. for status in /sys/class/drm/card*-*/status; do [[ "$status" == *-eDP-*/status ]] && continue diff --git a/bin/omarchy-hw-framework16 b/bin/omarchy-hw-framework16 index cd746bb1..3f74fc98 100755 --- a/bin/omarchy-hw-framework16 +++ b/bin/omarchy-hw-framework16 @@ -1,6 +1,6 @@ #!/bin/bash -# Detect whether the computer is a Framework Laptop 16. +# omarchy:summary=Detect whether the computer is a Framework Laptop 16. [[ $(cat /sys/class/dmi/id/sys_vendor 2>/dev/null) == "Framework" ]] && omarchy-hw-match "Laptop 16" diff --git a/bin/omarchy-hw-hybrid-gpu b/bin/omarchy-hw-hybrid-gpu index 7f26f6af..7a960c79 100755 --- a/bin/omarchy-hw-hybrid-gpu +++ b/bin/omarchy-hw-hybrid-gpu @@ -1,7 +1,7 @@ #!/bin/bash -# supergfxctl is authoritative: in Integrated mode the dGPU is unbound and -# hidden from lspci, so the controller count would undercount on those systems. +# omarchy:summary=Detect whether the system has an active hybrid GPU configuration + if command -v supergfxctl &>/dev/null; then supergfxctl -s 2>/dev/null | grep -qw Hybrid else diff --git a/bin/omarchy-hw-intel b/bin/omarchy-hw-intel index 2dc37c08..f2a2b4c3 100755 --- a/bin/omarchy-hw-intel +++ b/bin/omarchy-hw-intel @@ -1,5 +1,5 @@ #!/bin/bash -# Detect whether the computer has an Intel CPU. +# omarchy:summary=Detect whether the computer has an Intel CPU. [[ $(grep -m1 "vendor_id" /proc/cpuinfo 2>/dev/null | cut -d: -f2 | tr -d ' ') == "GenuineIntel" ]] diff --git a/bin/omarchy-hw-intel-ptl b/bin/omarchy-hw-intel-ptl index 9750bd3b..0b80edaa 100755 --- a/bin/omarchy-hw-intel-ptl +++ b/bin/omarchy-hw-intel-ptl @@ -1,5 +1,5 @@ #!/bin/bash -# Detect whether the computer has an Intel Panther Lake GPU. +# omarchy:summary=Detect whether the computer has an Intel Panther Lake GPU. lspci | grep -iE 'vga|3d|display' | grep -qi 'panther lake' diff --git a/bin/omarchy-hw-match b/bin/omarchy-hw-match index c27875fa..318ca7e8 100755 --- a/bin/omarchy-hw-match +++ b/bin/omarchy-hw-match @@ -1,7 +1,7 @@ #!/bin/bash -# Match against the computer's DMI product name or product family (case-insensitive). -# Usage: omarchy-hw-match "XPS" or omarchy-hw-match "ThinkPad" +# omarchy:summary=Match against the computer's DMI product name or product family (case-insensitive). +# omarchy:args= grep -qi "$1" /sys/class/dmi/id/product_name 2>/dev/null || grep -qi "$1" /sys/class/dmi/id/product_family 2>/dev/null diff --git a/bin/omarchy-hw-recover-internal-monitor b/bin/omarchy-hw-recover-internal-monitor index 794cafea..2ff125e7 100755 --- a/bin/omarchy-hw-recover-internal-monitor +++ b/bin/omarchy-hw-recover-internal-monitor @@ -1,8 +1,6 @@ #!/bin/bash -# Clear the internal-monitor-disable toggle if no external display is connected. -# Runs before the graphical session so Hyprland doesn't block on having no output -# to render to when the user rebooted with the external unplugged. +# omarchy:summary=Clear the internal-monitor-disable toggle if no external display is connected. TOGGLE="$HOME/.local/state/omarchy/toggles/hypr/internal-monitor-disable.conf" diff --git a/bin/omarchy-hw-surface b/bin/omarchy-hw-surface index 2f642721..7bef0e7c 100755 --- a/bin/omarchy-hw-surface +++ b/bin/omarchy-hw-surface @@ -1,6 +1,6 @@ #!/bin/bash -# Detect whether the computer is a Microsoft Surface device. +# omarchy:summary=Detect whether the computer is a Microsoft Surface device. [[ $(cat /sys/class/dmi/id/sys_vendor 2>/dev/null) == "Microsoft Corporation" ]] && omarchy-hw-match "Surface" diff --git a/bin/omarchy-hw-touchpad b/bin/omarchy-hw-touchpad index a4d813e0..b5e4b777 100755 --- a/bin/omarchy-hw-touchpad +++ b/bin/omarchy-hw-touchpad @@ -1,4 +1,6 @@ #!/bin/bash +# omarchy:summary=Print the detected Hyprland touchpad or trackpad device name + device=$(hyprctl devices -j | jq -r '[.mice[] | .name | select(test("touchpad|trackpad"; "i"))] | first // empty') [[ -n $device ]] && echo "$device" diff --git a/bin/omarchy-hw-touchscreen b/bin/omarchy-hw-touchscreen index 47157398..337fd0df 100755 --- a/bin/omarchy-hw-touchscreen +++ b/bin/omarchy-hw-touchscreen @@ -1,4 +1,6 @@ #!/bin/bash +# omarchy:summary=Print the detected Hyprland touchscreen or tablet device name + device=$(hyprctl devices -j | jq -r '[.touch[]?.name, .tablets[]?.name] | first // empty') [[ -n $device ]] && echo "$device" diff --git a/bin/omarchy-hw-vulkan b/bin/omarchy-hw-vulkan index 8d473a24..776bf254 100755 --- a/bin/omarchy-hw-vulkan +++ b/bin/omarchy-hw-vulkan @@ -1,6 +1,6 @@ #!/bin/bash -# Detect whether Vulkan is available. +# omarchy:summary=Detect whether Vulkan is available. [[ -d /usr/share/vulkan/icd.d ]] && find /usr/share/vulkan/icd.d -maxdepth 1 -name "*.json" -print -quit | grep -q . diff --git a/bin/omarchy-hyprland-active-window-transparency-toggle b/bin/omarchy-hyprland-active-window-transparency-toggle index 2412548d..81afc272 100755 --- a/bin/omarchy-hyprland-active-window-transparency-toggle +++ b/bin/omarchy-hyprland-active-window-transparency-toggle @@ -1,5 +1,5 @@ #!/bin/bash -# Toggles transparency for the currently focused window. +# omarchy:summary=Toggles transparency for the currently focused window. hyprctl dispatch setprop "address:$(hyprctl activewindow -j | jq -r '.address')" opaque toggle diff --git a/bin/omarchy-hyprland-monitor-focused b/bin/omarchy-hyprland-monitor-focused index 2b4b8eea..9dd2a264 100755 --- a/bin/omarchy-hyprland-monitor-focused +++ b/bin/omarchy-hyprland-monitor-focused @@ -1,5 +1,5 @@ #!/bin/bash -# Print the name of the currently focused Hyprland monitor. +# omarchy:summary=Print the name of the currently focused Hyprland monitor. hyprctl monitors -j | jq -r '.[] | select(.focused == true).name' diff --git a/bin/omarchy-hyprland-monitor-internal b/bin/omarchy-hyprland-monitor-internal index e869a9d2..29f101d4 100755 --- a/bin/omarchy-hyprland-monitor-internal +++ b/bin/omarchy-hyprland-monitor-internal @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Enable, disable, toggle, or recover the internal laptop display +# omarchy:args= + TOGGLE="internal-monitor-disable" TOGGLE_FLAG="$HOME/.local/state/omarchy/toggles/hypr/$TOGGLE.conf" MIRROR_TOGGLE="internal-monitor-mirror" diff --git a/bin/omarchy-hyprland-monitor-internal-mirror b/bin/omarchy-hyprland-monitor-internal-mirror index f4457b2a..07a0ccad 100755 --- a/bin/omarchy-hyprland-monitor-internal-mirror +++ b/bin/omarchy-hyprland-monitor-internal-mirror @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Enable, disable, toggle, or recover mirroring the internal display to an external monitor +# omarchy:args= + TOGGLE="internal-monitor-mirror" TOGGLE_FLAG="$HOME/.local/state/omarchy/toggles/hypr/$TOGGLE.conf" DISABLE_TOGGLE="internal-monitor-disable" diff --git a/bin/omarchy-hyprland-monitor-scaling-cycle b/bin/omarchy-hyprland-monitor-scaling-cycle index 008dc864..24b2c015 100755 --- a/bin/omarchy-hyprland-monitor-scaling-cycle +++ b/bin/omarchy-hyprland-monitor-scaling-cycle @@ -1,6 +1,7 @@ #!/bin/bash -# Get the active monitor (the one with the cursor) +# omarchy:summary=Cycle scaling for the focused Hyprland monitor + MONITOR_INFO=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true)') ACTIVE_MONITOR=$(echo "$MONITOR_INFO" | jq -r '.name') CURRENT_SCALE=$(echo "$MONITOR_INFO" | jq -r '.scale') diff --git a/bin/omarchy-hyprland-monitor-watch b/bin/omarchy-hyprland-monitor-watch index ee096f25..7d0df494 100755 --- a/bin/omarchy-hyprland-monitor-watch +++ b/bin/omarchy-hyprland-monitor-watch @@ -1,7 +1,6 @@ #!/bin/bash -# Listen on Hyprland's event socket and recover monitor toggles whenever a -# monitor is removed. +# omarchy:summary=Watch Hyprland monitor events and recover monitor toggles when a monitor is removed SOCKET="$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" diff --git a/bin/omarchy-hyprland-toggle b/bin/omarchy-hyprland-toggle index e272beed..363ac855 100755 --- a/bin/omarchy-hyprland-toggle +++ b/bin/omarchy-hyprland-toggle @@ -1,6 +1,7 @@ #!/bin/bash -# Toggle permanent Hyprland flags by copying them into a directory that's sourced entirely. +# omarchy:summary=Toggle permanent Hyprland flags by copying them into a directory that's sourced entirely. +# omarchy:args=[--enabled-notification ] [--disabled-notification ] ENABLED_NOTIFICATION="" DISABLED_NOTIFICATION="" diff --git a/bin/omarchy-hyprland-toggle-disabled b/bin/omarchy-hyprland-toggle-disabled index 4e526d09..51707491 100755 --- a/bin/omarchy-hyprland-toggle-disabled +++ b/bin/omarchy-hyprland-toggle-disabled @@ -1,5 +1,6 @@ #!/bin/bash -# Check if a Hyprland toggle is currently disabled (missing). +# omarchy:summary=Check if a Hyprland toggle is currently disabled (missing). +# omarchy:args= [[ ! -f "$HOME/.local/state/omarchy/toggles/hypr/$1.conf" ]] diff --git a/bin/omarchy-hyprland-toggle-enabled b/bin/omarchy-hyprland-toggle-enabled index 59a273a4..cdc4e718 100755 --- a/bin/omarchy-hyprland-toggle-enabled +++ b/bin/omarchy-hyprland-toggle-enabled @@ -1,5 +1,6 @@ #!/bin/bash -# Check if a Hyprland toggle is currently enabled. +# omarchy:summary=Check if a Hyprland toggle is currently enabled. +# omarchy:args= [[ -f "$HOME/.local/state/omarchy/toggles/hypr/$1.conf" ]] diff --git a/bin/omarchy-hyprland-window-close-all b/bin/omarchy-hyprland-window-close-all index e53fec6a..dbf0d758 100755 --- a/bin/omarchy-hyprland-window-close-all +++ b/bin/omarchy-hyprland-window-close-all @@ -1,6 +1,7 @@ #!/bin/bash -# Close all open windows +# omarchy:summary=Close all open windows + hyprctl clients -j | \ jq -r ".[].address" | \ xargs -I{} hyprctl dispatch closewindow address:{} diff --git a/bin/omarchy-hyprland-window-gaps-toggle b/bin/omarchy-hyprland-window-gaps-toggle index 082e4574..17f29587 100755 --- a/bin/omarchy-hyprland-window-gaps-toggle +++ b/bin/omarchy-hyprland-window-gaps-toggle @@ -1,5 +1,5 @@ #!/bin/bash -# Toggles the window gaps globally between no gaps and the default. +# omarchy:summary=Toggles the window gaps globally between no gaps and the default. omarchy-hyprland-toggle window-no-gaps diff --git a/bin/omarchy-hyprland-window-pop b/bin/omarchy-hyprland-window-pop index d1e8ef3c..05451076 100755 --- a/bin/omarchy-hyprland-window-pop +++ b/bin/omarchy-hyprland-window-pop @@ -1,19 +1,7 @@ #!/bin/bash -# Toggle to pop-out a tile to stay fixed on a display basis. - -# Usage: -# omarchy-hyprland-window-pop [width height [x y]] -# -# Arguments: -# width Optional. Width of the floating window. Default: 1300 -# height Optional. Height of the floating window. Default: 900 -# x Optional. X position of the window. Must provide both X and Y to take effect. -# y Optional. Y position of the window. Must provide both X and Y to take effect. -# -# Behavior: -# - If the window is already pinned, it will be unpinned and removed from the pop layer. -# - If the window is not pinned, it will be floated, resized, moved/centered, pinned, brought to top, and popped. +# omarchy:summary=Toggle to pop-out a tile to stay fixed on a display basis. +# omarchy:args=[width height x y] width=${1:-1300} height=${2:-900} diff --git a/bin/omarchy-hyprland-window-single-square-aspect-toggle b/bin/omarchy-hyprland-window-single-square-aspect-toggle index 70615793..d600c408 100755 --- a/bin/omarchy-hyprland-window-single-square-aspect-toggle +++ b/bin/omarchy-hyprland-window-single-square-aspect-toggle @@ -1,6 +1,6 @@ #!/bin/bash -# Toggle single-window square aspect ratio. +# omarchy:summary=Toggle single-window square aspect ratio. omarchy-hyprland-toggle \ --enabled-notification " Enable single-window square aspect ratio" \ diff --git a/bin/omarchy-hyprland-workspace-layout-toggle b/bin/omarchy-hyprland-workspace-layout-toggle index 189a4694..4636e38e 100755 --- a/bin/omarchy-hyprland-workspace-layout-toggle +++ b/bin/omarchy-hyprland-workspace-layout-toggle @@ -1,6 +1,6 @@ #!/bin/bash -# Toggle the layout on the current active workspace between dwindle and scrolling +# omarchy:summary=Toggle the layout on the current active workspace between dwindle and scrolling ACTIVE_WORKSPACE=$(hyprctl activeworkspace -j | jq -r '.id') CURRENT_LAYOUT=$(hyprctl activeworkspace -j | jq -r '.tiledLayout') diff --git a/bin/omarchy-install-chromium-google-account b/bin/omarchy-install-chromium-google-account index 71492056..d922a7d4 100755 --- a/bin/omarchy-install-chromium-google-account +++ b/bin/omarchy-install-chromium-google-account @@ -1,7 +1,6 @@ #!/bin/bash -# Allow Chromium to sign in to Google accounts by adding the correct -# oauth client id and secret to ~/.config/chromium-flags.conf. +# omarchy:summary=Allow Chromium to sign in to Google accounts by adding the required OAuth credentials if [[ -f ~/.config/chromium-flags.conf ]]; then CONF=~/.config/chromium-flags.conf diff --git a/bin/omarchy-install-dev-env b/bin/omarchy-install-dev-env index 99756a9e..263fd755 100755 --- a/bin/omarchy-install-dev-env +++ b/bin/omarchy-install-dev-env @@ -1,6 +1,10 @@ #!/bin/bash -# Install one of the supported development environments. Usually called via Install > Development > * in the Omarchy Menu. +# omarchy:summary=Install a supported development environment +# omarchy:name=dev-env +# omarchy:args= +# omarchy:examples=omarchy install dev-env ruby | omarchy install dev-env node +# omarchy:requires-sudo=true if [[ -z $1 ]]; then echo "Usage: omarchy-install-dev-env " >&2 diff --git a/bin/omarchy-install-docker-dbs b/bin/omarchy-install-docker-dbs index abfacdc7..4c535496 100755 --- a/bin/omarchy-install-docker-dbs +++ b/bin/omarchy-install-docker-dbs @@ -1,7 +1,7 @@ #!/bin/bash -# Install one of the supported databases in a Docker container with the suitable development options. -# Usually called via Install > Development > Docker DB from the Omarchy Menu. +# omarchy:summary=Install one of the supported databases in a Docker container with the suitable development options. +# omarchy:requires-sudo=true options=("MySQL" "PostgreSQL" "Redis" "MongoDB" "MariaDB" "MSSQL") diff --git a/bin/omarchy-install-dropbox b/bin/omarchy-install-dropbox index 5b261563..4add3460 100755 --- a/bin/omarchy-install-dropbox +++ b/bin/omarchy-install-dropbox @@ -1,6 +1,6 @@ #!/bin/bash -# Install and start the Dropbox service. Must then be authenticated via the web. +# omarchy:summary=Install and start the Dropbox service. Must then be authenticated via the web. echo "Installing all dependencies..." omarchy-pkg-add dropbox dropbox-cli libappindicator-gtk3 python-gpgme nautilus-dropbox diff --git a/bin/omarchy-install-geforce-now b/bin/omarchy-install-geforce-now index 4c941a9b..788b0088 100755 --- a/bin/omarchy-install-geforce-now +++ b/bin/omarchy-install-geforce-now @@ -1,6 +1,6 @@ #!/bin/bash -# Install and launch Geforce Now. +# omarchy:summary=Install and launch Geforce Now. set -e diff --git a/bin/omarchy-install-nordvpn b/bin/omarchy-install-nordvpn index 7ed080d8..d275800d 100755 --- a/bin/omarchy-install-nordvpn +++ b/bin/omarchy-install-nordvpn @@ -1,6 +1,7 @@ #!/bin/bash -# Install the NordVPN service with optional GUI. +# omarchy:summary=Install the NordVPN service with optional GUI. +# omarchy:requires-sudo=true echo "Installing NordVPN..." omarchy-pkg-aur-add nordvpn-bin diff --git a/bin/omarchy-install-once b/bin/omarchy-install-once index 97d56752..9b5cf446 100755 --- a/bin/omarchy-install-once +++ b/bin/omarchy-install-once @@ -1,6 +1,7 @@ #!/bin/bash -# Install the ONCE service, enable its background service, and launch the TUI. +# omarchy:summary=Install the ONCE service, enable its background service, and launch the TUI. +# omarchy:requires-sudo=true echo "Installing ONCE..." omarchy-pkg-add once-bin diff --git a/bin/omarchy-install-steam b/bin/omarchy-install-steam index 2d3b7cd9..8d88f7d7 100755 --- a/bin/omarchy-install-steam +++ b/bin/omarchy-install-steam @@ -1,6 +1,7 @@ #!/bin/bash -# Install and launch Steam after first letting the user pick the correct grahics card drivers. +# omarchy:summary=Install Steam and graphics drivers selected for this system +# omarchy:requires-sudo=true set -e diff --git a/bin/omarchy-install-tailscale b/bin/omarchy-install-tailscale index 4017eb80..1c37ba41 100755 --- a/bin/omarchy-install-tailscale +++ b/bin/omarchy-install-tailscale @@ -1,6 +1,7 @@ #!/bin/bash -# Install the Tailscale mesh VPN service and a web app for the Tailscale Admin Console. +# omarchy:summary=Install the Tailscale mesh VPN service and a web app for the Tailscale Admin Console. +# omarchy:requires-sudo=true echo -e "\nInstalling Tailscale..." omarchy-pkg-add tailscale diff --git a/bin/omarchy-install-terminal b/bin/omarchy-install-terminal index f52744f6..8210a36e 100755 --- a/bin/omarchy-install-terminal +++ b/bin/omarchy-install-terminal @@ -1,6 +1,8 @@ #!/bin/bash -# Install one of the approved terminals and set it as the default for Omarchy (Super + Return etc). +# omarchy:summary=Install one of the approved terminals and set it as the default for Omarchy (Super + Return etc). +# omarchy:args= +# omarchy:requires-sudo=true if (($# == 0)); then echo "Usage: omarchy-install-terminal [alacritty|ghostty|kitty]" diff --git a/bin/omarchy-install-vscode b/bin/omarchy-install-vscode index cd6a32b3..1850e779 100755 --- a/bin/omarchy-install-vscode +++ b/bin/omarchy-install-vscode @@ -1,6 +1,6 @@ #!/bin/bash -# Install VSCode and configure it to use the gnome-libsecret password store, not to update automatically, and to use the current Omarchy theme. +# omarchy:summary=Install VS Code and configure Omarchy defaults for secrets, updates, and theme echo "Installing VSCode..." omarchy-pkg-add visual-studio-code-bin diff --git a/bin/omarchy-install-xbox-controllers b/bin/omarchy-install-xbox-controllers index c192e282..be5e97d9 100755 --- a/bin/omarchy-install-xbox-controllers +++ b/bin/omarchy-install-xbox-controllers @@ -1,6 +1,7 @@ #!/bin/bash -# Install support for using Xbox controllers with Steam/RetroArch/etc. +# omarchy:summary=Install support for using Xbox controllers with Steam/RetroArch/etc. +# omarchy:requires-sudo=true set -e diff --git a/bin/omarchy-launch-about b/bin/omarchy-launch-about index ee5dfdeb..cf9b4516 100755 --- a/bin/omarchy-launch-about +++ b/bin/omarchy-launch-about @@ -1,5 +1,5 @@ #!/bin/bash -# Launch the fastfetch TUI that gives information about the current system. +# omarchy:summary=Launch the fastfetch TUI that gives information about the current system. exec omarchy-launch-or-focus-tui "bash -c 'fastfetch; read -n 1 -s'" diff --git a/bin/omarchy-launch-audio b/bin/omarchy-launch-audio index b5e5e4c1..c3d2592c 100755 --- a/bin/omarchy-launch-audio +++ b/bin/omarchy-launch-audio @@ -1,5 +1,5 @@ #!/bin/bash -# Launch the Omarchy audio controls TUI (provided by wiremix). +# omarchy:summary=Launch the Omarchy audio controls TUI (provided by wiremix). omarchy-launch-or-focus-tui wiremix diff --git a/bin/omarchy-launch-bluetooth b/bin/omarchy-launch-bluetooth index 5e343308..8c450261 100755 --- a/bin/omarchy-launch-bluetooth +++ b/bin/omarchy-launch-bluetooth @@ -1,7 +1,6 @@ #!/bin/bash -# Launch the Omarchy bluetooth controls TUI (provided by bluetui). -# Also attempts to unblock bluetooth service if rfkill had blocked it. +# omarchy:summary=Launch the Omarchy bluetooth controls TUI (provided by bluetui). rfkill unblock bluetooth exec omarchy-launch-or-focus-tui bluetui diff --git a/bin/omarchy-launch-browser b/bin/omarchy-launch-browser index b4b3e289..fefc935e 100755 --- a/bin/omarchy-launch-browser +++ b/bin/omarchy-launch-browser @@ -1,7 +1,7 @@ #!/bin/bash -# Launch the default browser as determined by xdg-settings. -# Automatically converts --private into the correct flag for the given browser. +# omarchy:summary=Launch the default browser as determined by xdg-settings. +# omarchy:args=[url] default_browser=$(xdg-settings get default-web-browser) browser_exec=$(sed -n 's/^Exec=\([^ ]*\).*/\1/p' {~/.local,~/.nix-profile,/usr}/share/applications/$default_browser 2>/dev/null | head -1) diff --git a/bin/omarchy-launch-editor b/bin/omarchy-launch-editor index 56afc614..9c3ec369 100755 --- a/bin/omarchy-launch-editor +++ b/bin/omarchy-launch-editor @@ -1,7 +1,7 @@ #!/bin/bash -# Launch the default editor as determined by $EDITOR (set via ~/.config/uwsm/default) (or nvim if missing). -# Starts suitable editors in a terminal window and otherwise as a regular application. +# omarchy:summary=Launch the default editor as determined by $EDITOR (set via ~/.config/uwsm/default) (or nvim if missing). +# omarchy:args= omarchy-cmd-present "$EDITOR" || EDITOR=nvim diff --git a/bin/omarchy-launch-floating-terminal-with-presentation b/bin/omarchy-launch-floating-terminal-with-presentation index eac1cbb7..b0eaee72 100755 --- a/bin/omarchy-launch-floating-terminal-with-presentation +++ b/bin/omarchy-launch-floating-terminal-with-presentation @@ -1,7 +1,7 @@ #!/bin/bash -# Launch a floating terminal with the Omarchy logo presentation, then execute the command passed in, and finally end with the omarchy-show-done presentation. -# Used by actions such as Update System. +# omarchy:summary=Launch a floating terminal with the Omarchy presentation wrapper +# omarchy:args= cmd="$*" exec setsid uwsm-app -- xdg-terminal-exec --app-id=org.omarchy.terminal --title=Omarchy -e bash -c "omarchy-show-logo; $cmd; if (( \$? != 130 )); then omarchy-show-done; fi" diff --git a/bin/omarchy-launch-or-focus b/bin/omarchy-launch-or-focus index 85ab3d6c..44164bb5 100755 --- a/bin/omarchy-launch-or-focus +++ b/bin/omarchy-launch-or-focus @@ -1,7 +1,7 @@ #!/bin/bash -# Launch or focus on a given command identified by the passed in window-pattern. -# Use by some default bindings, like the one for Spotify, to ensure there is only one instance of the application open. +# omarchy:summary=Launch an app or focus an existing window matching a pattern +# omarchy:args= if (($# == 0)); then echo "Usage: omarchy-launch-or-focus [window-pattern] [launch-command]" diff --git a/bin/omarchy-launch-or-focus-tui b/bin/omarchy-launch-or-focus-tui index bbbfeb5e..9b1858b3 100755 --- a/bin/omarchy-launch-or-focus-tui +++ b/bin/omarchy-launch-or-focus-tui @@ -1,7 +1,7 @@ #!/bin/bash -# Launch or focus on a given TUI identified by the passed in as the command. -# Use by commands like omarchy-launch-wifi to ensure there is only one wifi configuration screen open. +# omarchy:summary=Launch a TUI or focus an existing terminal window for it +# omarchy:args= [args...] APP_ID="org.omarchy.$(basename "$1")" LAUNCH_COMMAND="omarchy-launch-tui $@" diff --git a/bin/omarchy-launch-or-focus-webapp b/bin/omarchy-launch-or-focus-webapp index c8f094e2..15191be2 100755 --- a/bin/omarchy-launch-or-focus-webapp +++ b/bin/omarchy-launch-or-focus-webapp @@ -1,7 +1,7 @@ #!/bin/bash -# Launch or focus on a given web app identified by the window-pattern. -# Use by some default bindings, like the one for WhatsApp, to ensure there is only one instance of the application open. +# omarchy:summary=Launch or focus on a given web app identified by the window-pattern. +# omarchy:args= if (($# == 0)); then echo "Usage: omarchy-launch-or-focus-webapp [window-pattern] [url-and-flags...]" diff --git a/bin/omarchy-launch-screensaver b/bin/omarchy-launch-screensaver index a3a70df5..e3593ba5 100755 --- a/bin/omarchy-launch-screensaver +++ b/bin/omarchy-launch-screensaver @@ -1,8 +1,7 @@ #!/bin/bash -# Launch the Omarchy screensaver in the default terminal on the system with the correct font configuration. +# omarchy:summary=Launch the Omarchy screensaver in the default terminal on the system with the correct font configuration. -# Exit early if we don't have the tte show if ! command -v tte &>/dev/null; then exit 1 fi diff --git a/bin/omarchy-launch-tui b/bin/omarchy-launch-tui index 3968ea65..ba64ad93 100755 --- a/bin/omarchy-launch-tui +++ b/bin/omarchy-launch-tui @@ -1,5 +1,6 @@ #!/bin/bash -# Launch the TUI command passed in as an argument in the default terminal with an org.omarchy.COMMAND app id for styling. +# omarchy:summary=Launch a TUI command in the default terminal with Omarchy styling +# omarchy:args= [args...] exec setsid uwsm-app -- xdg-terminal-exec --app-id=org.omarchy.$(basename $1) -e "$1" "${@:2}" diff --git a/bin/omarchy-launch-walker b/bin/omarchy-launch-walker index cda02c41..d6af04e1 100755 --- a/bin/omarchy-launch-walker +++ b/bin/omarchy-launch-walker @@ -1,8 +1,7 @@ #!/bin/bash -# Launch the Walker application launcher while ensuring that it's data provider (called elephant) is running first. +# omarchy:summary=Launch Walker and ensure its Elephant data provider is running -# Ensure elephant is running before launching walker if ! pgrep -x elephant > /dev/null; then setsid uwsm-app -- elephant & fi diff --git a/bin/omarchy-launch-webapp b/bin/omarchy-launch-webapp index 71606efa..6ee0f84a 100755 --- a/bin/omarchy-launch-webapp +++ b/bin/omarchy-launch-webapp @@ -1,6 +1,7 @@ #!/bin/bash -# Launch the passed in URL as a web app in the default browser (or chromium if the default doesn't support --app). +# omarchy:summary=Launch a URL as a web app in the default supported browser +# omarchy:args= browser=$(xdg-settings get default-web-browser) diff --git a/bin/omarchy-launch-wifi b/bin/omarchy-launch-wifi index 9af1fc82..e22b7083 100755 --- a/bin/omarchy-launch-wifi +++ b/bin/omarchy-launch-wifi @@ -1,7 +1,6 @@ #!/bin/bash -# Launch the Omarchy wifi controls (provided by the Impala TUI). -# Attempts to unblock the wifi service first in case it should be been blocked. +# omarchy:summary=Launch the Omarchy wifi controls (provided by the Impala TUI). rfkill unblock wifi omarchy-launch-or-focus-tui impala diff --git a/bin/omarchy-menu b/bin/omarchy-menu index 52cb3048..e526bb08 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -1,6 +1,6 @@ #!/bin/bash -# Launch the Omarchy Menu or takes a parameter to jump straight to a submenu. +# omarchy:summary=Launch the Omarchy Menu or takes a parameter to jump straight to a submenu. # Set to true when going directly to a submenu, so we can exit directly BACK_TO_EXIT=false diff --git a/bin/omarchy-menu-keybindings b/bin/omarchy-menu-keybindings index 7aa0490a..d28474dc 100755 --- a/bin/omarchy-menu-keybindings +++ b/bin/omarchy-menu-keybindings @@ -1,6 +1,6 @@ #!/bin/bash -# Display Hyprland keybindings defined in your configuration using walker for an interactive search menu. +# omarchy:summary=Display Hyprland keybindings defined in your configuration using walker for an interactive search menu. declare -A KEYCODE_SYM_MAP diff --git a/bin/omarchy-menu-share b/bin/omarchy-menu-share index 1a987339..bb522686 100755 --- a/bin/omarchy-menu-share +++ b/bin/omarchy-menu-share @@ -1,6 +1,10 @@ #!/bin/bash -# Share clipboard, file, or folder using LocalSend. Bound to Super + Ctrl + S by default. +# omarchy:summary=Share clipboard, files, or folders with LocalSend +# omarchy:group=share +# omarchy:name= +# omarchy:args= [path...] +# omarchy:examples=omarchy share clipboard | omarchy share file ~/Downloads/example.txt if (($# == 0)); then echo "Usage: omarchy-menu-share [clipboard|file|folder]" diff --git a/bin/omarchy-migrate b/bin/omarchy-migrate index 0e1ec2cc..4ba325be 100755 --- a/bin/omarchy-migrate +++ b/bin/omarchy-migrate @@ -1,8 +1,7 @@ #!/bin/bash -# Run all pending migrations to bring the system in line with the installed version. +# omarchy:summary=Run all pending migrations to bring the system in line with the installed version. -# Where we store an empty file for each migration that has already been performed. STATE_DIR="$HOME/.local/state/omarchy/migrations" mkdir -p "$STATE_DIR" diff --git a/bin/omarchy-notification-dismiss b/bin/omarchy-notification-dismiss index 72964b84..ab515e72 100755 --- a/bin/omarchy-notification-dismiss +++ b/bin/omarchy-notification-dismiss @@ -1,6 +1,7 @@ #!/bin/bash -# Dismiss a mako notification on the basis of its summary. Used by the first-run notifications to dismiss them after clicking for action. +# omarchy:summary=Dismiss a mako notification on the basis of its summary. Used by the first-run notifications to dismiss them after clicking for action. +# omarchy:args= if (($# == 0)); then echo "Usage: omarchy-notification-dismiss " diff --git a/bin/omarchy-npx-install b/bin/omarchy-npx-install index 181111e9..48babc41 100755 --- a/bin/omarchy-npx-install +++ b/bin/omarchy-npx-install @@ -1,10 +1,7 @@ #!/bin/bash -# Install an npx wrapper for a given npm package. -# Usage: omarchy-npx-install [command-name] -# -# If command-name is omitted, it defaults to the package name. -# Example: omarchy-npx-install opencode-ai opencode +# omarchy:summary=Install an npx wrapper for a given npm package. +# omarchy:args= [command-name] if [[ -z $1 ]]; then echo "Usage: omarchy-npx-install [command-name]" diff --git a/bin/omarchy-pkg-add b/bin/omarchy-pkg-add index 15c803d4..5c18ae02 100755 --- a/bin/omarchy-pkg-add +++ b/bin/omarchy-pkg-add @@ -1,6 +1,11 @@ #!/bin/bash -# Add the named packages to the system if they're missing. Returns false if it couldn't be done. +# omarchy:summary=Install Arch packages if they are missing +# omarchy:group=install +# omarchy:name=package +# omarchy:args= +# omarchy:examples=omarchy install package jq ripgrep +# omarchy:requires-sudo=true if omarchy-pkg-missing "$@"; then sudo pacman -S --noconfirm --needed "$@" || exit 1 diff --git a/bin/omarchy-pkg-aur-accessible b/bin/omarchy-pkg-aur-accessible index 3800880e..fae95172 100755 --- a/bin/omarchy-pkg-aur-accessible +++ b/bin/omarchy-pkg-aur-accessible @@ -1,7 +1,6 @@ #!/bin/bash -# Returns true if the AUR is up and available. -# Used by omarchy-update-system-pkgs to ensure the AUR is available before updating packages from it. +# omarchy:summary=Returns true if the AUR is up and available. curl -sf --connect-timeout 30 --retry 3 --retry-delay 3 -A "omarchy-update" \ "https://aur.archlinux.org/rpc/?v=5&type=info&arg=base" >/dev/null diff --git a/bin/omarchy-pkg-aur-add b/bin/omarchy-pkg-aur-add index 332a0f60..7a152be7 100755 --- a/bin/omarchy-pkg-aur-add +++ b/bin/omarchy-pkg-aur-add @@ -1,6 +1,7 @@ #!/bin/bash -# Add the named packages to the system from the AUR if they're missing. Returns false if it couldn't be done. +# omarchy:summary=Add the named packages to the system from the AUR if they're missing. Returns false if it couldn't be done. +# omarchy:args= if omarchy-pkg-missing "$@"; then yay -S --noconfirm --needed "$@" || exit 1 diff --git a/bin/omarchy-pkg-aur-install b/bin/omarchy-pkg-aur-install index 89340162..dcb7ba1e 100755 --- a/bin/omarchy-pkg-aur-install +++ b/bin/omarchy-pkg-aur-install @@ -1,6 +1,7 @@ #!/bin/bash -# Show a fuzzy-finder TUI for picking new AUR packages to install. +# omarchy:summary=Show a fuzzy-finder TUI for picking new AUR packages to install. +# omarchy:requires-sudo=true fzf_args=( --multi diff --git a/bin/omarchy-pkg-drop b/bin/omarchy-pkg-drop index 125c9c98..06e396cd 100755 --- a/bin/omarchy-pkg-drop +++ b/bin/omarchy-pkg-drop @@ -1,6 +1,8 @@ #!/bin/bash -# Remove all the named packages from the system if they're installed (otherwise ignore). +# omarchy:summary=Remove all the named packages from the system if they're installed (otherwise ignore). +# omarchy:args= +# omarchy:requires-sudo=true for pkg in "$@"; do if pacman -Q "$pkg" &>/dev/null; then diff --git a/bin/omarchy-pkg-install b/bin/omarchy-pkg-install index 8399da9c..15e5e288 100755 --- a/bin/omarchy-pkg-install +++ b/bin/omarchy-pkg-install @@ -1,6 +1,7 @@ #!/bin/bash -# Show a fuzzy-finder TUI for picking new Arch and OPR packages to install. +# omarchy:summary=Show a fuzzy-finder TUI for picking new Arch and OPR packages to install. +# omarchy:requires-sudo=true fzf_args=( --multi diff --git a/bin/omarchy-pkg-missing b/bin/omarchy-pkg-missing index c2bab7a7..c4059dff 100755 --- a/bin/omarchy-pkg-missing +++ b/bin/omarchy-pkg-missing @@ -1,6 +1,7 @@ #!/bin/bash -# Returns true if any of the named packages are missing from the system (or false if they're all there). +# omarchy:summary=Returns true if any of the named packages are missing from the system (or false if they're all there). +# omarchy:args= for pkg in "$@"; do if ! pacman -Q "$pkg" &>/dev/null; then diff --git a/bin/omarchy-pkg-present b/bin/omarchy-pkg-present index 03a5d9af..8c4340d6 100755 --- a/bin/omarchy-pkg-present +++ b/bin/omarchy-pkg-present @@ -1,6 +1,7 @@ #!/bin/bash -# Returns true if all of the named packages are installed on the system (or false if any of them are missing). +# omarchy:summary=Returns true if all of the named packages are installed on the system (or false if any of them are missing). +# omarchy:args= for pkg in "$@"; do pacman -Q "$pkg" &>/dev/null || exit 1 diff --git a/bin/omarchy-pkg-remove b/bin/omarchy-pkg-remove index 865c1354..486d3772 100755 --- a/bin/omarchy-pkg-remove +++ b/bin/omarchy-pkg-remove @@ -1,6 +1,7 @@ #!/bin/bash -# Show a fuzzy-finder TUI for picking packages installed on the system to be removed. +# omarchy:summary=Show a fuzzy-finder TUI for picking packages installed on the system to be removed. +# omarchy:requires-sudo=true fzf_args=( --multi diff --git a/bin/omarchy-plymouth-preview b/bin/omarchy-plymouth-preview index 0b83a956..88cc71df 100755 --- a/bin/omarchy-plymouth-preview +++ b/bin/omarchy-plymouth-preview @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Preview a Plymouth boot screen with custom colors and logo +# omarchy:args= + # Render a Plymouth login-screen preview PNG by compositing the staged omarchy # theme assets (recolored with the given text color) onto the background. diff --git a/bin/omarchy-plymouth-reset b/bin/omarchy-plymouth-reset index 8ecd0ea7..584c8417 100755 --- a/bin/omarchy-plymouth-reset +++ b/bin/omarchy-plymouth-reset @@ -1,8 +1,7 @@ #!/bin/bash -# Restore the Plymouth boot theme and the SDDM login screen to the omarchy -# defaults — copies the shipped assets into /usr/share, rebuilds the initramfs, -# and refreshes the SDDM theme. +# omarchy:summary=Restore the default Omarchy Plymouth boot theme and SDDM login screen +# omarchy:requires-sudo=true theme_dir="/usr/share/plymouth/themes/omarchy" diff --git a/bin/omarchy-plymouth-set b/bin/omarchy-plymouth-set index 94c4ff4a..46a4a9a8 100755 --- a/bin/omarchy-plymouth-set +++ b/bin/omarchy-plymouth-set @@ -1,5 +1,9 @@ #!/bin/bash +# omarchy:summary=Set the Plymouth boot theme colors and logo +# omarchy:args= +# omarchy:requires-sudo=true + # Configure the Plymouth boot theme with a custom background color, text color, and logo. # Stages the change in a temp dir, then commits the staged files to /usr/share and # rebuilds the initramfs. Also syncs the SDDM login screen (the post-logout diff --git a/bin/omarchy-plymouth-set-by-theme b/bin/omarchy-plymouth-set-by-theme index 6f1f7fb0..d46d5668 100755 --- a/bin/omarchy-plymouth-set-by-theme +++ b/bin/omarchy-plymouth-set-by-theme @@ -1,5 +1,9 @@ #!/bin/bash +# omarchy:summary=Set the Plymouth boot theme from an Omarchy theme +# omarchy:args= +# omarchy:requires-sudo=true + # Resolve a theme by name and apply its unlock.png + colors.toml as the # Plymouth boot screen via omarchy-plymouth-set. diff --git a/bin/omarchy-powerprofiles-init b/bin/omarchy-powerprofiles-init index 5a94d05b..f2dcee1d 100755 --- a/bin/omarchy-powerprofiles-init +++ b/bin/omarchy-powerprofiles-init @@ -1,8 +1,6 @@ #!/bin/bash -# Set the correct power profile on boot based on current AC/battery state. -# The udev rules only fire on state *changes*, so without this, booting -# on AC leaves you in the default balanced mode. +# omarchy:summary=Set the correct power profile on boot based on current AC/battery state. if omarchy-battery-present && ! omarchy-ac-present; then omarchy-powerprofiles-set battery diff --git a/bin/omarchy-powerprofiles-list b/bin/omarchy-powerprofiles-list index d8717ce3..093f9c99 100755 --- a/bin/omarchy-powerprofiles-list +++ b/bin/omarchy-powerprofiles-list @@ -1,7 +1,6 @@ #!/bin/bash -# Returns a list of all the available power profiles on the system. -# Used by the Omarchy Menu under Setup > Power Profile. +# omarchy:summary=Returns a list of all the available power profiles on the system. powerprofilesctl list | awk '/^\s*[* ]\s*[a-zA-Z0-9\-]+:$/ { gsub(/^[*[:space:]]+|:$/,""); print }' | diff --git a/bin/omarchy-powerprofiles-set b/bin/omarchy-powerprofiles-set index 86c3ac0c..a137c4d4 100755 --- a/bin/omarchy-powerprofiles-set +++ b/bin/omarchy-powerprofiles-set @@ -1,9 +1,7 @@ #!/bin/bash -# Set the power profile to the requested level, falling back to balanced -# if the requested profile isn't available on this machine. -# -# Usage: omarchy-powerprofiles-set +# omarchy:summary=Set the power profile to the requested level, falling back to balanced +# omarchy:args= mapfile -t profiles < <(powerprofilesctl list | awk '/^\s*[* ]\s*[a-zA-Z0-9\-]+:$/ { gsub(/^[*[:space:]]+|:$/,""); print }') diff --git a/bin/omarchy-refresh-applications b/bin/omarchy-refresh-applications index 0c39e5bc..550d1c86 100755 --- a/bin/omarchy-refresh-applications +++ b/bin/omarchy-refresh-applications @@ -1,8 +1,7 @@ #!/bin/bash -# Ensure all default .desktop, web apps, and TUIs are installed. +# omarchy:summary=Ensure all default .desktop, web apps, and TUIs are installed. -# Copy and sync icon files mkdir -p ~/.local/share/icons/hicolor/48x48/apps/ cp ~/.local/share/omarchy/applications/icons/*.png ~/.local/share/icons/hicolor/48x48/apps/ gtk-update-icon-cache ~/.local/share/icons/hicolor &>/dev/null diff --git a/bin/omarchy-refresh-chromium b/bin/omarchy-refresh-chromium index e206f363..f8d13f73 100755 --- a/bin/omarchy-refresh-chromium +++ b/bin/omarchy-refresh-chromium @@ -1,6 +1,6 @@ #!/bin/bash -# Refresh the ~/.config/chromium-flags.conf file from the Omarchy defaults. +# omarchy:summary=Refresh the ~/.config/chromium-flags.conf file from the Omarchy defaults. CONFIG_FILE="$HOME/.config/chromium-flags.conf" INSTALL_GOOGLE_ACCOUNTS=false diff --git a/bin/omarchy-refresh-config b/bin/omarchy-refresh-config index c80ba663..0e46925a 100755 --- a/bin/omarchy-refresh-config +++ b/bin/omarchy-refresh-config @@ -1,7 +1,7 @@ #!/bin/bash -# Copies the named config from ~/.local/share/omarchy/config/X/Y/Z -> ~/.config/X/Y/Z. -# If the config already exists, a backup of the existing will be taken as .bak.TIMESTAMP. +# omarchy:summary=Copies the named config from ~/.local/share/omarchy/config/X/Y/Z -> ~/.config/X/Y/Z. +# omarchy:args= config_file=$1 diff --git a/bin/omarchy-refresh-fastfetch b/bin/omarchy-refresh-fastfetch index 15587d3e..c7988b71 100755 --- a/bin/omarchy-refresh-fastfetch +++ b/bin/omarchy-refresh-fastfetch @@ -1,5 +1,5 @@ #!/bin/bash -# Overwrite the user config for fastfetch with the Omarchy default. +# omarchy:summary=Overwrite the user config for fastfetch with the Omarchy default. omarchy-refresh-config fastfetch/config.jsonc diff --git a/bin/omarchy-refresh-hypridle b/bin/omarchy-refresh-hypridle index c2ade21d..210e78bf 100755 --- a/bin/omarchy-refresh-hypridle +++ b/bin/omarchy-refresh-hypridle @@ -1,6 +1,6 @@ #!/bin/bash -# Overwrite the user config for hypridle with the Omarchy default and restart the service. +# omarchy:summary=Overwrite the user config for hypridle with the Omarchy default and restart the service. omarchy-refresh-config hypr/hypridle.conf omarchy-restart-hypridle diff --git a/bin/omarchy-refresh-hyprland b/bin/omarchy-refresh-hyprland index 49f484a0..58618014 100755 --- a/bin/omarchy-refresh-hyprland +++ b/bin/omarchy-refresh-hyprland @@ -1,6 +1,6 @@ #!/bin/bash -# Overwrite all the user configs in ~/.config/hypr with the Omarchy defaults. +# omarchy:summary=Overwrite all the user configs in ~/.config/hypr with the Omarchy defaults. omarchy-refresh-config hypr/autostart.conf omarchy-refresh-config hypr/bindings.conf diff --git a/bin/omarchy-refresh-hyprlock b/bin/omarchy-refresh-hyprlock index 7d8575fc..1a09c88f 100755 --- a/bin/omarchy-refresh-hyprlock +++ b/bin/omarchy-refresh-hyprlock @@ -1,5 +1,5 @@ #!/bin/bash -# Overwrite the user config for hyprlock with the Omarchy default. +# omarchy:summary=Overwrite the user config for hyprlock with the Omarchy default. omarchy-refresh-config hypr/hyprlock.conf diff --git a/bin/omarchy-refresh-hyprsunset b/bin/omarchy-refresh-hyprsunset index 1cbfc522..bb7de90a 100755 --- a/bin/omarchy-refresh-hyprsunset +++ b/bin/omarchy-refresh-hyprsunset @@ -1,6 +1,6 @@ #!/bin/bash -# Overwrite the user config for hyprsunset with the Omarchy default and restart the service. -# +# omarchy:summary=Overwrite the user config for hyprsunset with the Omarchy default and restart the service. + omarchy-refresh-config hypr/hyprsunset.conf omarchy-restart-hyprsunset diff --git a/bin/omarchy-refresh-limine b/bin/omarchy-refresh-limine index 61261634..b2b735cc 100755 --- a/bin/omarchy-refresh-limine +++ b/bin/omarchy-refresh-limine @@ -1,6 +1,7 @@ #!/bin/bash -# Overwrite the user config for the Limine bootloader and rebuild it. +# omarchy:summary=Overwrite the user config for the Limine bootloader and rebuild it. +# omarchy:requires-sudo=true if [[ -f /boot/EFI/Linux/omarchy_linux.efi ]] && [[ -f /boot/EFI/Linux/$(cat /etc/machine-id)_linux.efi ]]; then echo "Cleanup extra UKI" diff --git a/bin/omarchy-refresh-pacman b/bin/omarchy-refresh-pacman index f09b44fb..fce99ee5 100755 --- a/bin/omarchy-refresh-pacman +++ b/bin/omarchy-refresh-pacman @@ -1,9 +1,8 @@ #!/bin/bash -# Overwrite the package configuration for /etc/pacman with the Omarchy default of using its dedicated mirrors and repositories, then update all packages. -# This is used after switching between Omarchy release channels to ensure the right packages for the right channel are available. +# omarchy:summary=Overwrite the package configuration for /etc/pacman with the Omarchy default of using its dedicated mirrors and repositories, then update all packages. +# omarchy:requires-sudo=true -# Take backup of existing files sudo cp -f /etc/pacman.conf /etc/pacman.conf.bak sudo cp -f /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak diff --git a/bin/omarchy-refresh-plymouth b/bin/omarchy-refresh-plymouth index bdff7c7f..44dfe3d8 100755 --- a/bin/omarchy-refresh-plymouth +++ b/bin/omarchy-refresh-plymouth @@ -1,6 +1,7 @@ #!/bin/bash -# Overwrite the user config for the Plymouth drive decryption and boot sequence with the Omarchy default and rebuild it. +# omarchy:summary=Overwrite the user config for the Plymouth drive decryption and boot sequence with the Omarchy default and rebuild it. +# omarchy:requires-sudo=true sudo cp ~/.local/share/omarchy/default/plymouth/* /usr/share/plymouth/themes/omarchy/ sudo plymouth-set-default-theme omarchy diff --git a/bin/omarchy-refresh-sddm b/bin/omarchy-refresh-sddm index 473bb3ee..9f2c51ad 100755 --- a/bin/omarchy-refresh-sddm +++ b/bin/omarchy-refresh-sddm @@ -1,6 +1,7 @@ #!/bin/bash -# Refresh the SDDM theme from default +# omarchy:summary=Refresh the SDDM theme from default +# omarchy:requires-sudo=true sudo rm -rf /usr/share/sddm/themes/omarchy sudo cp -r $OMARCHY_PATH/default/sddm/omarchy /usr/share/sddm/themes/omarchy diff --git a/bin/omarchy-refresh-swayosd b/bin/omarchy-refresh-swayosd index ab2fe56f..65820784 100755 --- a/bin/omarchy-refresh-swayosd +++ b/bin/omarchy-refresh-swayosd @@ -1,6 +1,6 @@ #!/bin/bash -# Overwrite the user configs for swayosd (controls on-screen feedback for changing volume/songs etc) with the Omarchy defaults and restart the service. +# omarchy:summary=Overwrite the user configs for swayosd (controls on-screen feedback for changing volume/songs etc) with the Omarchy defaults and restart the service. omarchy-refresh-config swayosd/config.toml omarchy-refresh-config swayosd/style.css diff --git a/bin/omarchy-refresh-tmux b/bin/omarchy-refresh-tmux index 560c7fd5..ba40b1c0 100755 --- a/bin/omarchy-refresh-tmux +++ b/bin/omarchy-refresh-tmux @@ -1,6 +1,6 @@ #!/bin/bash -# Overwrite the user tmux config with the Omarchy default and reload tmux. +# omarchy:summary=Overwrite the user tmux config with the Omarchy default and reload tmux. omarchy-refresh-config tmux/tmux.conf omarchy-restart-tmux diff --git a/bin/omarchy-refresh-walker b/bin/omarchy-refresh-walker index dd6900e1..4e834b7f 100755 --- a/bin/omarchy-refresh-walker +++ b/bin/omarchy-refresh-walker @@ -1,8 +1,7 @@ #!/bin/bash -# Overwrite the user configs for the Walker application launcher (which also powers the Omarchy Menu) and restart the services. +# omarchy:summary=Overwrite the user configs for the Walker application launcher (which also powers the Omarchy Menu) and restart the services. -# Ensure walker is set to autostart mkdir -p ~/.config/autostart/ cp $OMARCHY_PATH/default/walker/walker.desktop ~/.config/autostart/ diff --git a/bin/omarchy-refresh-waybar b/bin/omarchy-refresh-waybar index 1ea9f75c..62aebde4 100755 --- a/bin/omarchy-refresh-waybar +++ b/bin/omarchy-refresh-waybar @@ -1,6 +1,7 @@ #!/bin/bash -# Overwrite the user configs for the Waybar menu bar with the Omarchy defaults and restart the service. +# omarchy:summary=Reset Waybar config to Omarchy defaults +# omarchy:examples=omarchy refresh waybar omarchy-refresh-config waybar/config.jsonc omarchy-refresh-config waybar/style.css diff --git a/bin/omarchy-reinstall b/bin/omarchy-reinstall index df00c609..d214188a 100755 --- a/bin/omarchy-reinstall +++ b/bin/omarchy-reinstall @@ -1,4 +1,8 @@ #!/bin/bash + +# omarchy:summary=Reinstall Omarchy packages and reset default configs +# omarchy:requires-sudo=true + set -e # Attempt to reinstall all default Omarchy packages and reset all the default configs. diff --git a/bin/omarchy-reinstall-configs b/bin/omarchy-reinstall-configs index c27b1efa..8b073cf8 100755 --- a/bin/omarchy-reinstall-configs +++ b/bin/omarchy-reinstall-configs @@ -1,4 +1,8 @@ #!/bin/bash + +# omarchy:summary=Reset all Omarchy user configs to the defaults +# omarchy:requires-sudo=true + set -e # Overwrite all user configs with the Omarchy defaults. diff --git a/bin/omarchy-reinstall-git b/bin/omarchy-reinstall-git index 33c8b8cc..cbba15dd 100755 --- a/bin/omarchy-reinstall-git +++ b/bin/omarchy-reinstall-git @@ -1,4 +1,7 @@ #!/bin/bash + +# omarchy:summary=Reinstall the Omarchy source directory from git + set -e # Reinstall the Omarchy configuration directory from the git source. diff --git a/bin/omarchy-reinstall-pkgs b/bin/omarchy-reinstall-pkgs index d70d0643..dc64a1f3 100755 --- a/bin/omarchy-reinstall-pkgs +++ b/bin/omarchy-reinstall-pkgs @@ -1,4 +1,8 @@ #!/bin/bash + +# omarchy:summary=Reinstall all default Omarchy packages from the stable channel +# omarchy:requires-sudo=true + set -e # Reinstall all default Omarchy packages from the stable channel and downgrade any packages that are too new. diff --git a/bin/omarchy-remove-dev-env b/bin/omarchy-remove-dev-env index f25a5ff0..4551f1e1 100755 --- a/bin/omarchy-remove-dev-env +++ b/bin/omarchy-remove-dev-env @@ -1,7 +1,8 @@ #!/bin/bash -# Remove a development environment that was previously installed via omarchy-install-dev-env. -# Usage: omarchy-remove-dev-env +# omarchy:summary=Remove a development environment that was previously installed via omarchy-install-dev-env. +# omarchy:args= +# omarchy:requires-sudo=true if [[ -z $1 ]]; then echo "Usage: omarchy-remove-dev-env " >&2 diff --git a/bin/omarchy-remove-preinstalls b/bin/omarchy-remove-preinstalls index 761ee126..fc5eae72 100755 --- a/bin/omarchy-remove-preinstalls +++ b/bin/omarchy-remove-preinstalls @@ -1,7 +1,6 @@ #!/bin/bash -# Remove preinstalled Omarchy applications (web apps, TUIs, and selected packages). -# This removes all web apps, TUIs, plus specific desktop applications. +# omarchy:summary=Remove preinstalled Omarchy applications (web apps, TUIs, and selected packages). if gum confirm "Are you sure you want to remove all preinstalled web apps, TUI wrappers, and desktop applications?"; then echo -e "Removing preinstalled Omarchy applications...\n" diff --git a/bin/omarchy-restart-app b/bin/omarchy-restart-app index 78556e3e..d250650d 100755 --- a/bin/omarchy-restart-app +++ b/bin/omarchy-restart-app @@ -1,7 +1,7 @@ #!/bin/bash -# Restart an application by killing it and relaunching via uwsm. -# Usage: omarchy-restart-app [application-args...] +# omarchy:summary=Restart an application by killing it and relaunching via uwsm. +# omarchy:args= [application-args...] pkill -x $1 setsid uwsm-app -- "$@" >/dev/null 2>&1 & diff --git a/bin/omarchy-restart-bluetooth b/bin/omarchy-restart-bluetooth index 57530d10..b95f9904 100755 --- a/bin/omarchy-restart-bluetooth +++ b/bin/omarchy-restart-bluetooth @@ -1,6 +1,6 @@ #!/bin/bash -# Unblock and restart the bluetooth service. +# omarchy:summary=Unblock and restart the bluetooth service. echo -e "Unblocking bluetooth...\n" rfkill unblock bluetooth diff --git a/bin/omarchy-restart-btop b/bin/omarchy-restart-btop index 2de58537..16b6b98f 100755 --- a/bin/omarchy-restart-btop +++ b/bin/omarchy-restart-btop @@ -1,5 +1,5 @@ #!/bin/bash -# Reload btop configuration (used by the Omarchy theme switching). +# omarchy:summary=Reload btop configuration (used by the Omarchy theme switching). pkill -SIGUSR2 btop diff --git a/bin/omarchy-restart-hyprctl b/bin/omarchy-restart-hyprctl index d8362c9f..e6e2c317 100755 --- a/bin/omarchy-restart-hyprctl +++ b/bin/omarchy-restart-hyprctl @@ -1,5 +1,5 @@ #!/bin/bash -# Reload hyprland configuration (used by the Omarchy theme switching). +# omarchy:summary=Reload hyprland configuration (used by the Omarchy theme switching). hyprctl reload >/dev/null diff --git a/bin/omarchy-restart-hypridle b/bin/omarchy-restart-hypridle index 02186267..0ea7776c 100755 --- a/bin/omarchy-restart-hypridle +++ b/bin/omarchy-restart-hypridle @@ -1,5 +1,5 @@ #!/bin/bash -# Restart the hypridle service (used for idle detection and auto-lock). +# omarchy:summary=Restart the hypridle service (used for idle detection and auto-lock). omarchy-restart-app hypridle diff --git a/bin/omarchy-restart-hyprsunset b/bin/omarchy-restart-hyprsunset index c705ab53..5e8da60f 100755 --- a/bin/omarchy-restart-hyprsunset +++ b/bin/omarchy-restart-hyprsunset @@ -1,5 +1,5 @@ #!/bin/bash -# Restart the hyprsunset service (used for blue light filtering/night light). +# omarchy:summary=Restart the hyprsunset service (used for blue light filtering/night light). omarchy-restart-app hyprsunset diff --git a/bin/omarchy-restart-mako b/bin/omarchy-restart-mako index f681a405..3cb6a6a2 100755 --- a/bin/omarchy-restart-mako +++ b/bin/omarchy-restart-mako @@ -1,5 +1,5 @@ #!/bin/bash -# Reload mako configuration (used by the Omarchy theme switching). +# omarchy:summary=Reload mako configuration (used by the Omarchy theme switching). makoctl reload diff --git a/bin/omarchy-restart-opencode b/bin/omarchy-restart-opencode index 086eba9f..3b282248 100755 --- a/bin/omarchy-restart-opencode +++ b/bin/omarchy-restart-opencode @@ -1,6 +1,6 @@ #!/bin/bash -# Reload opencode configuration (used by the Omarchy theme switching). +# omarchy:summary=Reload opencode configuration (used by the Omarchy theme switching). if pgrep -x opencode >/dev/null; then killall -SIGUSR2 opencode diff --git a/bin/omarchy-restart-pipewire b/bin/omarchy-restart-pipewire index a222ad1e..14276bad 100755 --- a/bin/omarchy-restart-pipewire +++ b/bin/omarchy-restart-pipewire @@ -1,6 +1,6 @@ #!/bin/bash -# Restart the PipeWire audio service to fix audio issues or apply new configuration. +# omarchy:summary=Restart the PipeWire audio service to fix audio issues or apply new configuration. echo -e "Restarting pipewire audio service...\n" systemctl --user restart pipewire.service diff --git a/bin/omarchy-restart-swayosd b/bin/omarchy-restart-swayosd index b155bc2f..19f4e78d 100755 --- a/bin/omarchy-restart-swayosd +++ b/bin/omarchy-restart-swayosd @@ -1,3 +1,5 @@ #!/bin/bash +# omarchy:summary=Restart the SwayOSD server + omarchy-restart-app swayosd-server diff --git a/bin/omarchy-restart-terminal b/bin/omarchy-restart-terminal index 69ec8da2..d767879d 100755 --- a/bin/omarchy-restart-terminal +++ b/bin/omarchy-restart-terminal @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Reload supported terminal emulators after config changes + if [[ -f ~/.config/alacritty/alacritty.toml ]]; then touch ~/.config/alacritty/alacritty.toml fi diff --git a/bin/omarchy-restart-tmux b/bin/omarchy-restart-tmux index b1ce7603..539d5176 100755 --- a/bin/omarchy-restart-tmux +++ b/bin/omarchy-restart-tmux @@ -1,6 +1,6 @@ #!/bin/bash -# Restart tmux if running with the latest configuration +# omarchy:summary=Restart tmux if running with the latest configuration if pgrep -x tmux; then tmux source-file ~/.config/tmux/tmux.conf diff --git a/bin/omarchy-restart-trackpad b/bin/omarchy-restart-trackpad index 4e2d584a..45898dc3 100755 --- a/bin/omarchy-restart-trackpad +++ b/bin/omarchy-restart-trackpad @@ -1,11 +1,8 @@ #!/bin/bash -# Reset the trackpad by unbinding and rebinding its driver. -# Covers both driver paths: -# - i2c_hid_acpi (DesignWare I2C, e.g. XPS 14/16 Synaptics trackpad) -# - intel_quicki2c (THC Touch Host Controller) +# omarchy:summary=Reset the trackpad by unbinding and rebinding its driver. +# omarchy:requires-sudo=true -# Try i2c_hid_acpi path (DesignWare I2C trackpads) for dev in /sys/bus/i2c/drivers/i2c_hid_acpi/i2c-*; do [ -e "$dev" ] || continue I2C_DEVICE=$(basename "$dev") diff --git a/bin/omarchy-restart-walker b/bin/omarchy-restart-walker index fb1a9eae..b4326998 100755 --- a/bin/omarchy-restart-walker +++ b/bin/omarchy-restart-walker @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Restart Walker and related user services + restart_services() { if systemctl --user is-enabled elephant.service &>/dev/null; then systemctl --user restart elephant.service diff --git a/bin/omarchy-restart-waybar b/bin/omarchy-restart-waybar index 53b570ef..7c165f60 100755 --- a/bin/omarchy-restart-waybar +++ b/bin/omarchy-restart-waybar @@ -1,3 +1,6 @@ #!/bin/bash +# omarchy:summary=Restart Waybar +# omarchy:examples=omarchy restart waybar + omarchy-restart-app waybar diff --git a/bin/omarchy-restart-wifi b/bin/omarchy-restart-wifi index 5cf35dd3..1a177c33 100755 --- a/bin/omarchy-restart-wifi +++ b/bin/omarchy-restart-wifi @@ -1,6 +1,6 @@ #!/bin/bash -# Unblock and restart the Wi-Fi service. +# omarchy:summary=Unblock and restart the Wi-Fi service. echo -e "Unblocking wifi...\n" rfkill unblock wifi diff --git a/bin/omarchy-restart-xcompose b/bin/omarchy-restart-xcompose index c66bfe7a..c0676b1c 100755 --- a/bin/omarchy-restart-xcompose +++ b/bin/omarchy-restart-xcompose @@ -1,5 +1,5 @@ #!/bin/bash -# Restart the XCompose input method service (fcitx5) to apply new compose key settings. +# omarchy:summary=Restart the XCompose input method service (fcitx5) to apply new compose key settings. omarchy-restart-app fcitx5 --disable notificationitem diff --git a/bin/omarchy-screensaver b/bin/omarchy-screensaver index 7dd64786..f18afcff 100755 --- a/bin/omarchy-screensaver +++ b/bin/omarchy-screensaver @@ -1,6 +1,6 @@ #!/bin/bash -# Run the Omarchy screensaver using random effects from TTE. +# omarchy:summary=Run the Omarchy screensaver using random effects from TTE. screensaver_in_focus() { hyprctl activewindow -j | jq -e '.class == "org.omarchy.screensaver"' >/dev/null 2>&1 diff --git a/bin/omarchy-setup-dns b/bin/omarchy-setup-dns index 7a60b641..fc88f81b 100755 --- a/bin/omarchy-setup-dns +++ b/bin/omarchy-setup-dns @@ -1,5 +1,9 @@ #!/bin/bash +# omarchy:summary=Configure the system DNS provider +# omarchy:args=[Cloudflare|Google|DHCP|Custom] +# omarchy:requires-sudo=true + lock_dns_to_resolved() { for file in /etc/systemd/network/*.network; do [[ -f $file ]] || continue diff --git a/bin/omarchy-setup-fido2 b/bin/omarchy-setup-fido2 index c042cf2c..0e55d0b2 100755 --- a/bin/omarchy-setup-fido2 +++ b/bin/omarchy-setup-fido2 @@ -1,5 +1,9 @@ #!/bin/bash +# omarchy:summary=Set up or remove FIDO2 authentication for sudo and polkit +# omarchy:args=[--remove] +# omarchy:requires-sudo=true + set -e GREEN='\033[0;32m' diff --git a/bin/omarchy-setup-fingerprint b/bin/omarchy-setup-fingerprint index 1579b586..77a97cb9 100755 --- a/bin/omarchy-setup-fingerprint +++ b/bin/omarchy-setup-fingerprint @@ -1,5 +1,9 @@ #!/bin/bash +# omarchy:summary=Set up or remove fingerprint authentication for sudo, polkit, and lock screen +# omarchy:args=[--remove] +# omarchy:requires-sudo=true + set -e GREEN='\033[0;32m' diff --git a/bin/omarchy-show-done b/bin/omarchy-show-done index 36f5aec2..60741076 100755 --- a/bin/omarchy-show-done +++ b/bin/omarchy-show-done @@ -1,7 +1,6 @@ #!/bin/bash -# Display a "Done!" message with a spinner and wait for user to press any key. -# Used by various install scripts to indicate completion. +# omarchy:summary=Display a "Done!" message with a spinner and wait for user to press any key. echo gum spin --spinner "globe" --title "Done! Press any key to close..." -- bash -c 'read -n 1 -s' diff --git a/bin/omarchy-show-logo b/bin/omarchy-show-logo index a6137c58..595bb487 100755 --- a/bin/omarchy-show-logo +++ b/bin/omarchy-show-logo @@ -1,7 +1,6 @@ #!/bin/bash -# Display the Omarchy logo in the terminal using green color. -# Used by various presentation scripts to show branding. +# omarchy:summary=Display the Omarchy logo in the terminal using green color. clear echo -e "\033[32m" diff --git a/bin/omarchy-snapshot b/bin/omarchy-snapshot index eb2ea2e3..ce1bc9ca 100755 --- a/bin/omarchy-snapshot +++ b/bin/omarchy-snapshot @@ -1,5 +1,9 @@ #!/bin/bash +# omarchy:summary=Create or restore system snapshots with snapper +# omarchy:args= +# omarchy:requires-sudo=true + set -e COMMAND="$1" diff --git a/bin/omarchy-state b/bin/omarchy-state index ff5e3e87..2a294df4 100755 --- a/bin/omarchy-state +++ b/bin/omarchy-state @@ -1,8 +1,7 @@ #!/bin/bash -# Manage persistent state files for Omarchy toggles and settings. -# Usage: omarchy-state -# Used to track whether features like suspend, idle lock, etc are enabled or disabled. +# omarchy:summary=Manage persistent state files for Omarchy toggles and settings. +# omarchy:args= STATE_DIR="$HOME/.local/state/omarchy" mkdir -p "$STATE_DIR" diff --git a/bin/omarchy-sudo-keepalive b/bin/omarchy-sudo-keepalive index c475198b..1f77a196 100755 --- a/bin/omarchy-sudo-keepalive +++ b/bin/omarchy-sudo-keepalive @@ -1,8 +1,7 @@ #!/bin/bash -# Prompt for sudo once and keep the credential alive in the background. -# Source this script so the trap applies to the calling shell: -# source omarchy-sudo-keepalive +# omarchy:summary=Prompt for sudo once and keep the credential alive in the background. +# omarchy:requires-sudo=true sudo -v while true; do sudo -n true; sleep 60; done 2>/dev/null & diff --git a/bin/omarchy-sudo-passwordless b/bin/omarchy-sudo-passwordless index d0cde92b..ad157ae9 100755 --- a/bin/omarchy-sudo-passwordless +++ b/bin/omarchy-sudo-passwordless @@ -1,9 +1,8 @@ #!/bin/bash -# Toggle passwordless sudo for the current user. -# Usage: omarchy-sudo-passwordless [MINUTES] -# First run: enables passwordless sudo for 15 minutes (after confirmation). -# Second run: disables it early. +# omarchy:summary=Toggle passwordless sudo for the current user. +# omarchy:args=[MINUTES] +# omarchy:requires-sudo=true NOPASSWD_FILE="/etc/sudoers.d/99-omarchy-nopasswd-${USER}" TIMER_NAME="omarchy-nopasswd-expire-${USER}" diff --git a/bin/omarchy-sudo-reset b/bin/omarchy-sudo-reset index 2c568469..56d91a8d 100755 --- a/bin/omarchy-sudo-reset +++ b/bin/omarchy-sudo-reset @@ -1,7 +1,5 @@ #!/bin/bash -# Reset the sudo lockout/faillock for the current user. -# This clears any failed authentication attempts that may have locked the user out. +# omarchy:summary=Reset the sudo lockout/faillock for the current user. -# Resetting sudo lockout for user su -c "faillock --reset --user $USER" diff --git a/bin/omarchy-swayosd-brightness b/bin/omarchy-swayosd-brightness index 8cc1f119..cf089a86 100755 --- a/bin/omarchy-swayosd-brightness +++ b/bin/omarchy-swayosd-brightness @@ -1,7 +1,7 @@ #!/bin/bash -# Display brightness level using SwayOSD on the current monitor. -# Usage: omarchy-swayosd-brightness +# omarchy:summary=Display brightness level using SwayOSD on the current monitor. +# omarchy:args= percent="$1" diff --git a/bin/omarchy-swayosd-client b/bin/omarchy-swayosd-client index e05beb4f..e8343aaa 100755 --- a/bin/omarchy-swayosd-client +++ b/bin/omarchy-swayosd-client @@ -1,5 +1,6 @@ #!/bin/bash -# Wrapper for swayosd-client that targets the currently focused monitor. +# omarchy:summary=Wrapper for swayosd-client that targets the currently focused monitor. +# omarchy:args= exec swayosd-client --monitor "$(omarchy-hyprland-monitor-focused)" "$@" diff --git a/bin/omarchy-swayosd-kbd-brightness b/bin/omarchy-swayosd-kbd-brightness index 729b7c4c..9252d475 100755 --- a/bin/omarchy-swayosd-kbd-brightness +++ b/bin/omarchy-swayosd-kbd-brightness @@ -1,7 +1,7 @@ #!/bin/bash -# Display keyboard brightness level using SwayOSD on the current monitor. -# Usage: omarchy-swayosd-kbd-brightness +# omarchy:summary=Display keyboard brightness level using SwayOSD on the current monitor. +# omarchy:args= percent="$1" diff --git a/bin/omarchy-system-lock b/bin/omarchy-system-lock index df40b335..0ccd4d90 100755 --- a/bin/omarchy-system-lock +++ b/bin/omarchy-system-lock @@ -1,8 +1,10 @@ #!/bin/bash -# Locks the system using hyprlock, but not before ensuring 1password has also been locked, and the screensaver stopped. +# omarchy:summary=Lock the screen +# omarchy:group=system +# omarchy:name=lock +# omarchy:examples=omarchy system lock -# Lock the screen pidof hyprlock || hyprlock & # Set keyboard layout to default (first layout) diff --git a/bin/omarchy-system-logout b/bin/omarchy-system-logout index bf70b861..c78f7485 100755 --- a/bin/omarchy-system-logout +++ b/bin/omarchy-system-logout @@ -1,9 +1,9 @@ #!/bin/bash -# Logout command that first closes all application windows (thus giving them a chance to save state), -# then stops the session, returning to the SDDM login screen. +# omarchy:summary=Log out after closing application windows +# omarchy:examples=omarchy logout | omarchy system logout +# omarchy:aliases=omarchy logout -# Schedule the session stop after closing windows (detached from terminal) nohup bash -c "sleep 2 && uwsm stop" >/dev/null 2>&1 & # Now close all windows diff --git a/bin/omarchy-system-reboot b/bin/omarchy-system-reboot index ec5f7cbc..661971bd 100755 --- a/bin/omarchy-system-reboot +++ b/bin/omarchy-system-reboot @@ -1,7 +1,8 @@ #!/bin/bash -# Reboot command that first closes all application windows (thus giving them a chance to save state). -# This is particularly helpful for applications like Chromium that otherwise won't shutdown cleanly. +# omarchy:summary=Reboot after closing application windows +# omarchy:examples=omarchy reboot | omarchy system reboot +# omarchy:aliases=omarchy reboot omarchy-state clear re*-required diff --git a/bin/omarchy-system-shutdown b/bin/omarchy-system-shutdown index be1a69d0..50e489ff 100755 --- a/bin/omarchy-system-shutdown +++ b/bin/omarchy-system-shutdown @@ -1,7 +1,8 @@ #!/bin/bash -# Shutdown command that first closes all application windows (thus giving them a chance to save state). -# This is particularly helpful for applications like Chromium that otherwise won't shutdown cleanly. +# omarchy:summary=Shut down after closing application windows +# omarchy:examples=omarchy shutdown | omarchy system shutdown +# omarchy:aliases=omarchy shutdown omarchy-state clear re*-required diff --git a/bin/omarchy-theme-bg-install b/bin/omarchy-theme-bg-install index 2ba2cb8b..60d23a7d 100755 --- a/bin/omarchy-theme-bg-install +++ b/bin/omarchy-theme-bg-install @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Open the current theme's user background folder + CURRENT_THEME_NAME=$(cat "$HOME/.config/omarchy/current/theme.name") THEME_USER_BACKGROUNDS="$HOME/.config/omarchy/backgrounds/$CURRENT_THEME_NAME" diff --git a/bin/omarchy-theme-bg-next b/bin/omarchy-theme-bg-next index 42f15340..e2d0bd4a 100755 --- a/bin/omarchy-theme-bg-next +++ b/bin/omarchy-theme-bg-next @@ -1,6 +1,7 @@ #!/bin/bash -# Cycles through the background images available +# omarchy:summary=Cycle to the next background for the current theme +# omarchy:examples=omarchy theme bg next THEME_NAME=$(cat "$HOME/.config/omarchy/current/theme.name" 2>/dev/null) THEME_BACKGROUNDS_PATH="$HOME/.config/omarchy/current/theme/backgrounds/" diff --git a/bin/omarchy-theme-bg-set b/bin/omarchy-theme-bg-set index 45992612..4b069086 100755 --- a/bin/omarchy-theme-bg-set +++ b/bin/omarchy-theme-bg-set @@ -1,6 +1,8 @@ #!/bin/bash -# Sets the specified image as the current background +# omarchy:summary=Set the current background image +# omarchy:args= +# omarchy:examples=omarchy theme bg set ~/Pictures/wallpaper.png if [[ -z $1 ]]; then echo "Usage: omarchy-theme-bg-set " >&2 diff --git a/bin/omarchy-theme-colors-from-alacritty b/bin/omarchy-theme-colors-from-alacritty index 8f69aeee..7c41b5ec 100755 --- a/bin/omarchy-theme-colors-from-alacritty +++ b/bin/omarchy-theme-colors-from-alacritty @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Generate a theme's colors.toml from its alacritty.toml palette +# omarchy:args= + set -e THEME_SOURCE="${1:-}" diff --git a/bin/omarchy-theme-current b/bin/omarchy-theme-current index fc2dab31..f645e52e 100755 --- a/bin/omarchy-theme-current +++ b/bin/omarchy-theme-current @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Show current theme +# omarchy:examples=omarchy theme current + THEME_NAME_PATH="$HOME/.config/omarchy/current/theme.name" if [[ -f $THEME_NAME_PATH ]]; then diff --git a/bin/omarchy-theme-install b/bin/omarchy-theme-install index 5949c7ea..5cd29bde 100755 --- a/bin/omarchy-theme-install +++ b/bin/omarchy-theme-install @@ -1,7 +1,8 @@ #!/bin/bash -# omarchy-theme-install: Install a new theme from a git repo for Omarchy -# Usage: omarchy-theme-install +# omarchy:summary=Install a theme from a git repository +# omarchy:args=[git-repo-url] +# omarchy:examples=omarchy theme install https://github.com/example/omarchy-example-theme.git if [[ -z $1 ]]; then echo -e "\e[32mSee https://manuals.omamix.org/2/the-omarchy-manual/90/extra-themes\n\e[0m" diff --git a/bin/omarchy-theme-list b/bin/omarchy-theme-list index 08678288..0b901fc0 100755 --- a/bin/omarchy-theme-list +++ b/bin/omarchy-theme-list @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=List available themes +# omarchy:examples=omarchy theme list | omarchy theme set "Tokyo Night" + { find ~/.config/omarchy/themes/ -mindepth 1 -maxdepth 1 \( -type d -o -type l \) -printf '%f\n' find "$OMARCHY_PATH/themes/" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' diff --git a/bin/omarchy-theme-refresh b/bin/omarchy-theme-refresh index e967f289..bbd79a31 100755 --- a/bin/omarchy-theme-refresh +++ b/bin/omarchy-theme-refresh @@ -1,6 +1,6 @@ #!/bin/bash -# Refresh the current theme from its templates. +# omarchy:summary=Refresh the current theme from its templates. THEME_NAME_PATH="$HOME/.config/omarchy/current/theme.name" diff --git a/bin/omarchy-theme-remove b/bin/omarchy-theme-remove index 98a81fa0..dac33cd4 100755 --- a/bin/omarchy-theme-remove +++ b/bin/omarchy-theme-remove @@ -1,7 +1,8 @@ #!/bin/bash -# omarchy-theme-remove: Remove a theme from Omarchy by name -# Usage: omarchy-theme-remove +# omarchy:summary=Remove a user-installed theme +# omarchy:args=[theme-name] +# omarchy:examples=omarchy theme remove "Tokyo Night" if [[ -z $1 ]]; then mapfile -t extra_themes < <(find ~/.config/omarchy/themes -mindepth 1 -maxdepth 1 -type d ! -xtype l -printf '%f\n') diff --git a/bin/omarchy-theme-set b/bin/omarchy-theme-set index a5718713..6830bca0 100755 --- a/bin/omarchy-theme-set +++ b/bin/omarchy-theme-set @@ -1,5 +1,9 @@ #!/bin/bash +# omarchy:summary=Apply an Omarchy theme +# omarchy:args= +# omarchy:examples=omarchy theme list | omarchy theme set "Tokyo Night" + if [[ -z $1 ]]; then echo "Usage: omarchy-theme-set " exit 1 diff --git a/bin/omarchy-theme-set-browser b/bin/omarchy-theme-set-browser index aa07c39c..e43f0634 100755 --- a/bin/omarchy-theme-set-browser +++ b/bin/omarchy-theme-set-browser @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Apply the current theme color to Chromium and Brave + CHROMIUM_THEME=~/.config/omarchy/current/theme/chromium.theme if omarchy-cmd-present chromium || omarchy-cmd-present brave || omarchy-cmd-present brave-origin-beta; then diff --git a/bin/omarchy-theme-set-gnome b/bin/omarchy-theme-set-gnome index da25b66a..66e3e204 100755 --- a/bin/omarchy-theme-set-gnome +++ b/bin/omarchy-theme-set-gnome @@ -1,6 +1,7 @@ #!/bin/bash -# Change gnome modes +# omarchy:summary=Apply the current theme to GNOME color mode and icon settings + if [[ -f ~/.config/omarchy/current/theme/light.mode ]]; then gsettings set org.gnome.desktop.interface color-scheme "prefer-light" gsettings set org.gnome.desktop.interface gtk-theme "Adwaita" diff --git a/bin/omarchy-theme-set-keyboard b/bin/omarchy-theme-set-keyboard index 6c237a8e..7fc9c7a5 100755 --- a/bin/omarchy-theme-set-keyboard +++ b/bin/omarchy-theme-set-keyboard @@ -1,4 +1,6 @@ #!/bin/bash +# omarchy:summary=Apply the current theme keyboard color to supported keyboards + omarchy-theme-set-keyboard-asus-rog omarchy-theme-set-keyboard-f16 diff --git a/bin/omarchy-theme-set-keyboard-asus-rog b/bin/omarchy-theme-set-keyboard-asus-rog index e0078ee4..971097e6 100755 --- a/bin/omarchy-theme-set-keyboard-asus-rog +++ b/bin/omarchy-theme-set-keyboard-asus-rog @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Apply the current theme keyboard color to ASUS ROG keyboards + ASUSCTL_THEME=~/.config/omarchy/current/theme/keyboard.rgb if omarchy-cmd-present asusctl; then diff --git a/bin/omarchy-theme-set-keyboard-f16 b/bin/omarchy-theme-set-keyboard-f16 index 1a30991e..466690d4 100755 --- a/bin/omarchy-theme-set-keyboard-f16 +++ b/bin/omarchy-theme-set-keyboard-f16 @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Apply the current theme keyboard color to Framework Laptop 16 keyboards + FRAMEWORK16_THEME=~/.config/omarchy/current/theme/keyboard.rgb if omarchy-cmd-present qmk_hid && [[ -f $FRAMEWORK16_THEME ]]; then diff --git a/bin/omarchy-theme-set-obsidian b/bin/omarchy-theme-set-obsidian index 420bd8c3..dd9468aa 100755 --- a/bin/omarchy-theme-set-obsidian +++ b/bin/omarchy-theme-set-obsidian @@ -1,6 +1,6 @@ #!/bin/bash -# Sync Omarchy theme to all Obsidian vaults +# omarchy:summary=Sync Omarchy theme to all Obsidian vaults CURRENT_THEME_DIR="$HOME/.config/omarchy/current/theme" diff --git a/bin/omarchy-theme-set-templates b/bin/omarchy-theme-set-templates index fde3ad18..f272ffff 100755 --- a/bin/omarchy-theme-set-templates +++ b/bin/omarchy-theme-set-templates @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Generate themed config files from Omarchy templates + TEMPLATES_DIR="$OMARCHY_PATH/default/themed" USER_TEMPLATES_DIR="$HOME/.config/omarchy/themed" NEXT_THEME_DIR="$HOME/.config/omarchy/current/next-theme" diff --git a/bin/omarchy-theme-set-vscode b/bin/omarchy-theme-set-vscode index bc9b5716..cc66ed0d 100755 --- a/bin/omarchy-theme-set-vscode +++ b/bin/omarchy-theme-set-vscode @@ -1,6 +1,6 @@ #!/bin/bash -# Sync Omarchy theme to VS Code, VSCodium, and Cursor +# omarchy:summary=Sync Omarchy theme to VS Code, VSCodium, and Cursor VS_CODE_THEME="$HOME/.config/omarchy/current/theme/vscode.json" diff --git a/bin/omarchy-theme-update b/bin/omarchy-theme-update index cfb823f4..a68cb176 100755 --- a/bin/omarchy-theme-update +++ b/bin/omarchy-theme-update @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Update user-installed git themes + for dir in ~/.config/omarchy/themes/*/; do if [[ -d $dir ]] && [[ ! -L ${dir%/} ]] && [[ -d $dir/.git ]]; then echo "Updating: $(basename "$dir")" diff --git a/bin/omarchy-toggle b/bin/omarchy-toggle index 7db467fa..f5eb1a3b 100755 --- a/bin/omarchy-toggle +++ b/bin/omarchy-toggle @@ -1,6 +1,7 @@ #!/bin/bash -# Toggle Omarchy features between enabled and disabled +# omarchy:summary=Toggle Omarchy features between enabled and disabled +# omarchy:args=[--enabled-notification ] [--disabled-notification ] ENABLED_NOTIFICATION="" DISABLED_NOTIFICATION="" diff --git a/bin/omarchy-toggle-enabled b/bin/omarchy-toggle-enabled index dd37c881..dd4f58c6 100755 --- a/bin/omarchy-toggle-enabled +++ b/bin/omarchy-toggle-enabled @@ -1,4 +1,6 @@ #!/bin/bash -# Check if a toggle is enabled (flag file exists) +# omarchy:summary=Check if a toggle is enabled (flag file exists) +# omarchy:args= + [[ -f "$HOME/.local/state/omarchy/toggles/$1" ]] diff --git a/bin/omarchy-toggle-hybrid-gpu b/bin/omarchy-toggle-hybrid-gpu index 4c573243..89b3ae8e 100755 --- a/bin/omarchy-toggle-hybrid-gpu +++ b/bin/omarchy-toggle-hybrid-gpu @@ -1,9 +1,8 @@ #!/bin/bash -# Toggle dedicated vs integrated GPU mode via supergfxd (for hybrid gpu laptops, like Asus G14). -# Requires reboot to take effect. +# omarchy:summary=Toggle dedicated vs integrated GPU mode via supergfxd (for hybrid gpu laptops, like Asus G14). +# omarchy:requires-sudo=true -# Ensure supergfxctl has been installed if omarchy-cmd-missing supergfxctl; then omarchy-pkg-add supergfxctl diff --git a/bin/omarchy-toggle-idle b/bin/omarchy-toggle-idle index a80eec45..622f1ab4 100755 --- a/bin/omarchy-toggle-idle +++ b/bin/omarchy-toggle-idle @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Toggle hypridle idle locking + if pgrep -x hypridle >/dev/null; then pkill -x hypridle notify-send -u low "󱫖 Stop locking computer when idle" diff --git a/bin/omarchy-toggle-nightlight b/bin/omarchy-toggle-nightlight index e05a1d45..c308b757 100755 --- a/bin/omarchy-toggle-nightlight +++ b/bin/omarchy-toggle-nightlight @@ -1,6 +1,8 @@ #!/bin/bash -# Default temperature values +# omarchy:summary=Toggle nightlight screen temperature +# omarchy:examples=omarchy toggle nightlight + ON_TEMP=4000 OFF_TEMP=6000 diff --git a/bin/omarchy-toggle-notification-silencing b/bin/omarchy-toggle-notification-silencing index 15ee7b5b..5e327ec2 100755 --- a/bin/omarchy-toggle-notification-silencing +++ b/bin/omarchy-toggle-notification-silencing @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Toggle notification do-not-disturb mode + makoctl mode -t do-not-disturb if makoctl mode | grep -q 'do-not-disturb'; then diff --git a/bin/omarchy-toggle-screensaver b/bin/omarchy-toggle-screensaver index 33e8d1bc..681c35ef 100755 --- a/bin/omarchy-toggle-screensaver +++ b/bin/omarchy-toggle-screensaver @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Toggle screensaver availability + omarchy-toggle \ --enabled-notification "󱄄 Screensaver disabled" \ --disabled-notification "󱄄 Screensaver enabled" \ diff --git a/bin/omarchy-toggle-suspend b/bin/omarchy-toggle-suspend index cd0d2191..c9ecac0a 100755 --- a/bin/omarchy-toggle-suspend +++ b/bin/omarchy-toggle-suspend @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Toggle suspend availability in the system menu + omarchy-toggle \ --enabled-notification "󰒲 Suspend removed from system menu" \ --disabled-notification "󰒲 Suspend now available in system menu" \ diff --git a/bin/omarchy-toggle-touchpad b/bin/omarchy-toggle-touchpad index 6c8428ca..06764dab 100755 --- a/bin/omarchy-toggle-touchpad +++ b/bin/omarchy-toggle-touchpad @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Enable, disable, or toggle the touchpad +# omarchy:args=[on|off|toggle] + STATE_CONF="$HOME/.local/state/omarchy/toggles/hypr/touchpad-disabled.conf" device="$(omarchy-hw-touchpad)" diff --git a/bin/omarchy-toggle-touchscreen b/bin/omarchy-toggle-touchscreen index 81414c98..a0b5ccb0 100755 --- a/bin/omarchy-toggle-touchscreen +++ b/bin/omarchy-toggle-touchscreen @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Enable, disable, or toggle the touch functionality of the screen +# omarchy:args=[on|off|toggle] + STATE_CONF="$HOME/.local/state/omarchy/toggles/hypr/touchscreen-disabled.conf" device="$(omarchy-hw-touchscreen)" @@ -26,4 +29,4 @@ case "${1:-toggle}" in on) enable ;; off) disable ;; toggle) if [[ -f $STATE_CONF ]]; then enable; else disable; fi ;; -esac \ No newline at end of file +esac diff --git a/bin/omarchy-toggle-waybar b/bin/omarchy-toggle-waybar index 25762820..b441f011 100755 --- a/bin/omarchy-toggle-waybar +++ b/bin/omarchy-toggle-waybar @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Toggle Waybar visibility +# omarchy:examples=omarchy toggle waybar + omarchy-toggle waybar-off if pgrep -x waybar >/dev/null; then diff --git a/bin/omarchy-tui-install b/bin/omarchy-tui-install index 2d6397a2..d529b54f 100755 --- a/bin/omarchy-tui-install +++ b/bin/omarchy-tui-install @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Create a desktop launcher for a terminal UI app +# omarchy:args=[name command window-style icon-url] + set -e if (( $# != 4 )); then diff --git a/bin/omarchy-tui-remove b/bin/omarchy-tui-remove index 3b97df8c..369528e2 100755 --- a/bin/omarchy-tui-remove +++ b/bin/omarchy-tui-remove @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Remove terminal UI desktop launchers +# omarchy:args=[name...] + set -e ICON_DIR="$HOME/.local/share/applications/icons" diff --git a/bin/omarchy-tui-remove-all b/bin/omarchy-tui-remove-all index 8efe4d80..7f1c11f0 100755 --- a/bin/omarchy-tui-remove-all +++ b/bin/omarchy-tui-remove-all @@ -1,7 +1,6 @@ #!/bin/bash -# Remove all TUIs installed via omarchy-tui-install. -# Identifies TUIs by their Exec pattern (xdg-terminal-exec --app-id=TUI.). +# omarchy:summary=Remove all TUIs installed via omarchy-tui-install. set -e diff --git a/bin/omarchy-tz-select b/bin/omarchy-tz-select index 24003228..6ddb26c2 100755 --- a/bin/omarchy-tz-select +++ b/bin/omarchy-tz-select @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Select and set the system timezone +# omarchy:requires-sudo=true + timezone=$(timedatectl list-timezones | gum filter --height 20 --header "Set timezone") || exit 1 sudo timedatectl set-timezone "$timezone" echo "Timezone is now set to $timezone" diff --git a/bin/omarchy-update b/bin/omarchy-update index a9b2ba8d..f1ca5bc0 100755 --- a/bin/omarchy-update +++ b/bin/omarchy-update @@ -1,5 +1,10 @@ #!/bin/bash +# omarchy:summary=Update Omarchy and system packages +# omarchy:args=[-y] +# omarchy:examples=omarchy update | omarchy update -y +# omarchy:requires-sudo=true + set -e # Run the update inside a PTY so pacman/yay keep showing download progress diff --git a/bin/omarchy-update-analyze-logs b/bin/omarchy-update-analyze-logs index fb42e82e..1febd99d 100755 --- a/bin/omarchy-update-analyze-logs +++ b/bin/omarchy-update-analyze-logs @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Check the update log for known failure conditions + update_log="/tmp/omarchy-update.log" # Check for initramfs generation failure diff --git a/bin/omarchy-update-aur-pkgs b/bin/omarchy-update-aur-pkgs index 0dee5edf..4f496b33 100755 --- a/bin/omarchy-update-aur-pkgs +++ b/bin/omarchy-update-aur-pkgs @@ -1,6 +1,7 @@ #!/bin/bash -# Update AUR packages if any are installed +# omarchy:summary=Update AUR packages if any are installed + if pacman -Qem >/dev/null; then if omarchy-pkg-aur-accessible; then echo -e "\e[32m\nUpdate AUR packages\e[0m" diff --git a/bin/omarchy-update-available b/bin/omarchy-update-available index e5d19cf7..92c57adc 100755 --- a/bin/omarchy-update-available +++ b/bin/omarchy-update-available @@ -1,6 +1,7 @@ #!/bin/bash -# Get remote tag +# omarchy:summary=Get remote tag + latest_tag=$(git -C "$OMARCHY_PATH" ls-remote --tags origin | grep -v "{}" | awk '{print $2}' | sed 's#refs/tags/##' | sort -V | tail -n 1) if [[ -z $latest_tag ]]; then echo "Error: Could not retrieve latest tag." diff --git a/bin/omarchy-update-available-reset b/bin/omarchy-update-available-reset index 2f136cb0..d1e2ca4c 100755 --- a/bin/omarchy-update-available-reset +++ b/bin/omarchy-update-available-reset @@ -1,5 +1,6 @@ #!/bin/bash -# Ensure Waybar icon offering the available update is removed +# omarchy:summary=Ensure Waybar icon offering the available update is removed + pkill -RTMIN+7 waybar exit 0 diff --git a/bin/omarchy-update-branch b/bin/omarchy-update-branch index b10822cd..fa294b63 100755 --- a/bin/omarchy-update-branch +++ b/bin/omarchy-update-branch @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Switch Omarchy branches and update from the selected branch +# omarchy:args= + set -e if (($# == 0)); then diff --git a/bin/omarchy-update-confirm b/bin/omarchy-update-confirm index df3d8145..6cdddaaf 100755 --- a/bin/omarchy-update-confirm +++ b/bin/omarchy-update-confirm @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Prompt for confirmation before starting an update + gum style --border normal --border-foreground 6 --padding "1 2" \ "Ready to update?" \ "" \ diff --git a/bin/omarchy-update-firmware b/bin/omarchy-update-firmware index d0613d82..f6dad359 100755 --- a/bin/omarchy-update-firmware +++ b/bin/omarchy-update-firmware @@ -1,7 +1,7 @@ #!/bin/bash -# Update system firmware using fwupd. Ensures the fwupd EFI binary is installed -# in the ESP so UEFI capsule updates work with the Limine bootloader. +# omarchy:summary=Update system firmware using fwupd. Ensures the fwupd EFI binary is installed +# omarchy:requires-sudo=true set -e echo -e "\e[32mUpdate Firmware\e[0m" diff --git a/bin/omarchy-update-git b/bin/omarchy-update-git index 04e428bb..5c64b624 100755 --- a/bin/omarchy-update-git +++ b/bin/omarchy-update-git @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Pull the latest Omarchy git changes + set -e echo -e "\e[32mUpdate Omarchy\e[0m" diff --git a/bin/omarchy-update-keyring b/bin/omarchy-update-keyring index 32bd3f22..74894f2b 100755 --- a/bin/omarchy-update-keyring +++ b/bin/omarchy-update-keyring @@ -1,6 +1,8 @@ #!/bin/bash -# Ensure we have the omarchy-keyring and it's populated +# omarchy:summary=Ensure the Omarchy keyring package is installed and populated +# omarchy:requires-sudo=true + if omarchy-pkg-missing omarchy-keyring || ! sudo pacman-key --list-keys 40DFB630FF42BCFFB047046CF0134EE680CAC571 &>/dev/null; then sudo pacman-key --recv-keys 40DFB630FF42BCFFB047046CF0134EE680CAC571 --keyserver keys.openpgp.org sudo pacman-key --lsign-key 40DFB630FF42BCFFB047046CF0134EE680CAC571 diff --git a/bin/omarchy-update-orphan-pkgs b/bin/omarchy-update-orphan-pkgs index 3d7a3511..b1486867 100755 --- a/bin/omarchy-update-orphan-pkgs +++ b/bin/omarchy-update-orphan-pkgs @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Remove orphaned system packages after updates +# omarchy:requires-sudo=true + orphans=$(pacman -Qtdq || true) if [[ -n $orphans ]]; then echo -e "\e[32m\nRemove orphan system packages\e[0m" diff --git a/bin/omarchy-update-perform b/bin/omarchy-update-perform index d98b96c3..6e892610 100755 --- a/bin/omarchy-update-perform +++ b/bin/omarchy-update-perform @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Run the full Omarchy update pipeline +# omarchy:requires-sudo=true + set -e # Ensure screensaver/sleep doesn't set in during updates diff --git a/bin/omarchy-update-restart b/bin/omarchy-update-restart index e4d835b8..3441e45f 100755 --- a/bin/omarchy-update-restart +++ b/bin/omarchy-update-restart @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Prompt for required reboot or service restarts after updates + echo running_kernel=$(uname -r) diff --git a/bin/omarchy-update-system-pkgs b/bin/omarchy-update-system-pkgs index 36a78418..6c6719f8 100755 --- a/bin/omarchy-update-system-pkgs +++ b/bin/omarchy-update-system-pkgs @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Update system packages with pacman +# omarchy:requires-sudo=true + set -e echo -e "\e[32m\nUpdate system packages\e[0m" diff --git a/bin/omarchy-update-time b/bin/omarchy-update-time index 14fc8b6f..c5e1d80b 100755 --- a/bin/omarchy-update-time +++ b/bin/omarchy-update-time @@ -1,4 +1,7 @@ #!/bin/bash +# omarchy:summary=Restart system time synchronization +# omarchy:requires-sudo=true + echo "Updating time..." sudo systemctl restart systemd-timesyncd diff --git a/bin/omarchy-update-without-idle b/bin/omarchy-update-without-idle index 20d1ef10..62a38fa4 100755 --- a/bin/omarchy-update-without-idle +++ b/bin/omarchy-update-without-idle @@ -1,5 +1,3 @@ #!/bin/bash -# No-op now that omarchy-update-perform is responsible for idle management. -# But this file can't be removed since it was referenced in old omarchy-update files, -# which would fail if this file is missing. +# omarchy:summary=No-op now that omarchy-update-perform is responsible for idle management. diff --git a/bin/omarchy-upload-log b/bin/omarchy-upload-log index c084f518..6d38eee8 100755 --- a/bin/omarchy-upload-log +++ b/bin/omarchy-upload-log @@ -1,6 +1,7 @@ #!/bin/bash -# Upload logs to 0x0.st +# omarchy:summary=Upload logs to 0x0.st +# omarchy:args= LOG_TYPE="${1:-install}" TEMP_LOG="/tmp/upload-log.txt" diff --git a/bin/omarchy-version b/bin/omarchy-version index 5ddc823f..da8b4974 100755 --- a/bin/omarchy-version +++ b/bin/omarchy-version @@ -1,2 +1,5 @@ #!/bin/bash + +# omarchy:summary=Print the installed Omarchy version + cat $OMARCHY_PATH/version diff --git a/bin/omarchy-version-branch b/bin/omarchy-version-branch index 43281d9a..898a71cd 100755 --- a/bin/omarchy-version-branch +++ b/bin/omarchy-version-branch @@ -1,3 +1,5 @@ #!/bin/bash +# omarchy:summary=Print the current Omarchy git branch + echo $(git -C "$OMARCHY_PATH" rev-parse --abbrev-ref HEAD) diff --git a/bin/omarchy-version-channel b/bin/omarchy-version-channel index 76233513..8a646cec 100755 --- a/bin/omarchy-version-channel +++ b/bin/omarchy-version-channel @@ -1,5 +1,7 @@ #!/bin/bash +# omarchy:summary=Print the active Omarchy mirror and package channel + if grep -q "https://stable-mirror.omarchy.org/" /etc/pacman.d/mirrorlist; then mirror="stable" elif grep -q "https://rc-mirror.omarchy.org/" /etc/pacman.d/mirrorlist; then diff --git a/bin/omarchy-version-pkgs b/bin/omarchy-version-pkgs index bc638110..9a37fb9a 100755 --- a/bin/omarchy-version-pkgs +++ b/bin/omarchy-version-pkgs @@ -1,3 +1,5 @@ #!/bin/bash +# omarchy:summary=Print when system packages were last upgraded + date -d "$(grep upgraded /var/log/pacman.log | tail -1 | sed -E 's/\[([^]]+)\].*/\1/')" "+%A, %B %d %Y at %H:%M" diff --git a/bin/omarchy-voxtype-config b/bin/omarchy-voxtype-config index 78a3254f..57665be4 100755 --- a/bin/omarchy-voxtype-config +++ b/bin/omarchy-voxtype-config @@ -1,4 +1,7 @@ #!/bin/bash + +# omarchy:summary=Open the Voxtype configuration file + set -e # Used by Voxtype waybar module to open config on right click diff --git a/bin/omarchy-voxtype-install b/bin/omarchy-voxtype-install index 6d2e1c42..9cb7af75 100755 --- a/bin/omarchy-voxtype-install +++ b/bin/omarchy-voxtype-install @@ -1,4 +1,8 @@ #!/bin/bash + +# omarchy:summary=Install and configure Voxtype dictation +# omarchy:requires-sudo=true + set -e # Install voxtype and configure it for use. diff --git a/bin/omarchy-voxtype-model b/bin/omarchy-voxtype-model index b58047d4..00ccb426 100755 --- a/bin/omarchy-voxtype-model +++ b/bin/omarchy-voxtype-model @@ -1,4 +1,7 @@ #!/bin/bash + +# omarchy:summary=Open Voxtype AI model setup + set -e omarchy-launch-floating-terminal-with-presentation "voxtype setup model" diff --git a/bin/omarchy-voxtype-remove b/bin/omarchy-voxtype-remove index b2083d15..4253f73d 100755 --- a/bin/omarchy-voxtype-remove +++ b/bin/omarchy-voxtype-remove @@ -1,4 +1,8 @@ #!/bin/bash + +# omarchy:summary=Remove Voxtype dictation and its configuration +# omarchy:requires-sudo=true + set -e # Remove voxtype and its configurations. diff --git a/bin/omarchy-voxtype-status b/bin/omarchy-voxtype-status index acab6f30..9576efaa 100755 --- a/bin/omarchy-voxtype-status +++ b/bin/omarchy-voxtype-status @@ -1,6 +1,7 @@ #!/bin/bash -# Clean up the voxtype --follow child when Waybar reloads +# omarchy:summary=Clean up the voxtype --follow child when Waybar reloads + trap 'kill 0' EXIT if omarchy-cmd-present voxtype; then diff --git a/bin/omarchy-webapp-handler-hey b/bin/omarchy-webapp-handler-hey index 37f4cf2d..b7c773d6 100755 --- a/bin/omarchy-webapp-handler-hey +++ b/bin/omarchy-webapp-handler-hey @@ -1,4 +1,8 @@ #!/bin/bash + +# omarchy:summary=Open HEY webmail and translate mailto links +# omarchy:args=[url] + url="$1" web_url="https://app.hey.com" diff --git a/bin/omarchy-webapp-handler-zoom b/bin/omarchy-webapp-handler-zoom index a27411ed..6692041f 100755 --- a/bin/omarchy-webapp-handler-zoom +++ b/bin/omarchy-webapp-handler-zoom @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Open Zoom web meetings from browser protocol links +# omarchy:args=[url] + url="$1" web_url="https://app.zoom.us/wc/home" diff --git a/bin/omarchy-webapp-install b/bin/omarchy-webapp-install index 264c7ea9..dbf00609 100755 --- a/bin/omarchy-webapp-install +++ b/bin/omarchy-webapp-install @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Create a desktop launcher for a web app +# omarchy:args=[name url icon [custom-exec] [mime-types]] + set -e ICON_DIR="$HOME/.local/share/applications/icons" diff --git a/bin/omarchy-webapp-remove b/bin/omarchy-webapp-remove index 54f46aa5..d4db5270 100755 --- a/bin/omarchy-webapp-remove +++ b/bin/omarchy-webapp-remove @@ -1,5 +1,8 @@ #!/bin/bash +# omarchy:summary=Remove web app desktop launchers +# omarchy:args=[name...] + set -e ICON_DIR="$HOME/.local/share/applications/icons" diff --git a/bin/omarchy-webapp-remove-all b/bin/omarchy-webapp-remove-all index 5b431ad2..142da29d 100755 --- a/bin/omarchy-webapp-remove-all +++ b/bin/omarchy-webapp-remove-all @@ -1,7 +1,6 @@ #!/bin/bash -# Remove all web apps installed via omarchy-webapp-install. -# Identifies web apps by their Exec pattern (omarchy-launch-webapp or omarchy-webapp-handler). +# omarchy:summary=Remove all web apps installed via omarchy-webapp-install. set -e diff --git a/bin/omarchy-wifi-powersave b/bin/omarchy-wifi-powersave index 9e1c5bbe..26810e52 100755 --- a/bin/omarchy-wifi-powersave +++ b/bin/omarchy-wifi-powersave @@ -1,4 +1,8 @@ #!/bin/bash + +# omarchy:summary=Set Wi-Fi power save mode on wireless interfaces +# omarchy:args= + for iface in /sys/class/net/*/wireless; do iface="$(basename "$(dirname "$iface")")" iw dev "$iface" set power_save "$1" 2>/dev/null diff --git a/bin/omarchy-windows-vm b/bin/omarchy-windows-vm index 70386213..ec918875 100755 --- a/bin/omarchy-windows-vm +++ b/bin/omarchy-windows-vm @@ -1,4 +1,9 @@ #!/bin/bash + +# omarchy:summary=Install, launch, stop, inspect, or remove the Windows VM +# omarchy:args= [options] +# omarchy:requires-sudo=true + COMPOSE_FILE="$HOME/.config/windows/docker-compose.yml" check_prerequisites() { diff --git a/default/bash/completions b/default/bash/completions new file mode 100644 index 00000000..6de3f458 --- /dev/null +++ b/default/bash/completions @@ -0,0 +1,53 @@ +_omarchy_complete() { + COMPREPLY=() + local cur="${COMP_WORDS[COMP_CWORD]}" + + local omarchy_path bin_dir + omarchy_path=$(command -v omarchy 2>/dev/null) || return 0 + bin_dir=$(dirname -- "$(readlink -f -- "$omarchy_path" 2>/dev/null || printf '%s' "$omarchy_path")") + [[ -d $bin_dir ]] || return 0 + + local prefix="omarchy" + local i part + for ((i = 1; i < COMP_CWORD; i++)); do + part="${COMP_WORDS[i]}" + [[ -z $part || $part == -* ]] && continue + prefix+="-$part" + done + + local -A seen=() + local candidates=() + local file basename rest next + + shopt -s nullglob + for file in "$bin_dir/$prefix"-*; do + [[ -f $file && -x $file ]] || continue + basename="${file##*/}" + rest="${basename#"$prefix"-}" + next="${rest%%-*}" + if [[ -n $next && -z ${seen[$next]:-} ]]; then + seen[$next]=1 + candidates+=("$next") + fi + done + shopt -u nullglob + + if (( COMP_CWORD == 1 )); then + candidates+=("commands") + fi + + if [[ ${COMP_WORDS[1]:-} == "commands" ]] && (( COMP_CWORD >= 2 )); then + candidates+=("--all" "--json" "--markdown" "--check") + fi + + if [[ -x $bin_dir/$prefix || ${#candidates[@]} -gt 0 ]]; then + candidates+=("--help") + fi + + if (( ${#candidates[@]} > 0 )); then + local IFS=$'\n' + COMPREPLY=($(compgen -W "${candidates[*]}" -- "$cur")) + fi +} + +complete -F _omarchy_complete omarchy diff --git a/default/bash/init b/default/bash/init index d2baba50..c3d8c97a 100644 --- a/default/bash/init +++ b/default/bash/init @@ -26,3 +26,5 @@ if command -v fzf &> /dev/null; then source /usr/share/fzf/key-bindings.bash fi fi + +source "$OMARCHY_PATH/default/bash/completions" diff --git a/test/omarchy-cli-test.sh b/test/omarchy-cli-test.sh new file mode 100755 index 00000000..5763920a --- /dev/null +++ b/test/omarchy-cli-test.sh @@ -0,0 +1,260 @@ +#!/bin/bash + +set -euo pipefail + +ROOT=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd) +CLI="$ROOT/bin/omarchy" +TMPDIR="" + +export PATH="$ROOT/bin:$PATH" + +pass() { + printf 'ok - %s\n' "$1" +} + +fail() { + printf 'not ok - %s\n' "$1" >&2 + exit 1 +} + +assert_output_contains() { + local description="$1" + local output="$2" + local expected="$3" + + if [[ $output != *"$expected"* ]]; then + printf 'Expected output to contain: %s\n' "$expected" >&2 + printf 'Actual output:\n%s\n' "$output" >&2 + fail "$description" + fi + + pass "$description" +} + +cleanup() { + [[ -n $TMPDIR && -d $TMPDIR ]] && rm -rf "$TMPDIR" +} +trap cleanup EXIT + +output=$("$CLI" --help) +assert_output_contains "main help renders" "$output" "Omarchy command center" +assert_output_contains "main help includes hardware group" "$output" "hw" +assert_output_contains "main help includes package group" "$output" "pkg" +if grep -Eq '^ [a-z0-9-]+[[:space:]].*\([0-9]+\)$' <<<"$output"; then + fail "main help does not show group counts" +fi +pass "main help does not show group counts" + +output=$("$CLI" commands) +assert_output_contains "commands lists documented commands" "$output" "omarchy theme set " + +"$CLI" commands --json | jq -e '.ok == true and (.commands | length >= 200)' >/dev/null +pass "commands --json is valid JSON with full bin coverage" + +"$CLI" commands --json | jq -e 'all(.commands[]; .summary != "undocumented")' >/dev/null +pass "all included commands have summaries" + +"$CLI" commands --json | jq -e 'all(.commands[]; has("binary") and has("filename_route") and has("routes") and (has("legacy") | not) and (has("usage") | not) and (has("visibility") | not) and (has("mutates") | not) and (has("interactive") | not))' >/dev/null +pass "JSON uses binary/routes and omits legacy/usage/extra metadata" + +"$CLI" commands --check >/dev/null +pass "commands --check passes" + +"$CLI" commands --all >/dev/null +pass "commands --all does not crash" + +"$CLI" commands --all --json | jq -e '.commands[] | select(.route == "omarchy hyprland window gaps toggle" and .summary != "undocumented")' >/dev/null +pass "fallback commands are inferred and documented" + +"$CLI" commands --all --json | jq -e '.commands[] | select(.route == "omarchy dev benchmark")' >/dev/null +pass "benchmark command is discoverable in all commands" + +"$CLI" commands --json | jq -e '.commands[] | select(.binary == "omarchy-pkg-add" and .route == "omarchy install package" and .filename_route == "omarchy pkg add" and (.routes | index("omarchy pkg add")))' >/dev/null +pass "JSON exposes canonical and filename-derived routes" + +"$CLI" commands --json | jq -e '.commands[] | select(.binary == "omarchy-refresh-pacman" and .requires_sudo == true)' >/dev/null +pass "sudo metadata marks sudo commands" + +output=$("$CLI" theme --help) +assert_output_contains "group help renders" "$output" "Theme commands" + +output=$("$CLI" install --help) +assert_output_contains "install group help renders" "$output" "omarchy install package " + +output=$("$CLI" install) +assert_output_contains "bare group renders help instead of picker" "$output" "Install commands" +assert_output_contains "bare group includes package route" "$output" "omarchy install package " + +output=$("$CLI" toggle) +assert_output_contains "bare root command with children renders help" "$output" "Toggle commands" +assert_output_contains "bare toggle help includes child route" "$output" "omarchy toggle waybar" + +output=$("$CLI" pkg --help) +assert_output_contains "package group includes pkg add fallback route" "$output" "omarchy pkg add " + +output=$("$CLI" restart --help) +assert_output_contains "restart group includes inferred commands" "$output" "omarchy restart btop" +assert_output_contains "restart group includes all restart commands" "$output" "omarchy restart wifi" + +output=$("$CLI" hw --help) +assert_output_contains "hardware group help renders" "$output" "omarchy hw asus rog" +assert_output_contains "hardware group includes touchpad" "$output" "omarchy hw touchpad" + +output=$("$CLI" menu --help) +assert_output_contains "menu group includes share fallback route" "$output" "omarchy menu share" + +output=$("$CLI" share) +assert_output_contains "bare required-arg alias renders CLI help" "$output" "Usage:" +assert_output_contains "bare share help uses canonical route" "$output" "omarchy share [path...]" + +output=$("$CLI" menu share) +assert_output_contains "bare required-arg filename route renders CLI help" "$output" "omarchy share [path...]" + +output=$("$CLI" branch set) +assert_output_contains "bare required-choice route renders CLI help" "$output" "omarchy branch set " + +CLI="$CLI" python3 <<'PY' +import json +import os +import subprocess +import sys + +cli = os.environ['CLI'] +commands = json.loads(subprocess.check_output([cli, 'commands', '--json'], text=True))['commands'] +by_group = {} +for command in commands: + binary = command['binary'] + stem = binary.removeprefix('omarchy-') + group = stem.split('-', 1)[0] + filename_route = 'omarchy ' + stem.replace('-', ' ') + by_group.setdefault(group, []).append((binary, filename_route, command['route'])) + +missing = [] +for group, rows in sorted(by_group.items()): + proc = subprocess.run([cli, group, '--help'], text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + output = proc.stdout + proc.stderr + if proc.returncode != 0: + missing.append((group, '', f'exit {proc.returncode}')) + continue + for binary, filename_route, canonical_route in rows: + if filename_route not in output and canonical_route not in output and binary not in output: + missing.append((group, binary, filename_route)) + +if missing: + for row in missing: + print('\t'.join(row), file=sys.stderr) + sys.exit(1) +PY +pass "every filename-derived group help represents its bins" + +output=$(timeout 5 "$CLI" theme set --help) +assert_output_contains "command help renders without executing" "$output" "Binary:" +assert_output_contains "theme set help names binary" "$output" "omarchy-theme-set" + +output=$(timeout 5 "$CLI" update --help) +assert_output_contains "mutating command help does not execute target" "$output" "omarchy-update" +assert_output_contains "root command help shows related child commands" "$output" "omarchy update perform" + +output=$("$CLI" screenshot --help) +assert_output_contains "root alias resolves to command help" "$output" "omarchy-capture-screenshot" + +"$CLI" commands --json | jq -e '.commands[] | select(.binary == "omarchy-capture-screenshot") | .aliases | index("omarchy screenshot")' >/dev/null +pass "aliases are included in JSON metadata" + +output=$("$CLI" pkg add --help) +assert_output_contains "fallback route resolves to curated metadata" "$output" "omarchy-pkg-add" +assert_output_contains "fallback route shows canonical route" "$output" "omarchy install package " + +output=$("$CLI" system reboot --help) +assert_output_contains "system command help is safe" "$output" "omarchy-system-reboot" + +output=$("$CLI" dev benchmark --repeat=1) +assert_output_contains "benchmark command runs" "$output" "Omarchy CLI benchmark" + +"$CLI" theme list >/dev/null +pass "safe dispatch works for theme list" + +"$CLI" theme current >/dev/null +pass "safe dispatch works for theme current" + +"$CLI" font list >/dev/null +pass "safe dispatch works for font list" + +"$CLI" font current >/dev/null +pass "safe dispatch works for font current" + +for binary in \ + omarchy-update \ + omarchy-theme-set \ + omarchy-capture-screenshot \ + omarchy-system-reboot \ + omarchy-pkg-add; do + [[ -x $ROOT/bin/$binary ]] || fail "binary is executable: $binary" + pass "binary is executable: $binary" +done + +while IFS= read -r binary_path; do + header=$(awk ' + NR == 1 && /^#!/ { next } + /^[[:space:]]*$/ { if (seen) print; next } + /^[[:space:]]*#/ { seen=1; print; next } + { exit } + ' "$binary_path") + + grep -q '^# omarchy:summary=' <<<"$header" || fail "metadata summary is present: $binary_path" + ! grep -q '^# omarchy:binary=' <<<"$header" || fail "metadata does not repeat inferred binary: $binary_path" + ! grep -q '^# omarchy:args=$' <<<"$header" || fail "metadata does not include empty args: $binary_path" + ! grep -Eq '^# omarchy:(legacy|usage|visibility|mutates|interactive)=' <<<"$header" || fail "metadata avoids removed fields: $binary_path" + ! grep -Eq '^# omarchy:requires-sudo=false$' <<<"$header" || fail "metadata omits false booleans: $binary_path" +done < <(find "$ROOT/bin" -maxdepth 1 -type f -executable -name 'omarchy-*' | sort) +pass "all executable bins have slim self-documenting metadata" + +TMPDIR=$(mktemp -d) +ln -s "$CLI" "$TMPDIR/omarchy" + +{ + printf '#!/bin/bash\n\n' + printf '# ordinary comments are fine\n' + printf '# omarchy:this malformed line should be ignored\n' + printf '# omarchy:group=weird\n' + printf '# omarchy:name=test\n' + printf '# omarchy:summary=Survives malformed metadata comments\n' + printf '# omarchy:made-up=value\n' + printf 'echo weird-ok\n' +} >"$TMPDIR/omarchy-weird-test" +chmod +x "$TMPDIR/omarchy-weird-test" + +{ + printf '#!/bin/bash\n\n' + printf '# a partial metadata header should not destroy fallback routing\n' + printf '# omarchy:summary=Partial metadata keeps inferred route\n' + printf '# omarchy:made-up=value\n' + printf 'echo partial-ok\n' +} >"$TMPDIR/omarchy-partial-meta-test" +chmod +x "$TMPDIR/omarchy-partial-meta-test" + +{ + printf '#!/bin/bash\n\n' + printf 'echo body-metadata-ok\n' + printf '# omarchy:group=wrong\n' + printf '# omarchy:name=wrong\n' +} >"$TMPDIR/omarchy-body-metadata-test" +chmod +x "$TMPDIR/omarchy-body-metadata-test" + +"$TMPDIR/omarchy" commands --all --json | jq -e '.commands[] | select(.route == "omarchy weird test" and .summary == "Survives malformed metadata comments")' >/dev/null +pass "unknown metadata values are non-fatal" + +"$TMPDIR/omarchy" commands --all --json | jq -e '.commands[] | select(.route == "omarchy partial meta test" and .summary == "Partial metadata keeps inferred route")' >/dev/null +pass "partial metadata keeps inferred fallback route" + +"$TMPDIR/omarchy" commands --all --json | jq -e '.commands[] | select(.route == "omarchy body metadata test" and .summary == "Run the body metadata test command")' >/dev/null +pass "metadata-looking comments after script body are ignored" + +output=$("$TMPDIR/omarchy" weird test) +assert_output_contains "temporary metadata command dispatches" "$output" "weird-ok" + +output=$("$TMPDIR/omarchy" partial meta test) +assert_output_contains "partial metadata command dispatches" "$output" "partial-ok" + +output=$("$TMPDIR/omarchy" body metadata test) +assert_output_contains "body metadata command dispatches by filename" "$output" "body-metadata-ok"