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 <david@hey.com>
This commit is contained in:
David Boot
2025-09-14 18:18:57 +02:00
committed by GitHub
parent b422281840
commit 8e4487ca41
3 changed files with 17 additions and 1 deletions

View File

@@ -1,3 +1,12 @@
#!/bin/bash #!/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}"

View File

@@ -5,6 +5,7 @@ $browser = omarchy-launch-browser
bindd = SUPER, return, Terminal, exec, $terminal --working-directory="$(omarchy-cmd-terminal-cwd)" 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, F, File manager, exec, uwsm app -- nautilus --new-window
bindd = SUPER, B, Browser, exec, $browser 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, M, Music, exec, uwsm app -- spotify
bindd = SUPER, N, Neovim, exec, $terminal -e nvim bindd = SUPER, N, Neovim, exec, $terminal -e nvim
bindd = SUPER, T, Activity, exec, $terminal -e btop bindd = SUPER, T, Activity, exec, $terminal -e btop

6
migrations/1757866485.sh Normal file
View File

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