Last active
October 8, 2024 07:33
-
-
Save auipga/27f5f928bd47936cb00f19dc450c57ed to your computer and use it in GitHub Desktop.
register btsync protocol for firefox on gnome (does also work with rslsync)
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 | |
# see http://kb.mozillazine.org/Register_protocol#Linux | |
gconftool-2 -s /desktop/gnome/url-handlers/btsync/command "`which rslsync` %s" --type String | |
gconftool-2 -s /desktop/gnome/url-handlers/btsync/enabled --type Boolean true | |
# get default profile path | |
ff_profile=$(cat ~/.mozilla/firefox/profiles.ini | grep Path | sed s/^Path=//) | |
ff_profile_dir="~/.mozilla/firefox/$ff_profile" | |
# see https://askubuntu.com/a/715465/260072 | |
ff_set() { | |
cd $ff_profile_dir | |
sed -i 's/user_pref("'$1'",.*);/user_pref("'$1'",'$2');/' user.js # change if present | |
grep -q $1 user.js || echo "user_pref(\"$1\",$2);" >> user.js # add if non-present | |
} | |
ff_set "network.protocol-handler.expose.btsync" true | |
#ff_set "network.protocol-handler.external.btsync" true # will be inserted automatically | |
#ff_set "network.protocol-handler.app.btsync" "`which rslsync`" # will be inserted automatically |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment