omarchy
omarchy copied to clipboard
Add multi-profile support to web app installer
Add multi-profile support for web app installer
This PR enhances the web app installer to support multiple browser profiles, allowing users to create separate web apps from different Chromium profiles.
Changes:
- Installer: Added profile detection and selection
- Automatically detects available Chromium profiles (Default, Profile 1, etc.)
- Shows profile selection menu when multiple profiles exist
- Uses single profile automatically when only one exists
Use case:
Users can now install the same web app (e.g., Teams, Discord) multiple times with different browser profiles, allowing separate work/personal accounts to run simultaneously.
Example:
-
Teams (Work profile)
-
Teams (Personal profile)
-
Both appear as separate desktop applications
I think you need to simplify the web app view for this use case.
After Omarchy ASCII logo,
Let's create a new web app you can start with the app launcher.
We're not creating a web app here. The profile already exists and is detected.
You could replace the Omarchy ASCII logo with default browser icon. That'd be nice. Easy to grasp.
- Which browser
- Select Browser Profile
- Enter
From Omarchy v3.0.0, omarchy-launch-or-focus was introduced.
Because of this I had to make some modifications to your fork to have it work with the new release.
I'm updating it here @przemekmatsumoto in case you want to follow up further on this PR.
omarchy-lauch-webapp
#!/bin/bash
browser=$(xdg-settings get default-web-browser)
case $browser in
google-chrome* | brave-browser* | microsoft-edge* | opera* | vivaldi*) ;;
*) browser="chromium.desktop" ;;
esac
# Extract the browser binary from the .desktop file
BROWSER_BIN="$(sed -n 's/^Exec=\([^ ]*\).*/\1/p' {~/.local,~/.nix-profile,/usr}/share/applications/$browser 2>/dev/null | head -1)"
APP_URL="$1"
shift || true
# If a profile arg is provided (as $2 in the original), use it; otherwise launch without profile.
PROFILE_ARG=()
if [ -n "${1-}" ]; then
PROFILE_ARG=(--profile-directory="$1")
shift
fi
# Any remaining args after the profile name are forwarded as-is.
exec setsid uwsm app -- "$BROWSER_BIN" "${PROFILE_ARG[@]}" --app="$APP_URL" "$@"
omarchy-launch-or-focus
#!/bin/bash
set -euo pipefail
# Usage:
# omarchy-launch-or-focus <window-pattern> [launch-command]
# omarchy-launch-or-focus <url> [profile] [extra browser flags...]
find_window_address() {
local pattern="$1"
hyprctl clients -j \
| jq -r --arg p "$pattern" '.[] | select((.class+" "+.title) | test($p;"i")) | .address' \
| head -n1
}
regex_escape() {
sed -e 's/[.[\*^$()+?{}|\\]/\\&/g' <<<"$1"
}
if (($# == 0)); then
echo "Usage:"
echo " omarchy-launch-or-focus <window-pattern> [launch-command]"
echo " omarchy-launch-or-focus <url> [profile] [extra browser flags...]"
exit 1
fi
arg1="$1"
if [[ "$arg1" =~ ^https?:// ]]; then
# ------------------ URL MODE ------------------
APP_URL="$1"
PROFILE="${2-}" # optional
shift || true
if [[ $# -gt 0 ]]; then shift; fi
EXTRA_FLAGS=("$@")
# Host (e.g., gemini.google.com, chatgpt.com)
host="${APP_URL#*://}"; host="${host%%/*}"
host_esc="$(regex_escape "$host")"
# Allow optional "__<segment>-" between host and profile, e.g. "__app-"
# Examples matched:
# chrome-gemini.google.com__app-Default
# chrome-chatgpt.com__-Default
# chrome-web.whatsapp.com__-Profile_1
if [[ -n "${PROFILE:-}" ]]; then
prof_as_is="$(regex_escape "$PROFILE")"
prof_uscore="$(regex_escape "${PROFILE// /_}")"
WINDOW_PATTERN="(^| )(chrome|chromium|brave|vivaldi|microsoft-edge|google-chrome)-${host_esc}(__[^ ]*-)(${prof_as_is}|${prof_uscore})( |$)"
else
# No profile provided: match any window of this host, regardless of the optional segment/profile
WINDOW_PATTERN="(^| )(chrome|chromium|brave|vivaldi|microsoft-edge|google-chrome)-${host_esc}(__[^ ]*)?( |$)"
fi
# Debug aid: show the pattern if DEBUG=1
[[ "${DEBUG:-0}" = "1" ]] && echo "Pattern: $WINDOW_PATTERN" >&2
if WINDOW_ADDRESS="$(find_window_address "$WINDOW_PATTERN")" && [[ -n "$WINDOW_ADDRESS" ]]; then
hyprctl dispatch focuswindow "address:$WINDOW_ADDRESS"
exit 0
fi
# No match → delegate launching (no duplication of browser logic here)
if [[ -n "${PROFILE:-}" ]]; then
exec omarchy-launch-webapp "$APP_URL" "$PROFILE" "${EXTRA_FLAGS[@]}"
else
exec omarchy-launch-webapp "$APP_URL" "${EXTRA_FLAGS[@]}"
fi
else
# ---------------- PATTERN MODE (original) ----------------
WINDOW_PATTERN="$arg1"
LAUNCH_COMMAND="${2:-"uwsm app -- $WINDOW_PATTERN"}"
if WINDOW_ADDRESS="$(find_window_address "$WINDOW_PATTERN")" && [[ -n "$WINDOW_ADDRESS" ]]; then
hyprctl dispatch focuswindow "address:$WINDOW_ADDRESS"
else
eval exec $LAUNCH_COMMAND
fi
fi
This looks amazing waiting to see this in a new release.
@Prajwal-Prathiksh thank you, I will try to fix it tomorrow or next week, I also need to resolve conflict with the webapp-install 🙂
If the user only has one profile in the browser, the script won't ask for it; it will automatically create using "Default".
I don't know if this is what rez1coder had in mind about changing the Omarchy logo 😄.
I don't know if this is what rez1coder had in mind about changing the Omarchy logo 😄.
Might need to change chromium if Ladybird and Firefox catch up with frameless web-app windows.
The default browser icon was a suggestion. I hadn't considered multi-browser setups. You nailed it.
If DHH doesn't like chromium or browser ASCII, the default Omarchy logo works fine.
If DHH doesn't like
chromiumorbrowserASCII, the default Omarchy logo works fine.
More ideas: chromium, browser, omarchy web, omarchy web app, web app, web installer, web app installer or the logo could depend on the default browser set by the user (though I'm not sure if that's not an exaggeration :P).
Of course, as rez1coder said, it depends on the DHH 🙂.
@przemekmatsumoto How is the work going in this? I tested the script in Omarchy 3.1.0 and it worked great! Anything I can do to help expedite this PR?
@przemekmatsumoto How is the work going in this? I tested the script in Omarchy 3.1.0 and it worked great! Anything I can do to help expedite this PR?
@mghextreme Actually, I think it could be done already (Not sure :P), still need to choose a logo, which I can generate later (of course, if DHH wants to change it) + I see 3 files in which conflicts need to be resolved ^-^
The only thing I can think of is changing the browser executable searches, as they're currently hardcoded (I tested this with specific packages from aur), and if someone downloads somehow a browser that doesn't have a properly named executable, it won't be found - so it won't be displayed in the installer:
declare -A BROWSER_BINARIES=(
[Chromium]=chromium
[Google Chrome]=google-chrome-stable
[Brave]=brave
[Microsoft Edge]=microsoft-edge-stable
[Vivaldi]=vivaldi
[Helium]=helium-browser
)
Therefore, I was wondering if I could add something that would search for names like google-chrome-stable, google-chrome, google-chrome-dev, google-chrome, etc. instead of just google-chrome-stable although I don't know if it's a "must have" 😄
@przemekmatsumoto IMHO, this is already improves the current Web App installation experience, and if it was up to me, I'd say to merge it and we can always leave to other people (that way be using these different browsers) to update these scripts in the future.
Looking forward for you resolving the conflicts :pray: You already have my approval, hopefully @dhh 's too as soon as this is completed.
I'm eagerly waiting, I hope it arrives soon.
Conflicts resolved 🙂 Opera support added. I couldn't find an option to add a new profile in Opera, so I don't know if it will work for a profile other than Default, but I believe it will 🙂
Can we have this? I've tried it on my system and it work well.
I am so excited about this feature!
@dhh @ryanrhughes This feature seems ready with a lot of support behind it. Are we good to merge it?