omarchy/bin/omarchy-launch-webapp

43 lines
1.6 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Resolve the default desktop file
browser=$(xdg-settings get default-web-browser)
# Normalise known Chromiumbased browsers
case "$browser" in
google-chrome*|brave-browser*|microsoft-edge*|opera*|vivaldi*)
exec_cmd=$(sed -n 's/^Exec=\([^ ]*\).*/\1/p' \
"${HOME}/.local/share/applications/$browser" \
"/usr/share/applications/$browser" 2>/dev/null | head -1)
exec setsid uwsm app -- "$exec_cmd" --app="$1" "${@:2}"
;;
zen*|zen-browser*)
# Zen is Firefoxbased use Firefoxstyle flags
exec_cmd=$(sed -n 's/^Exec=\([^ ]*\).*/\1/p' \
"${HOME}/.local/share/applications/$browser" \
"/usr/share/applications/$browser" \
"/var/lib/flatpak/exports/share/applications/$browser" 2>/dev/null | head -1)
# Fallback to the binary name if Exec line is empty
exec_cmd=${exec_cmd:-zen}
# Choose the minimalUI mode you prefer
# --new-window : normal window
# --private-window : incognitostyle
# --kiosk : fullscreen kiosk
exec setsid "$exec_cmd" --new-window "$1" "${@:2}"
;;
*)
# Unknown browser default to Chromium
exec setsid uwsm app -- chromium --app="$1" "${@:2}"
;;
esac
# browser=$(xdg-settings get default-web-browser)
#
# case $browser in
# google-chrome* | brave-browser* | microsoft-edge* | opera* | vivaldi* | zen*) ;;
# *) browser="chromium.desktop" ;;
# esac
#
# exec setsid uwsm app -- $(sed -n 's/^Exec=\([^ ]*\).*/\1/p' {~/.local,/usr}/share/applications/$browser 2>/dev/null | head -1) --app="$1" "${@:2}"