Skip to content

Add multi-profile support to web app installer#1266

Closed
mulsori wants to merge 11 commits into
basecamp:masterfrom
mulsori:multiple-browser-profiles
Closed

Add multi-profile support to web app installer#1266
mulsori wants to merge 11 commits into
basecamp:masterfrom
mulsori:multiple-browser-profiles

Conversation

@mulsori

@mulsori mulsori commented Aug 28, 2025

Copy link
Copy Markdown

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)
screenshot-2025-08-28_21-55-10 screenshot-2025-08-28_21-56-31 screenshot-2025-08-28_21-58-50
  • Both appear as separate desktop applications

@dhh dhh mentioned this pull request Sep 1, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new names

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct profile names.

@rez1-dev

rez1-dev commented Sep 6, 2025

Copy link
Copy Markdown
Contributor

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

@Prajwal-Prathiksh

Copy link
Copy Markdown
Contributor

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

@alvarosaavedra

Copy link
Copy Markdown

This looks amazing waiting to see this in a new release.

@mulsori

mulsori commented Sep 27, 2025

Copy link
Copy Markdown
Author

@Prajwal-Prathiksh thank you, I will try to fix it tomorrow or next week, I also need to resolve conflict with the webapp-install 🙂

@mulsori

mulsori commented Oct 2, 2025

Copy link
Copy Markdown
Author
pragne snu bardzo pragne snu

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 😄.

@rez1-dev

rez1-dev commented Oct 2, 2025

Copy link
Copy Markdown
Contributor

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.

Comment thread bin/omarchy-launch-webapp Outdated
case $browser in
google-chrome* | brave-browser* | microsoft-edge* | opera* | vivaldi* | helium-browser*) ;;
*) browser="chromium.desktop" ;;
google-chrome* | brave-browser* | microsoft-edge* | opera* | vivaldi*) ;;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
google-chrome* | brave-browser* | microsoft-edge* | opera* | vivaldi*) ;;
google-chrome* | brave-browser* | microsoft-edge* | opera* | vivaldi* | helium-browser*) ;;

Helium browser was added last week #1945

@mulsori

mulsori commented Oct 7, 2025

Copy link
Copy Markdown
Author

If DHH doesn't like chromium or browser ASCII, 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 🙂.

@mghextreme

Copy link
Copy Markdown

@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?

@mulsori

mulsori commented Oct 29, 2025

Copy link
Copy Markdown
Author

@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" 😄

@mghextreme

Copy link
Copy Markdown

@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 🙏
You already have my approval, hopefully @dhh 's too as soon as this is completed.

@joaosouzacoder

Copy link
Copy Markdown

I'm eagerly waiting, I hope it arrives soon.

@mulsori

mulsori commented Oct 31, 2025

Copy link
Copy Markdown
Author

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 🙂

@yann-dubrana

Copy link
Copy Markdown

Can we have this? I've tried it on my system and it work well.

@foxbat123

Copy link
Copy Markdown

I am so excited about this feature!

@mghextreme

Copy link
Copy Markdown

@dhh @ryanrhughes This feature seems ready with a lot of support behind it. Are we good to merge it?

Comment thread bin/omarchy-launch-floating-terminal-with-presentation Outdated
@akarray

akarray commented Dec 30, 2025

Copy link
Copy Markdown

This is a very useful feature.

@ryanrhughes

Copy link
Copy Markdown
Collaborator

Can we get a quick rebase here? I'd like to give this a spin.

@mulsori
mulsori force-pushed the multiple-browser-profiles branch from 6441313 to 07670e1 Compare January 13, 2026 17:44
@francardoso93

Copy link
Copy Markdown

Can´t wait to get this feature!! 🙏

Copilot AI review requested due to automatic review settings February 26, 2026 19:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends Omarchy’s web app installation/launch tooling to support installing the same web app multiple times using different Chromium-based browser profiles (e.g., work vs personal), and adds a dedicated “webapp” presentation logo.

Changes:

  • Enhance omarchy-webapp-install with browser detection plus profile discovery/selection and updated .desktop generation.
  • Update webapp launching/focus scripts to incorporate profile-aware launching and window matching.
  • Add a dedicated webapp ASCII logo and a script to present it in the installer flow.

Reviewed changes

Copilot reviewed 1 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
webapp-logo.txt Adds a new ASCII art logo intended for the webapp installer presentation.
bin/omarchy-webapp-install Adds browser/profile selection logic and changes the generated Exec command to include profile/browser parameters.
bin/omarchy-show-webapp-logo New helper to display the webapp logo from ~/.local/share/omarchy.
bin/omarchy-launch-webapp Changes launch argument handling to support profile + browser selection when starting a webapp.
bin/omarchy-launch-or-focus Extends focus-or-launch behavior to support URL/profile-driven focusing and launching.
bin/omarchy-launch-floating-terminal-with-presentation Switches presentation logo when launching the webapp installer via the menu.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@amalrik

amalrik commented Mar 18, 2026

Copy link
Copy Markdown

I had a chance to review omarchy-launch-webapp and test similar approaches locally — this is a great direction and solves a real limitation around profile-based isolation.

One thing that might be worth considering before merging is improving the interface. The current positional arguments (URL, profile, browser) can be a bit hard to reason about and may become fragile over time.

For example:

omarchy-launch-webapp https://youtube.com "Profile 2" google-chrome

vs a flag-based approach:

omarchy-launch-webapp \
  --url https://youtube.com \
  --profile "Profile 2" \
  --browser google-chrome

This makes usage more explicit and easier to extend in the future.

Also, since the current implementation assumes Chromium-style flags (--app, --profile-directory), it might be worth adding a minimal browser-specific handling layer. For example, falling back to --new-window for Firefox instead of forcing Chromium behavior.

Happy to help refine this PR, test changes, or break it into smaller pieces if that makes it easier to move forward.

@dhh

dhh commented Jul 18, 2026

Copy link
Copy Markdown
Member

Closing in favor of the newer and more comprehensive profile-aware webapp work in #6105.

@dhh dhh closed this Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.