Skip to main content
13 votes

How do I debug a .desktop file?

You can also use the validation tool desktop-file-validate to find more problems. (see also: How to validate/verify .desktop files?) # Result for your example $ desktop-file-validate qutebrowser....
Jonas Stein's user avatar
  • 4,338
9 votes

gtk-launch only works when present working directory is Desktop

To make this work, you have to satisfy two requirements: Your myapp.desktop file should reside in one of several directories (not exclusively /usr/share/application). These depend on your Linux ...
sancho.s ReinstateMonicaCellio's user avatar
9 votes

How do I debug a .desktop file?

I normally add the following to see what is being executed: Terminal=true TerminalOptions=\s--noclose
user375770's user avatar
8 votes
Accepted

set multiple environment variables in .desktop file

As mentioned above, your variant with the addition of several variables should work correctly Exec=env FOO=bar /usr/bin/my_prog So either there is some kind of external factor, or the question is ...
lucidyan's user avatar
  • 210
8 votes

"@@" in Flatpak desktop files

--file-forwarding If this option is specified, the remaining arguments are scanned, and all arguments that are enclosed between a pair of '@@' arguments are interpreted as file paths, exported in the ...
Nova's user avatar
  • 3,025
7 votes
Accepted

Steam is unable to create .desktop file(s). Workaround or fix?

TL;DR Create the .desktop file with contents, the Steam Id of Project Hospital is 868360, you can see this number inside the Steam link, e.g.: https://store.steampowered.com/app/868360/...
Vlastimil Burián's user avatar
7 votes

How to launch `.desktop` files from the terminal (or dmenu)

As this Ask Ubuntu SE answer and GitLab issue comment state: #!/usr/bin/env sh gio launch '/path/file.desktop'
RokeJulianLockhart's user avatar
6 votes

What does %k mean in Exec=?

According to the Desktop Entry Specifications: %k The location of the desktop file as either a URI (if for example gotten from the vfolder system) or a local filename or empty if no location is ...
Sergiy Kolodyazhnyy's user avatar
6 votes

List all desktop files that appears in application menu

Instead of searching the filesystem yourself, you could use the Gio library (part of Gtk/GObject/GLib ecosystem on which Gnome is built). You can use this through Python on any Gtk-based desktop ...
ejm's user avatar
  • 661
6 votes
Accepted

Why are environment variables not resolved when double-clicking .desktop file?

From the Ubuntu documentation 1: Shell config files such as ~/.bashrc, ~/.bash_profile, and ~/.bash_login are often suggested for setting environment variables. While this may work on Bash shells for ...
akasolace's user avatar
  • 193
5 votes

Autostarting .desktop application at startup not working

My standard debugging flow for desktop entry file (.desktop application): file format - check if the desktop entry follow the spec of freedesktop. executable command - if the previous check looks ...
tai271828's user avatar
  • 151
4 votes

Do `%f, %F, %u, %U` belong to bash?

Have a look at Recognized Desktop Entry Keys of FreeDesktop. Specifically have a look at the Exec Key. In your case $U means it should handle the input which comes after the call to the program as ...
Royi's user avatar
  • 1,163
4 votes
Accepted

Where is the relevant .desktop file?

You should be able to find the file in one of these folders: /usr/share/applications /usr/local/share/applications ~/.local/share/applications See https://wiki.archlinux.org/index.php/...
laktak's user avatar
  • 6,373
4 votes

How to associate markdown files with a web browser?

Based on this: pandoc README.md | firefox "data:text/html;base64,$(base64 -w 0 <&0)" # or python3 -m markdown README.md | firefox "data:text/html;base64,$(base64 -w 0 <&0)&...
pLumo's user avatar
  • 23.2k
4 votes
Accepted

Making Neovim from GitHub the default file handler for text/source files

Have you tried setting and exporting one or more of the $VISUAL, $EDITOR, $SENSIBLE_EDITOR, or $SELECTED_EDITOR environment variables? This would need to be done in the environment before running ...
cas's user avatar
  • 84.4k
3 votes

i3wm dmenu add .desktop file

dmenu can find applications in /usr/bin or /bin/ So you can just create a symbolic link to the path of studio.sh, which would be sudo ln -s /usr/local/android-studio/bin/studio.sh /usr/bin/android-...
Amith's user avatar
  • 313
3 votes

List all desktop files that appears in application menu

The free desktop specification for the Applications menu search path is here. The short answer to your question is append "applications" to every directory in the search path $XDG_DATA_DIRS.
Xuth's user avatar
  • 31
3 votes

Why is the icon I've placed into /usr/share/icons not displaying in the MATE Applications menu?

I had the same problem and what worked for me was to update the cache of the hicolor theme: /usr/share/icons/hicolor/icon-theme.cache. You do this with the following command: sudo gtk-update-icon-...
Simon's user avatar
  • 31
3 votes
Accepted

How to define wm class for terminal commands in .desktop files

You can't setup WM_CLASS via .desktop file because it is up to application to set up its own WM_CLASS. But many applications still allow to change their class using standard methods of their toolkit (...
anlar's user avatar
  • 4,397
3 votes
Accepted

Trying to get process name from Exec= line in .desktop file. Error when running Exec= when its a bash script

It looks like your exe variable has the name of the script quoted. So, if the script is foo.sh, then $exe is actually "foo.sh" and not foo.sh. Therefore, you are telling bash to find a file ...
terdon's user avatar
  • 252k
3 votes
Accepted

Autostarted .desktop application doesn't exit on log out

This is because KillUserProcesses is no by default in Ubuntu. This setting causes user processes not to be killed when the user completely logs out. To change this behavior in order to have all user ...
binarysta's user avatar
  • 3,337
3 votes

How to launch `.desktop` files from the terminal (or dmenu)

Provided that they are executable (chmod u+x /path/to/app.desktop) you can add this shebang at the top: #!/usr/bin/env xdg-open And from then on you can call your application with: /path/to/app....
Eduardo Trápani's user avatar
3 votes
Accepted

Is it possible to tell linux to look for .desktop files in a directory?

If you want another one directory for desktop files, you need to create a directory with the name applications somewhere. For example: $HOME/desktop/applications Then put the path of the parent folder ...
tehkonst's user avatar
  • 173
3 votes
Accepted

Application showing in Menu, but .desktop file not present in /usr/share/applications

The .desktop file of Flatpak apps are generally stored at: /var/lib/flatpak/app/[app name]/current/active/export/share/applications. The .desktop files for per-user applications are stored at: ~/....
Gagan's user avatar
  • 700
3 votes

Is `xdg-open`, `gtk-launch`, or `gio-launch` preferable for invoking `.desktop` files via the CLI?

I would recommend xdg-open; this is a shell script that will try and work out the current desktop environment and use the appropriate command, which may include testing multiple alternatives (eg gio ...
Stephen Harris's user avatar
2 votes

Getting the current path in .desktop EXEC command

As mentioned in Desktop Entry Specification, %k or other field codes must not be used inside a quoted argument. However, there are ways to copy an expression with space to a variable without using ...
Nafiur Rahman Khadem's user avatar
2 votes

How do I debug a .desktop file?

I've been debugging a desktop file and found this useful article on the archlinux website. https://wiki.archlinux.org/title/desktop_entries#Run_a_desktop_file_from_a_terminal If gtk3 is installed, ...
iNulty's user avatar
  • 121
2 votes

gtk-launch only works when present working directory is Desktop

The manpage states the following: gtk-launch takes at least one argument, the name of the application to launch. The name should match application desktop file name, as residing in /usr/share/...
hspaans's user avatar
  • 562
2 votes

Start desktop launcher from command line on Mint

The dex application is probably the simplest way to do this. sudo apt install dex and then dex ~/Desktop/some-application.desktop or since many/most system applications are in /usr you could use dex /...
dragon788's user avatar
  • 882

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