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
16 changes: 13 additions & 3 deletions bin/omarchy-webapp-install
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
#!/bin/bash

if [ "$#" -ne 3 ]; then
if [ "$#" -ne 4 ]; then
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!)")
PROFILE=$(gum input --prompt "Separate Profile?> " --placeholder "Leave it blank for a shared profile, or type "YES" for a separate profile (multiple instances)")
else
APP_NAME="$1"
APP_URL="$2"
ICON_URL="$3"
PROFILE="$4"
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

if [ "$PROFILE" != "" ]; then
USER_DATA_DIR="$HOME/.cache/ChromiumInstances/$APP_NAME"
mkdir -p "$USER_DATA_DIR"
USER_DATA_DIR="--user-data-dir=${USER_DATA_DIR}"
else
USER_DATA_DIR=""
fi

ICON_DIR="$HOME/.local/share/applications/icons"
DESKTOP_FILE="$HOME/.local/share/applications/$APP_NAME.desktop"
ICON_PATH="$ICON_DIR/$APP_NAME.png"
Expand All @@ -32,7 +42,7 @@ cat >"$DESKTOP_FILE" <<EOF
Version=1.0
Name=$APP_NAME
Comment=$APP_NAME
Exec=omarchy-launch-webapp $APP_URL
Exec=omarchy-launch-webapp $APP_URL $USER_DATA_DIR
Terminal=false
Type=Application
Icon=$ICON_PATH
Expand All @@ -41,6 +51,6 @@ EOF

chmod +x "$DESKTOP_FILE"

if [ "$#" -ne 3 ]; then
if [ "$#" -ne 4 ]; then
echo -e "You can now find $APP_NAME using the app launcher (SUPER + SPACE)\n"
fi
20 changes: 20 additions & 0 deletions migrations/1756752493.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

echo "Add Separate profile support for Omarchy web applications"

sed -i 's/\[ "\$#" -ne 3 \]/[ "\$#" -ne 4 ]/' "$HOME/.local/share/omarchy/bin/omarchy-webapp-install"
sed -i '/ICON_URL=$(gum input/ a\ PROFILE=$(gum input --prompt "Separate Profile?> " --placeholder "Leave it blank for a shared profile, or type "YES" for a separate profile (multiple instances)")' "$HOME/.local/share/omarchy/bin/omarchy-webapp-install"

sed -i '/ICON_URL="\$3"/ a\ PROFILE="$4"' "$HOME/.local/share/omarchy/bin/omarchy-webapp-install"

sed -i '/^ICON_DIR=/ i \
if [ "$PROFILE" != "" ]; then \
USER_DATA_DIR="$HOME/.cache/ChromiumInstances/$APP_NAME" \
mkdir -p "$USER_DATA_DIR" \
USER_DATA_DIR="--user-data-dir=${USER_DATA_DIR}" \
else \
USER_DATA_DIR="" \
fi \
' "$HOME/.local/share/omarchy/bin/omarchy-webapp-install"

sed -i 's|^Exec=omarchy-launch-webapp \$APP_URL$|Exec=omarchy-launch-webapp $APP_URL $USER_DATA_DIR|' "$HOME/.local/share/omarchy/bin/omarchy-webapp-install"