Using surf-open.sh with xdg-open

Wed 2015-09-16

This is how you can set suckless surf as your default browser.

First, write a surf-open.desktop file like this:

[Desktop Entry]
Version=1.0
Type=Application
Name=surf-open
GenericName=Web Browser
Comment=Open new surf window in existing tabbed session
Categories=Network;WebBrowser
MimeType=text/html;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;
Exec=surf-open.sh %U
Terminal=false

Save the .desktop file in ~/.local/share/applications/.

Then, copy surf-open.sh to somewhere in your PATH, for example to /usr/local/bin/.

Finally register your new desktop file to be used for opening html files and http/https urls.

user@box ~ $ xdg-mime default surf-open.desktop x-scheme-handler/https
user@box ~ $ xdg-mime default surf-open.desktop x-scheme-handler/http
user@box ~ $ xdg-mime default surf-open.desktop text/html
Tags:

This text by Ludger Sandig is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.