Last active
March 24, 2024 22:04
-
-
Save cold-logic/77b9fea99452d7026099489f34e81fe7 to your computer and use it in GitHub Desktop.
Browser Chooser for GNOME
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Desktop Entry] | |
Categories=GNOME;GTK;Network;WebBrowser; | |
Comment=Browser picker | |
Exec=$HOME/.bin/browser_chooser %U | |
GenericName=Web Browser | |
Icon=firefox | |
Keywords=Internet;WWW;Browser;Web;Explorer | |
Name=Browser Chooser | |
Type=Application | |
Version=1.0 | |
MimeType=x-scheme-handler/unknown;x-scheme-handler/about;text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Browser chooser for GNOME | |
# Takes over as the default browser and prompts for where to open URLs | |
# Requires rofi & papirus-icon-theme | |
# sudo apt install rofi papirus-icon-theme | |
# Save this file as: | |
# $HOME/.bin/browser_chooser | |
# Create a desktop entry here: | |
# touch $HOME/.local/share/applications/browser_chooser.desktop | |
# With the contents: | |
# [Desktop Entry] | |
# Categories=GNOME;GTK;Network;WebBrowser; | |
# Comment=Browser picker | |
# Exec=$HOME/.bin/browser_chooser %U | |
# GenericName=Web Browser | |
# Icon=firefox | |
# Keywords=Internet;WWW;Browser;Web;Explorer | |
# Name=Browser Chooser | |
# Type=Application | |
# Version=1.0 | |
# MimeType=x-scheme-handler/unknown;x-scheme-handler/about;text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall; | |
# Set permissions | |
# chmod +x $HOME/.local/share/applications/browser_chooser.desktop | |
# Activate with: | |
# xdg-settings set default-web-browser browser_chooser.desktop | |
# Change themes with: | |
# rofi-theme-selector | |
browsers="Firefox\0icon\x1ffirefox,Chromium\0icon\x1fchromium" | |
browser_count=$(($(echo "$browsers" | tr -cd ',' | wc -c)+1)) | |
browser_choice=$( | |
echo -en "$browsers" | \ | |
rofi -dmenu -i -sep ',' -format i -width 10 \ | |
-lines $browser_count -line-margin 0 -line-padding 1 \ | |
-font "hack 32" -hide-scrollbar \ | |
-icon-theme "Papirus" -show-icons | |
) | |
[[ "${browser_choice}" == "0" ]] && chosen_browser="firefox" | |
[[ "${browser_choice}" == "1" ]] && chosen_browser="chromium" | |
# chosen_browser=$( | |
# case $browser_choice in | |
# 0) | |
# echo -n "firefox" | |
# ;; | |
# 1) | |
# echo -n "chromium" | |
# ;; | |
# esac | |
# ) | |
if [ -n "$chosen_browser" ]; then | |
$chosen_browser $1 | |
fi |
Author
cold-logic
commented
Feb 5, 2021
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment