omarchy/bin/omarchy-tui-remove
2025-08-22 22:22:29 +02:00

37 lines
815 B
Bash
Executable File

#!/bin/bash
ICON_DIR="$HOME/.local/share/applications/icons"
DESKTOP_DIR="$HOME/.local/share/applications/"
if [ "$#" -ne 1 ]; then
# Find all web apps
while IFS= read -r -d '' file; do
if grep -q '^Exec=.*alacritty.*-e' "$file"; then
TUIS+=("$(basename "${file%.desktop}")")
fi
done < <(find "$DESKTOP_DIR" -name '*.desktop' -print0)
if ((${#TUIS[@]})); then
IFS=$'\n' SORTED_TUIS=($(sort <<<"${TUIS[*]}"))
unset IFS
APP_NAME=$(gum choose --header "Select TUI to remove..." "${SORTED_TUIS[@]}")
else
echo "No TUIs to remove."
exit 1
fi
else
APP_NAME="$1"
fi
if [[ -z "$APP_NAME" ]]; then
echo "You must provide TUI name."
exit 1
fi
rm "$DESKTOP_DIR/$APP_NAME.desktop"
rm "$ICON_DIR/$APP_NAME.png"
if [ "$#" -ne 1 ]; then
echo -e "Removed $APP_NAME\n"
fi