From 5e3d0d89a567eb8d0a3a36d316cdd537e98ed54f Mon Sep 17 00:00:00 2001 From: Ankur Kotwal Date: Sun, 24 Aug 2025 01:28:45 +1000 Subject: [PATCH] Reflect default browser changes in bindings and webapps (#871) * Abstract default browser to omarchy-browser (a wrapper) * Fix the omarchy-browser command as it used to loop. Extract info from the browser .desktop files. * Clean up and fix bugs * Cleanup unused change * Fix indentation * Separate out omarchy-browser from omarchy-webapp so that we don't break webapps for browsers other than Chromium or Google Chrome. * Fix incorrect function call * Add a migration script * Migration script fixes * Simplify the browser and webapp commands. Rename commands to align with launch terminology. * Add support for Microsoft Edge, Opera and Vivaldi * Fix errors * Remove --name and --class -- They're not respected when --app is defined * We don't ship with Chrome * Simplify launchers * Use launch commands everywhere --------- Co-authored-by: Ryan Hughes --- bin/omarchy-launch-browser | 3 +++ bin/omarchy-launch-webapp | 10 ++++++++++ bin/omarchy-menu | 14 +++++--------- bin/omarchy-webapp-install | 2 +- bin/omarchy-webapp-remove | 2 +- config/hypr/bindings.conf | 21 ++++++++++----------- migrations/1755507891.sh | 21 +++++++++++++++++++++ 7 files changed, 51 insertions(+), 22 deletions(-) create mode 100755 bin/omarchy-launch-browser create mode 100755 bin/omarchy-launch-webapp create mode 100755 migrations/1755507891.sh diff --git a/bin/omarchy-launch-browser b/bin/omarchy-launch-browser new file mode 100755 index 00000000..5b9f86c9 --- /dev/null +++ b/bin/omarchy-launch-browser @@ -0,0 +1,3 @@ +#!/bin/bash + +exec setsid uwsm app -- $(sed -n 's/^Exec=\([^ ]*\).*/\1/p' {~/.local,/usr}/share/applications/$(xdg-settings get default-web-browser) 2>/dev/null | head -1) ${args[@]} $@ diff --git a/bin/omarchy-launch-webapp b/bin/omarchy-launch-webapp new file mode 100755 index 00000000..24f48e9c --- /dev/null +++ b/bin/omarchy-launch-webapp @@ -0,0 +1,10 @@ +#!/bin/bash + +browser=$(xdg-settings get default-web-browser) + +case $browser in +google-chrome* | brave-browser* | microsoft-edge* | opera* | vivaldi*) ;; +*) 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}" diff --git a/bin/omarchy-menu b/bin/omarchy-menu index ca52b819..0571b500 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -34,10 +34,6 @@ edit_in_nvim() { alacritty -e nvim "$1" } -open_web() { - setsid chromium --new-window --app="$1" & -} - install() { present_terminal "echo 'Installing $1...'; yay -Sy --noconfirm $2" } @@ -53,11 +49,11 @@ install_font() { show_learn_menu() { case $(menu "Learn" " Keybindings\n Omarchy\n Hyprland\n󰣇 Arch\n Neovim\n󱆃 Bash") in *Keybindings*) omarchy-menu-keybindings ;; - *Omarchy*) open_web "https://learn.omacom.io/2/the-omarchy-manual" ;; - *Hyprland*) open_web "https://wiki.hypr.land/" ;; - *Arch*) open_web "https://wiki.archlinux.org/title/Main_page" ;; - *Bash*) open_web "https://devhints.io/bash" ;; - *Neovim*) open_web "https://www.lazyvim.org/keymaps" ;; + *Omarchy*) omarchy-launch-webapp "https://learn.omacom.io/2/the-omarchy-manual" ;; + *Hyprland*) omarchy-launch-webapp "https://wiki.hypr.land/" ;; + *Arch*) omarchy-launch-webapp "https://wiki.archlinux.org/title/Main_page" ;; + *Bash*) omarchy-launch-webapp "https://devhints.io/bash" ;; + *Neovim*) omarchy-launch-webapp "https://www.lazyvim.org/keymaps" ;; *) show_main_menu ;; esac } diff --git a/bin/omarchy-webapp-install b/bin/omarchy-webapp-install index b54a881f..a75a3288 100755 --- a/bin/omarchy-webapp-install +++ b/bin/omarchy-webapp-install @@ -32,7 +32,7 @@ cat >"$DESKTOP_FILE" <