Fork the desktop off Omarchy as a self-contained system
This commit is contained in:
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
# blob:summary=Remove a terminal UI desktop launcher
|
||||
# blob:args=[name]
|
||||
|
||||
set -e
|
||||
|
||||
ICON_DIR="$HOME/.local/share/icons/hicolor/256x256/apps"
|
||||
OLD_ICON_DIR="$HOME/.local/share/applications/icons"
|
||||
DESKTOP_DIR="$HOME/.local/share/applications/"
|
||||
|
||||
if (( $# == 0 )); then
|
||||
# Find all TUIs
|
||||
while IFS= read -r -d '' file; do
|
||||
if grep -qE '^Exec=.*(\$TERMINAL|xdg-terminal-exec).*-e' "$file"; then
|
||||
TUIS+=("$(basename "${file%.desktop}")")
|
||||
fi
|
||||
done < <(find "$DESKTOP_DIR" -name '*.desktop' -print0)
|
||||
|
||||
if ((${#TUIS[@]})); then
|
||||
mapfile -t SORTED_TUIS < <(printf '%s\n' "${TUIS[@]}" | sort)
|
||||
APP_NAME=$(blob-menu-select "Select TUI to remove" "${SORTED_TUIS[@]}" -- --width 520 --maxheight 520)
|
||||
else
|
||||
echo "No TUIs to remove."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
APP_NAME="$*"
|
||||
fi
|
||||
|
||||
if [[ -z $APP_NAME ]]; 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 [[ ${BLOB_REMOVE_NOTIFY:-true} != "false" ]]; then
|
||||
blob-notify-send -g "TUI removed" "$APP_NAME"
|
||||
fi
|
||||
Reference in New Issue
Block a user