Skip to main content
55 votes
Accepted

Create a custom URL Protocol Handler

To register a new URL scheme handler with XDG, first create a Desktop Entry which specifies the x-scheme-handler/... MIME type: [Desktop Entry] Type=Application Name=DDG Scheme Handler Exec=open-ddg....
palswim's user avatar
  • 5,277
18 votes

What's the right way to add directories to XDG_DATA_DIRS?

The German ubuntuusers wiki has a nice list of files and directories that can be used for that purpose. Setting it globally From my research, appending to that environment variable globally is not ...
xeruf's user avatar
  • 571
18 votes
Accepted

Find the default application for a certain extension

AFAIK the choice of action is based on the file's mimetype rather than its extension. At least on Ubuntu, you should be able to use the query action of xdg-mime to show the default application for a ...
steeldriver's user avatar
  • 81.7k
18 votes
Accepted

How to open an .png type image in Linux terminal?

Use mimeopen -d to set the default application: mimeopen -d image.png sample output: Please choose a default application for files of type image/png 1) ImageMagick (color depth=q16) (display-im6....
GAD3R's user avatar
  • 67.2k
16 votes

Can't change the xdg-open url-handler to Firefox

I had this issue since Chromium made itself the default browser each time I installed it. Using xdg-mime fixed it: xdg-mime default firefox.desktop x-scheme-handler/https x-scheme-handler/http On ...
Matthias Braun's user avatar
11 votes
Accepted

xdg-open on debian 9 fails to open browser

@user310685 got it close - but DEFINITELY WRONG. That fix "works" only when xdg-open is NOT given "naked" file paths (i.e. with no leading "file://" URI scheme and double-slash) or file-schemed URI's (...
Stevel's user avatar
  • 226
8 votes
Accepted

What program to use to open files? (gnome-open, gvfs-open, xdg-open, etc.)

xdg-open is the safest bet. Not everyone will necessarily have gnome or gvfs installed. xdg-open, on the other hand, is not tied to any desktop environment or toolkit.
TheBlackCat's user avatar
8 votes

How does the xdg-open command know which application to use to open a file?

@Ivan That happens probably, because you didn't provide the right filetype when asking for the default application. Important is how xdg calls that specific file-type. This can easily be found out by ...
lauve's user avatar
  • 121
8 votes
Accepted

How can I run a .desktop file?

This answer over on askubuntu.com covers many different ways to solve the problem. The one that was the closes to doing what I wanted was the gtk-launch command: gtk-launch org.kde.kwrite.desktop ...
hugomg's user avatar
  • 5,807
8 votes

Setting default browser for zathura

In your ~/.config/zathura/zathurarc, add a the line set sandbox none Follow the issue here.
Kevin Zheng's user avatar
6 votes
Accepted

Why does xdg-open remove @ from a URI if it's the first character in the path?

xdg-open is attempting to comply with the standards... An @ mark is a delimiter between user- and host-names, and without the user-name it is unexpected (and not standard). If you want to use it in ...
Thomas Dickey's user avatar
5 votes

Set default xdg-open application to terminal program

TL;DR $ xdg-mime default vim.desktop <MIMETYPE> Or edit ~/.config/mimeapps.list. MIMETYPE is the output of $ xdg-mime query filetype <interested-file> If you are using some Desktop ...
Julian Coffee's user avatar
5 votes

How can I change the order in which update-desktop-database puts the applications supporting a mimetype?

You can not change the order (see also https://bugs.freedesktop.org/show_bug.cgi?id=71932). To change the default application system-wide you have to create a file /usr/share/applications/mimeapps....
Nessaker's user avatar
4 votes
Accepted

Comments in ~/.config/mimeapps.list

Association between MIME types and applications defers to the Desktop Entry Specification, which states that Lines beginning with a # and blank lines are considered comments and will be ignored, ...
Stephen Kitt's user avatar
4 votes
Accepted

Can't change the xdg-open url-handler to Firefox

Check the BROWSER variable in /etc/profile and /etc/environment and eventually in your ~/.bashrc. It is probably set to /usr/bin/xdg-open so you should consider to change it to avoid the recursive ...
temp's user avatar
  • 56
4 votes
Accepted

Opening a URL with xdg-open using Mozilla Remote Protocol

I cannot say anything about the specification but as far as just the result matters I (not being familiar with the quoting in such files, though) would expect this to work: Exec=bash -c 'echo ...
Hauke Laging's user avatar
  • 90.2k
4 votes
Accepted

xdg-open autocomplete not working when calling it with alias

I guess you have bash-completion installed, which automatically loads the completion it ships for the op command when you try to complete a command line starting with your op alias. You can avoid this ...
fra-san's user avatar
  • 10.3k
3 votes

How can I set default application for unknown file on xdg-open / mimeopen?

From man xdg-mime there is an option: xdg-mime default application mimetype(s) to set default applications. You can use xdg-mime default featherpad.desktop application/javascript to make featherpad....
Prvt_Yadav's user avatar
  • 5,872
3 votes

What's the right way to add directories to XDG_DATA_DIRS?

I'm not sure about system wide.. but as a single user (which is accessible sytem-wide) I include this line in my ~/.profile file. XDG_DATA_DIRS="/var/lib/flatpak/exports/share:$XDG_DATA_DIRS" And ...
Nicekiwi's user avatar
  • 131
3 votes
Accepted

xdg-open opens a specified htm file but ignores the tag (#) location within the page

Solution found thanks to pointers from @Ignacio Vazquez-Abrams. The issue was actually in the way xdg-open passes an argument to the default application. If the default application is registered in ...
bu5hman's user avatar
  • 4,751
3 votes
Accepted

Why does xdg-open use Mendeley as default for PDFs?

The question remains: where did xdg-open get the idea that Mendeley should be the default PDF viewer from? This is an eminently reasonable question. Here's a somewhat long answer in three parts. ...
Nathaniel M. Beaver's user avatar
3 votes
Accepted

Launch executable with xdg-open

xdg-open is just a shell script that detects Desktop Environment and call the corresponding program (gvfs-open for gnome , exo-open for XFCE, mate-open, etc.) So the limitations for launching an ...
George Vasiliou's user avatar
3 votes
Accepted

How to set the default web browser used to open URLs under i3?

Install perl-file-mimeinfo and configure it that way. See the Arch Wiki article on xdg-utils: If no desktop environment is detected, MIME type detection falls back to using file which—ironically—...
jasonwryan's user avatar
  • 73.4k
3 votes
Accepted

Syntax check ~/.config/mimeapps.list

As you say, Association between MIME types and applications specification is the relevant specification, but it doesn’t describe the file format in much detail. However, it defers to the Desktop Entry ...
Stephen Kitt's user avatar
3 votes
Accepted

How to associate a new (custom) mime type with files (based on file extension)?

The shared-mime-info repository already specifies the application/pgp-keys mimetype. You can see it here: <mime-type type="application/pgp-keys"> <comment>PGP keys</comment> <...
Nathaniel M. Beaver's user avatar
3 votes

`serverless login` return Error: spawn /home/imin/.serverless/bin/xdg-open ENOENT

I solved this issue by finding xdg-open with which xdg-open Then creating a symlink where needed ln -s /usr/bin/xdg-open /home/USER/.serverless/bin/xdg-open after it worked with no issue
johnny's user avatar
  • 31
3 votes

Opening a URL with xdg-open using Mozilla Remote Protocol

I just had this problem recently and there is a specification. here If the % is for the application, you need to put %%. That is for the future, when creating a .desktop file for youtube-dl and using ...
WGRM's user avatar
  • 817
3 votes
Accepted

How to register new mimetypes not available in xfce4-mime-settings so that they are recognized with xdg-open under XFCE4?

A solution is almost indicated in the question: hinder xdg-open from choosing exo-open. A brute-force approach is to copy /usr/bin/xdg-open to /usr/local/bin (/usr/local/bin is earlier in PATH unless ...
Gianluca's user avatar
  • 146

Only top scored, non community-wiki answers of a minimum length are eligible