From 8e4487ca4139aadbbaf465e3a53f864bce37d350 Mon Sep 17 00:00:00 2001 From: David Boot Date: Sun, 14 Sep 2025 18:18:57 +0200 Subject: [PATCH] Add private browser key binding (#1324) * Add private browser key binding * Include other Firefox-based browsers * Simplify implementation * Add migration to add the hotkey --------- Co-authored-by: David Heinemeier Hansson --- bin/omarchy-launch-browser | 11 ++++++++++- config/hypr/bindings.conf | 1 + migrations/1757866485.sh | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 migrations/1757866485.sh diff --git a/bin/omarchy-launch-browser b/bin/omarchy-launch-browser index 86904afa..536e212c 100755 --- a/bin/omarchy-launch-browser +++ b/bin/omarchy-launch-browser @@ -1,3 +1,12 @@ #!/bin/bash -exec setsid uwsm app -- $(sed -n 's/^Exec=\([^ ]*\).*/\1/p' {~/.local,~/.nix-profile,/usr}/share/applications/$(xdg-settings get default-web-browser) 2>/dev/null | head -1) ${args[@]} $@ +default_browser=$(xdg-settings get default-web-browser) +browser_exec=$(sed -n 's/^Exec=\([^ ]*\).*/\1/p' {~/.local,~/.nix-profile,/usr}/share/applications/$default_browser 2>/dev/null | head -1) + +if [[ $browser_exec =~ (firefox|zen|librewolf) ]]; then + private_flag="--private-window" +else + private_flag="--incognito" +fi + +exec setsid uwsm app -- "$browser_exec" "${@/--private/$private_flag}" diff --git a/config/hypr/bindings.conf b/config/hypr/bindings.conf index 6990753d..ad0f654c 100644 --- a/config/hypr/bindings.conf +++ b/config/hypr/bindings.conf @@ -5,6 +5,7 @@ $browser = omarchy-launch-browser bindd = SUPER, return, Terminal, exec, $terminal --working-directory="$(omarchy-cmd-terminal-cwd)" bindd = SUPER, F, File manager, exec, uwsm app -- nautilus --new-window bindd = SUPER, B, Browser, exec, $browser +bindd = SUPER SHIFT, B, Browser (private), exec, $browser --private bindd = SUPER, M, Music, exec, uwsm app -- spotify bindd = SUPER, N, Neovim, exec, $terminal -e nvim bindd = SUPER, T, Activity, exec, $terminal -e btop diff --git a/migrations/1757866485.sh b/migrations/1757866485.sh new file mode 100644 index 00000000..ed0905ee --- /dev/null +++ b/migrations/1757866485.sh @@ -0,0 +1,6 @@ +echo "Add SUPER + SHIFT + B to start browser in private mode" + +if [[ -f ~/.config/hypr/bindings.conf ]] && grep -q "SUPER, B, Browser, exec" ~/.config/hypr/bindings.conf; then + sed -i '/^bindd = SUPER, B, Browser, exec, \$browser$/a\ +bindd = SUPER SHIFT, B, Browser (private), exec, $browser --private' ~/.config/hypr/bindings.conf +fi