Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions bin/omarchy-menu-plugin
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,36 @@ rows=$(jq -r --arg icon "$PLUGIN_ICON" \
| \$icon + \"\\t\" + .name + \"\\t\" + .id" <<<"$plugins")
[[ -n $rows ]] || { omarchy-notification-send "No plugin to ${1}"; exit 0; }

selection=$(omarchy-menu-select "${1^} plugin" <<<"$rows") || exit 0
[[ -n $selection ]] || exit 0
if [[ $1 == "clone" ]]; then
selection=$(omarchy-menu-select "${1^} plugin" <<<"$rows") || exit 0
[[ -n $selection ]] || exit 0
selections=("$selection")
else
mapfile -t selections < <(omarchy-menu-select "${1^} plugins" -- --multi --width 520 --maxheight 520 <<<"$rows")
(( ${#selections[@]} > 0 )) || exit 0
fi

id=$(cut -f2 <<<"$selection")
[[ -n $id ]] || exit 1
ids=()
for selection in "${selections[@]}"; do
id=$(cut -f2 <<<"$selection")
[[ -n $id ]] && ids+=("$id")
done
(( ${#ids[@]} > 0 )) || exit 1

if [[ $1 == "clone" ]]; then
omarchy-launch-floating-terminal-with-presentation \
"omarchy-plugin-clone $(printf '%q' "$id") --edit"
"omarchy-plugin-clone $(printf '%q' "${ids[0]}") --edit"
elif [[ $1 == "remove" ]]; then
omarchy-launch-floating-terminal-with-presentation "omarchy-plugin-remove $(printf '%q' "$id")"
remove_command=""
for id in "${ids[@]}"; do
[[ -z $remove_command ]] || remove_command+="; "
remove_command+="omarchy-plugin-remove $(printf '%q' "$id")"
done
omarchy-launch-floating-terminal-with-presentation "$remove_command"
else
"omarchy-plugin-$1" "$id"
status=0
for id in "${ids[@]}"; do
"omarchy-plugin-$1" "$id" || status=1
done
exit "$status"
fi
12 changes: 9 additions & 3 deletions bin/omarchy-menu-select
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# omarchy:summary=Pick one option from a menu
# omarchy:summary=Pick options from a menu
# omarchy:group=menu
# omarchy:name=select
# omarchy:args=prompt [option...] [-- menu args...]
Expand All @@ -10,7 +10,8 @@
# subtext shown under the label, as "<glyph><TAB><label><TAB><subtext>". The
# menu shows the glyph but never returns it. A plain option returns the label
# alone; an option with a subtext returns "<label><TAB><subtext>", so callers
# with same-named rows get the subtext back as the stable key.
# with same-named rows get the subtext back as the stable key. Pass --multi after
# the separator to let Tab pin options and Enter return them one per line.

set -euo pipefail

Expand All @@ -25,12 +26,16 @@ shift
options=()
menu_width=""
menu_maxheight=""
multi_select=0

while (( $# > 0 )); do
if [[ $1 == "--" ]]; then
shift
while (( $# > 0 )); do
case "$1" in
--multi)
multi_select=1
;;
--width)
shift
if (( $# == 0 )); then
Expand Down Expand Up @@ -83,8 +88,9 @@ payload=$(perl -MEncode=decode -MJSON::PP=encode_json,decode_json -e '
};
$payload->{width} = int($ARGV[4]) if length($ARGV[4] // "");
$payload->{maxHeight} = int($ARGV[5]) if length($ARGV[5] // "");
$payload->{multiSelect} = JSON::PP::true if $ARGV[6] eq "1";
print encode_json($payload)
' "$prompt" "$options_json" "$selection_file" "$done_file" "$menu_width" "$menu_maxheight")
' "$prompt" "$options_json" "$selection_file" "$done_file" "$menu_width" "$menu_maxheight" "$multi_select")

omarchy-shell shell summon omarchy.menu "$payload" >/dev/null

Expand Down
45 changes: 26 additions & 19 deletions bin/omarchy-theme-remove
Original file line number Diff line number Diff line change
@@ -1,38 +1,45 @@
#!/bin/bash

# omarchy:summary=Remove a user-installed theme
# omarchy:args=[theme-name]
# omarchy:summary=Remove user-installed themes
# omarchy:args=[theme-name...]
# omarchy:examples=omarchy theme remove "Tokyo Night"

if [[ -z $1 ]]; then
if [[ -z ${1-} ]]; then
mapfile -t extra_themes < <(find ~/.config/omarchy/themes -mindepth 1 -maxdepth 1 -type d ! -xtype l -printf '%f\n')

if (( ${#extra_themes[@]} > 0 )); then
mapfile -t extra_themes < <(printf '%s\n' "${extra_themes[@]}" | sort)
THEME_NAME=$(omarchy-menu-select "Remove extra theme" "${extra_themes[@]}" -- --width 520 --maxheight 520)
mapfile -t THEME_NAMES < <(omarchy-menu-select "Remove extra theme" "${extra_themes[@]}" -- --multi --width 520 --maxheight 520)
else
echo "No extra themes installed."
exit 1
fi
else
THEME_NAME="$1"
THEME_NAMES=("$@")
fi

THEMES_DIR="$HOME/.config/omarchy/themes"
THEME_PATH="$THEMES_DIR/$THEME_NAME"

# Ensure a theme was set
if [[ -z $THEME_NAME ]]; then
if (( ${#THEME_NAMES[@]} == 0 )) || [[ -z ${THEME_NAMES[0]} ]]; then
exit 1
fi

# Check if theme exists before attempting removal
if [[ ! -d $THEME_PATH ]]; then
echo "Error: Theme '$THEME_NAME' not found."
exit 1
fi
THEMES_DIR="$HOME/.config/omarchy/themes"
status=0

for THEME_NAME in "${THEME_NAMES[@]}"; do
[[ -z $THEME_NAME ]] && continue
THEME_PATH="$THEMES_DIR/$THEME_NAME"

# Check if theme exists before attempting removal
if [[ ! -d $THEME_PATH ]]; then
echo "Error: Theme '$THEME_NAME' not found."
status=1
continue
fi

# Now remove the theme directory for THEME_NAME
rm -rf "$THEME_PATH"
omarchy-notification-send "Theme removed" "$THEME_NAME" || true
echo "Removed $THEME_NAME"
done

# Now remove the theme directory for THEME_NAME
rm -rf "$THEME_PATH"
omarchy-notification-send "Theme removed" "$THEME_NAME" || true
echo "Removed $THEME_NAME"
exit "$status"
27 changes: 16 additions & 11 deletions bin/omarchy-tui-remove
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# omarchy:summary=Remove a terminal UI desktop launcher
# omarchy:args=[name]
# omarchy:summary=Remove terminal UI desktop launchers
# omarchy:args=[name...]

set -e

Expand All @@ -19,23 +19,28 @@ if (( $# == 0 )); then

if ((${#TUIS[@]})); then
mapfile -t SORTED_TUIS < <(printf '%s\n' "${TUIS[@]}" | sort)
APP_NAME=$(omarchy-menu-select "Select TUI to remove" "${SORTED_TUIS[@]}" -- --width 520 --maxheight 520)
mapfile -t APP_NAMES < <(omarchy-menu-select "Select TUI to remove" "${SORTED_TUIS[@]}" -- --multi --width 520 --maxheight 520)
else
echo "No TUIs to remove."
exit 1
fi
else
APP_NAME="$*"
APP_NAMES=("$@")
fi

if [[ -z $APP_NAME ]]; then
if (( ${#APP_NAMES[@]} == 0 )) || [[ -z ${APP_NAMES[0]} ]]; then
echo "You must select a TUI to remove."
exit 1
fi

icon_name=$(printf '%s\n' "$APP_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^[:alnum:]]\+/-/g; s/^-//; s/-$//')
rm -f "$DESKTOP_DIR/$APP_NAME.desktop"
rm -f "$ICON_DIR/$icon_name.png" "$ICON_DIR/$APP_NAME.png" "$OLD_ICON_DIR/$APP_NAME.png"
if [[ ${OMARCHY_REMOVE_NOTIFY:-true} != "false" ]]; then
omarchy-notification-send -g  "TUI removed" "$APP_NAME"
fi
for APP_NAME in "${APP_NAMES[@]}"; do
[[ -z $APP_NAME ]] && continue
icon_name=$(printf '%s\n' "$APP_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^[:alnum:]]\+/-/g; s/^-//; s/-$//')
rm -f "$DESKTOP_DIR/$APP_NAME.desktop"
rm -f "$ICON_DIR/$icon_name.png" "$ICON_DIR/$APP_NAME.png" "$OLD_ICON_DIR/$APP_NAME.png"
if [[ ${OMARCHY_REMOVE_NOTIFY:-true} != "false" ]]; then
omarchy-notification-send -g  "TUI removed" "$APP_NAME"
fi
done

update-desktop-database "$DESKTOP_DIR" &>/dev/null
26 changes: 15 additions & 11 deletions bin/omarchy-webapp-remove
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# omarchy:summary=Remove a web app desktop launcher
# omarchy:args=[name]
# omarchy:summary=Remove web app desktop launchers
# omarchy:args=[name...]

set -e

Expand All @@ -19,25 +19,29 @@ if (( $# == 0 )); then

if ((${#WEB_APPS[@]})); then
mapfile -t SORTED_WEB_APPS < <(printf '%s\n' "${WEB_APPS[@]}" | sort)
APP_NAME=$(omarchy-menu-select "Select web app to remove" "${SORTED_WEB_APPS[@]}" -- --width 520 --maxheight 520)
mapfile -t APP_NAMES < <(omarchy-menu-select "Select web app to remove" "${SORTED_WEB_APPS[@]}" -- --multi --width 520 --maxheight 520)
else
echo "No web apps to remove."
exit 1
fi
else
APP_NAME="$*"
APP_NAMES=("$@")
fi

if [[ -z $APP_NAME ]]; then
if (( ${#APP_NAMES[@]} == 0 )) || [[ -z ${APP_NAMES[0]} ]]; then
echo "You must select a web app to remove."
exit 1
fi

icon_name=$(printf '%s\n' "$APP_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^[:alnum:]]\+/-/g; s/^-//; s/-$//')
rm -f "$DESKTOP_DIR/$APP_NAME.desktop"
rm -f "$ICON_DIR/$icon_name.png" "$ICON_DIR/$APP_NAME.png" "$OLD_ICON_DIR/$APP_NAME.png"
for APP_NAME in "${APP_NAMES[@]}"; do
[[ -z $APP_NAME ]] && continue
icon_name=$(printf '%s\n' "$APP_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^[:alnum:]]\+/-/g; s/^-//; s/-$//')
rm -f "$DESKTOP_DIR/$APP_NAME.desktop"
rm -f "$ICON_DIR/$icon_name.png" "$ICON_DIR/$APP_NAME.png" "$OLD_ICON_DIR/$APP_NAME.png"

if [[ ${OMARCHY_REMOVE_NOTIFY:-true} != "false" ]]; then
omarchy-notification-send -g  "Web app removed" "$APP_NAME"
fi
done

if [[ ${OMARCHY_REMOVE_NOTIFY:-true} != "false" ]]; then
omarchy-notification-send -g  "Web app removed" "$APP_NAME"
fi
update-desktop-database "$DESKTOP_DIR" &>/dev/null
Loading