Bug 374571 - Created starter runs wrong command
Summary: Created starter runs wrong command
Status: RESOLVED NOT A BUG
Alias: None
Product: plasmashell
Classification: Plasma
Component: Icons-only Task Manager (show other bugs)
Version: 5.8.5
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Eike Hein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-05 01:11 UTC by Lukas Ba.
Modified: 2017-01-06 05:54 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Ba. 2017-01-05 01:11:32 UTC
* Created starter runs wrong command
* no way to create correct starter
* wrong icon

I have created a custom .desktop file for starting Firefox.

> ~/local/share/applications/sandbox-firefox.desktop

> [Desktop Entry]
> Type=Application
> Name=Sandboxed Firefox
> GenericName=Secured Firefox
> Exec=firejail /usr/lib/firefox/firefox
> Categories=Network
> Icon=firefox-symbolic
> Terminal=false

When i start firefox directly from this .desktop file (via krunner), the correct command "firejail /usr/lib/firefox/firefox", as per the Exec= line is executed.

However, its icon is not the "firefox-symbolic" icon i have defined in the sandbox-firefox.desktop file, but the standard-firefox-icon.

Then i right-click on the standard-firefox-icon shown in the Icons-only Task Manager to create a new starter.

When i click on this starter, the wrong command is executed.

This command is "firefox", and probably taken from the standard .desktop file from /usr/share/applications, which says Exec=firefox %u.

AFAIK, there is no other way of adding a starter to the Icons-only Task Manager than right-clicking on a running application, which means i can't add a starter in this Task Manager that starts sandbox-firefox.desktop.
Comment 1 Eike Hein 2017-01-05 05:26:03 UTC
Rename the .desktop file to match the WM_CLASS of your Firefox window, or find a way to change its WM_CLASS to "sandbox-firefox", otherwise the Task Manager can't match the two up.
Comment 2 Lukas Ba. 2017-01-05 15:21:21 UTC
(In reply to Eike Hein from comment #1)
> Rename the .desktop file to match the WM_CLASS of your Firefox window, or
> find a way to change its WM_CLASS to "sandbox-firefox", otherwise the Task
> Manager can't match the two up.

Changing the WM_CLASS to "sandbox-firefox" with xprop -s doesn't achieve anything.

The task manager doesn't react to changed WM_CLASS.
Comment 3 Eike Hein 2017-01-06 05:54:41 UTC
It works fine for me, but note that you can't use xprop. xprop -s uses XChangeProperty, which can't set the WM_CLASS property because it doesn't support the stupid special format history cooked up for WM_CLASS (two consecutive null-terminated strings in a string prop for the two parts that make it up). I recommend using xdotool, which uses XClassHint and can set the required struct format. E.g. I turned my Firefox into Konversation with:

xdotool set_window --class konversation 0x4e00010
xdotool set_window --classname konversation 0x4e00010

When you then use the context menu to add a launcher, and make sure Firefox is later using this WM_CLASS again, things fall into place.