Launching .desktop Applications Results in "Command not found" Notification
Closed this issue · 7 comments
I use GNOME Shell 41.3 on Debian.
Here are some example configuration directives that do not work:
<Alt>F6,brave-browser.desktop,,
<Alt>F8,jetbrains-studio.desktop,,
<Alt>F9,emacs.desktop,,
For some unknown reason the Brave browser shortcut flickers the currently focused application (blue border), and nothing else happens. The other two shortcuts result in a notification as described in the issue title.
When I use lg
with the corresponding command, e. g. Shell.AppSystem.get_default().lookup_app("brave-browser.desktop")
the id
's for all three applications work, though.
Hi, these are files, not commands. Try either launch them with a launcher like gtk-launch
<Alt>F6,gtk-launch brave-browser.desktop,,
or see the contents of these .desktop files in /home/$USER/.local/share/applications/ and use the Exec=
command.
Didd it help?
@e3rd Thanks for your immediate response. I must admit that I find your answer confusing.
I'm refering to the PR #38 that introduced support for .desktop files.
When I take a look at the modified implementation the run
function first tries to lookup an application with the GJS function lookup_app
. Only if it can't find the application with the help of this mechanism it uses the spawnCommandLine
function. What appears to happen in my case is that the lookup_app
function does not find the application, hence app
is null
and the if
branch is never entered, but when I run the same function in lg
I get a valid object returned.
The configuration directive you posted works, but I obviously don't get the "run or raise" behavior. I added wm_class
to the configuration and now the following configuration is an OK-ish workaround:
<Alt>F6,gtk-launch brave-browser.desktop,brave-browser,
<Alt>F8,gtk-launch jetbrains-studio.desktop,jetbrains-studio,
<Alt>F9,gtk-launch emacs.desktop,Emacs,
Here is the introduced change from the aforementioned PR for reference:
run() {
if (this.mode.get(Mode.VERBOSE)) {
this.debug("running:", this.command)
}
const app = Shell.AppSystem.get_default().lookup_app(this.command);
if (app !== null) {
return app.activate();
}
return spawnCommandLine(this.command);
}
And here's an excerpt from the official documentation:
command
can be either a commandline to launch, or the name of an application's .desktop file. Ifcommand
is a commandline, this extension will spawn a new process using that commandline. Ifcommand
points to a .desktop file, this extension will activate the application from that .desktop file
Then it even gives an example like in my initial configuration:
This line starts gnome-terminal using it's .desktop file:
<Super>f,org.gnome.Terminal.desktop,,
See, no commands, just a desktop file!
This doesn't work. It would be maybe better to revert the PR, including the documentation?
Maybe @DaanDeMeyer knows what goes wrong in this case?
I've investigated and that's all my bad! The change PR #38 did not make it to the version of extensions.gnome.org . Pulling new version now, I hope they'll accept it soon.
@e3rd Thanks for the clarification! 🙂
Would you please try the current vesion if that works? :)
I verified that version 16 was updated as part of the default Gnome Extensions mechanism, and that it works as documented. My configuration is very minimal now and looks basically like in my first post:
<Alt>F6,brave-browser.desktop,,
<Alt>F8,jetbrains-studio.desktop,,
<Alt>F9,emacs.desktop,,
Thanks for this extension and continuous work on bugs & features!
Thanks a lot for testing!