davatorium / rofi

Rofi: A window switcher, application launcher and dmenu replacement
https://davatorium.github.io/rofi/
Other
13.06k stars 608 forks source link

Unable to use $HOME (~) in .desktop files in drun mode #317

Closed roomcays closed 8 years ago

roomcays commented 8 years ago

Hi there! I have just switched from j4-dmenu-desktop to rofi's drun mode for launching applications. I have my custom launcher called firefox-developer-edition.desktop located at /home/user/.local/share/applications. Following you can find it's contents:

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Firefox Developer Edition
Type=Application
Terminal=false
Exec=~/apps/firefox_developer_edition/firefox %U
Categories=Development;WebDevelopment;Network;WebBrowser

Unfortunatelly rofi is unable to launch this application showing an error:

Failed to execute '~/apps/firefox_developer_edition/firefox'
Error: 'Failed to execute child process "~/apps/firefox_developer_edition/firefox" (No such file or directory)'

For me, it looks like the tilde (~) in the Exec path is causing the error. I think this way of setting path is valid for .desktop files, other launchers (including mentioned j4-dmenu-desktop) work well. So I am putting this case here as a bug :)

DaveDavenport commented 8 years ago

Aaah, you can try setting: rofi.run-command: bash -c "{cmd}" might fix it :D

The spec actually doesn't support it, only full paths or name.

The Exec key must contain a command line. A command line consists of an executable program optionally followed by one or more arguments. The executable program can either be specified with its full path or with the name of the executable only. If no full path is provided the executable is looked up in the $PATH environment variable used by the desktop environment. The name or path of the executable program may not contain the equal sign ("="). Arguments are separated by a space.

I guess I can easily fix it, the helper function in rofi already exists.

roomcays commented 8 years ago

I think that sticking to the freedesktop specification is important. My case just proves that other launchers are not following it. Thank you for such a quick response. I will sed my .desktop files with absolute paths.

github-actions[bot] commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.