Add web app management to Omarchy menu
This commit is contained in:
parent
59fefd34b1
commit
08ed9a5dff
@ -88,8 +88,9 @@ show_setup_menu() {
|
||||
}
|
||||
|
||||
show_install_menu() {
|
||||
case $(menu "Install" " Package\n Theme\n Dropbox\n Steam\n Docker DBs") in
|
||||
*Package*) terminal $OMARCHY_BIN_PATH/omarchy-cmd-install ;;
|
||||
case $(menu "Install" " Package\n Web App\n Theme\n Dropbox\n Steam\n Docker DBs") in
|
||||
*Package*) terminal $OMARCHY_BIN_PATH/omarchy-pkg-install ;;
|
||||
*Web*) terminal $OMARCHY_BIN_PATH/omarchy-webapp-install ;;
|
||||
*Theme*) terminal $OMARCHY_BIN_PATH/omarchy-theme-install ;;
|
||||
*Dropbox*) terminal $OMARCHY_BIN_PATH/omarchy-setup-dropbox ;;
|
||||
*Steam*) terminal $OMARCHY_BIN_PATH/omarchy-setup-steam ;;
|
||||
@ -99,8 +100,9 @@ show_install_menu() {
|
||||
}
|
||||
|
||||
show_remove_menu() {
|
||||
case $(menu "Remove" " Package\n Theme\n Fingerprint\n Fido2") in
|
||||
*Package*) terminal $OMARCHY_BIN_PATH/omarchy-cmd-uninstall ;;
|
||||
case $(menu "Remove" " Package\n Web App\n Theme\n Fingerprint\n Fido2") in
|
||||
*Package*) terminal $OMARCHY_BIN_PATH/omarchy-pkg-remove ;;
|
||||
*Web*) terminal $OMARCHY_BIN_PATH/omarchy-webapp-remove ;;
|
||||
*Theme*) present_terminal $OMARCHY_BIN_PATH/omarchy-theme-remove ;;
|
||||
*Fingerprint*) terminal "$OMARCHY_BIN_PATH/omarchy-setup-fingerprint --remove" ;;
|
||||
*Fido2*) terminal "$OMARCHY_BIN_PATH/omarchy-setup-fido2 --remove" ;;
|
||||
|
48
bin/omarchy-webapp-install
Executable file
48
bin/omarchy-webapp-install
Executable file
@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$#" -ne 3 ]; then
|
||||
~/.local/share/omarchy/bin/omarchy-show-logo
|
||||
echo -e "\e[32mLet's create a new web app you can start with the app launcher.\n\e[0m"
|
||||
APP_NAME=$(gum input --prompt "Name> " --placeholder "My favorite web app")
|
||||
APP_URL=$(gum input --prompt "URL> " --placeholder "https://example.com")
|
||||
ICON_URL=$(gum input --prompt "Icon URL> " --placeholder "See https://dashboardicons.com (must use PNG!)")
|
||||
else
|
||||
APP_NAME="$1"
|
||||
APP_URL="$2"
|
||||
ICON_URL="$3"
|
||||
fi
|
||||
|
||||
if [[ -z "$APP_NAME" || -z "$APP_URL" || -z "$ICON_URL" ]]; then
|
||||
echo "You must set app name, app URL, and icon URL!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ICON_DIR="$HOME/.local/share/applications/icons"
|
||||
DESKTOP_FILE="$HOME/.local/share/applications/$APP_NAME.desktop"
|
||||
ICON_PATH="$ICON_DIR/$APP_NAME.png"
|
||||
|
||||
mkdir -p "$ICON_DIR"
|
||||
|
||||
if ! curl -sL -o "$ICON_PATH" "$ICON_URL"; then
|
||||
echo "Error: Failed to download icon."
|
||||
return 1
|
||||
fi
|
||||
|
||||
cat >"$DESKTOP_FILE" <<EOF
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Name=$APP_NAME
|
||||
Comment=$APP_NAME
|
||||
Exec=chromium --new-window --ozone-platform=wayland --app="$APP_URL" --name="$APP_NAME" --class="$APP_NAME"
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Icon=$ICON_PATH
|
||||
StartupNotify=true
|
||||
EOF
|
||||
|
||||
chmod +x "$DESKTOP_FILE"
|
||||
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo -e "You can now find $APP_NAME using the app launcher (SUPER + SPACE)\n"
|
||||
~/.local/share/omarchy/bin/omarchy-show-done
|
||||
fi
|
39
bin/omarchy-webapp-remove
Executable file
39
bin/omarchy-webapp-remove
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
ICON_DIR="$HOME/.local/share/applications/icons"
|
||||
DESKTOP_DIR="$HOME/.local/share/applications/"
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
~/.local/share/omarchy/bin/omarchy-show-logo
|
||||
|
||||
# Find all web apps
|
||||
while IFS= read -r -d '' file; do
|
||||
if grep -q '^Exec=.*chromium.*--app' "$file"; then
|
||||
WEB_APPS+=("$(basename "${file%.desktop}")")
|
||||
fi
|
||||
done < <(find "$DESKTOP_DIR" -name '*.desktop' -print0)
|
||||
|
||||
if ((${#WEB_APPS[@]})); then
|
||||
IFS=$'\n' SORTED_WEB_APPS=($(sort <<<"${WEB_APPS[*]}"))
|
||||
unset IFS
|
||||
APP_NAME=$(gum choose --header "Select web app to remove..." "${SORTED_WEB_APPS[@]}")
|
||||
else
|
||||
echo "No web apps to remove."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
APP_NAME="$1"
|
||||
fi
|
||||
|
||||
if [[ -z "$APP_NAME" ]]; then
|
||||
echo "You must provide web app 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"
|
||||
~/.local/share/omarchy/bin/omarchy-show-done
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user