Sometimes when i am using certain applications (especially text editors), the applications themselves do not make URLs that are written out clickable and openable in my default browser. Usually, this would result in me having to highlight the link, copy it to the clipboard, switch to my web browser, open a new tab, paste the link and go.

However, the quick hack for Fedora described in this tutorial will set up a keyboard shortcut so you can simply highlight the link text, do a keyboard shortcut, and the link will open up in your default browser.

Step 1 — Download xsel

first up we need to download a little command line utility called xsel that will let us get at the clipboard selection from a bash script. Install xsel with the command:

sudo yum install xsel

Step 2 — create the script in your user’s bin directory

If you don’t already have it, create a directory called bin in the .local directory in your home directory:

mkdir ~/.local/bin

Then edit a new file in ~/.local/bin (i called mine openindefaultbrowser):

gedit ~/.local/bin/openindefaultbrowser

Now, add the following code to the openindefaultbrowser file, and save it.


xdg-open $(xsel -p)

Now, finally, make the script executable with the command:

chmod +x ~/.local/bin/openindefaultbrowser

Step 3 — bind your new script to a keyboard shortcut

Open up the keyboard preferences, and switch to the “shortcuts” tab. Click “Custom Shortcuts” from the list on the left, and then click the + button to add a new shortcut. Name the shortcut whatever you want and put the name of your script in the command field and press add.


Now, click on the shortcut, and assign an keyboard combo. (i chose super+F).

Ready to go

Your new shortcut should be ready to go. To use it, highlight (select) the text of a url, press your keyboard shortcut, and your webbrowser should open up with the link you highlighted. Note that this script is not smart, if you highlight something that is not a url, and press the shortcut, it will try to open it as it was a url :)