Bug 427550

Summary: Implement a method to add a launcher to the panel via right-click
Product: [Plasma] plasmashell Reporter: php4fan
Component: PanelAssignee: Plasma Bugs List <plasma-bugs>
Status: ASSIGNED ---    
Severity: wishlist CC: nate, plasma-bugs, vibs.35
Priority: NOR Keywords: usability
Version: master   
Target Milestone: 1.0   
Platform: openSUSE   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=390817
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description php4fan 2020-10-11 17:12:43 UTC
I am new to KDE Plasma.

Cinnamon and probably other desktop environments actually have this exact same issue, but that doesn't make it any less of an issue. It has always irritated me.

I assume the horizontal bar at the bottom of the screen, where you see currently open windows and also launcher icons to launch applications that are not already open, is called "task manager", given that right-clicking on it the first entry in the context menu that shows up says "Configure Task Manager".

When you have already launched an application, and you want to add it as a button on the Task Manager's bar, you can right-click on it and choose "pin to Task Manager". Cool.

You can also look for the application in the Application Launcher and drag it onto the Task Manager. Cool.

But what if I need to create one from scratch?? I want to add an icon that runs a given executable. It's not always an option to launch it from a terminal or from the Application launcher and then pin it while it's open. Is that the assumption? Is that why there is no easily discoverable option to add a new one? Do I need to explain that you cannot always do that??

This should be an easily discoverable thing to do. This should be obvious. I right-click on an empty space on the bar and I EXPECT to see one option in the context menu that says "add launcher icon", or whatever the correct name is.

It's completely ridiculous that it's not there. I explored the other options: "add widger", no; "add panel", no.
Then there is "Configure Task Manager": perhaps there I'll find an option to add buttons. Nope.
In "Edit panel"? Nope.

So far, the only way I've figured out to accomplish this was to create a shortcut (a link?) on the desktop, and then drag it onto the task manager.
I thought I had accomplished what I wanted. But to my surprised, when I deleted the desktop shortcut, the one in the task manager stopped working. It didn't even disappear: it was still there, but when I tried to click it, it gave me an error. Because apparently what you create by dragging the desktop shortcut icon onto the task manager is a link in the task manager that links to the desktop shortcut that links to the application.

An example use case is Tortoise Hg.
In order to run it, I have to run the executable /path/to/thg/thg, which is a script that then runs something else (I thin it runs "python some-python-program.py", I'm not sure, I don't care). So, the window that I eventually see is something else from the executable that starts it, and I cannot pin it to the task manager (I tried).

But this is just one of infinite possible use cases.

To this day I still haven't figured out how to do this. This is something that you should discover by just clicking and right-clicking around.
Exactly like you right-click on an already-open application's button and discover the "pin to task manager" option. This is as basic as that, so if you understand that "pin to" is a basic operation that one should discover without googling "how to pin an application to task manager", you should equally well understand that adding a new one should be something that you can discover as easily without having to google "how to add an application to the task manager"

I am not asking how to do that. I'll google it and I'll find out. I'm reporting the issue that it's ridiculously difficult to discover how to do that.
Comment 1 Nate Graham 2020-10-19 16:57:44 UTC
Thanks for trying out KDE Plasma! Other than this hiccup, I hope you're enjoying it so far.

As for your issue, the way you can pin an arbitrary CLI command to the Task Manager is by creating a new .desktop file entry for the command you want to run. You can do this using the KMenuEdit app, which is also accessible from Right-Click on Application Launcher > Edit Applications.

From KMenuEdit you can click the "New Item" button and create an entry for the thing. You can give it a name, and icon, and specify an command to run. Once this is done, it will appear in Application Launcher and you can add it to your Task Manager in all the normal ways: drag it there, right-click > pin, etc.

If you need for it to handle arguments/paths, you can add a special keyword. %f means "handle a single file" and %F means "handle potentially multiple files if given a space-separated list". %u and %U do the same thing for URLs, if the app has the capability to handle arbitrary URLs with schemes like HTTP:// SMB:// and so on. If you set up the .desktop file this way, you can actually drag files to the Task Manager entry and it will do exactly what you expect.

All of this is not KDE-specific; it's governed by a cross-desktop standard about .desktop files: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

---

I agree that being able to create your own .desktop files for arbitrary command-line programs isn't the most discoverable feature. However it's also not a very common workflow, because typically, installing a GUI app will also install a suitable .desktop file automatically. If this isn't happening, I would argue that that's a pretty significant bug that should be reported to the app's developer. Manually creating .desktop files isn't something we should expect users to have to do themselves.

Can you explain which specific apps you're having this problem with?
Comment 2 Bug Janitor Service 2020-11-03 04:33:34 UTC Comment hidden (spam)
Comment 3 Bug Janitor Service 2020-11-18 04:33:59 UTC Comment hidden (spam)
Comment 4 php4fan 2020-11-18 11:11:50 UTC Comment hidden (spam)
Comment 5 Christoph Feck 2020-11-18 13:13:38 UTC
The information we asked for was:

> Can you explain which specific apps you're having this problem with?
Comment 6 Nate Graham 2020-11-18 16:01:43 UTC
Yes, and I asked that because I was unsure whether the issue was caused by a defective app not shipping with a correct desktop file, or it was from using a CLI app or some other app without a .desktop file and the reporter needed to create one manually.

In the former case, it's a bug with the app in question, while with the latter case, the current UX seems sufficient given that this is a very uncommon, advanced workflow and we already have a whole app dedicated to it (KmenuEdit). That app isn't prominently advertised precisely because using it means you're engaging in an advanced task and we don't want to push that kind of stuff right in the user's face. Editing .desktop files without knowing what you're doing can break various parts of the UI or your ability to launch apps.

In either case, I don't think there's anything for us to fix here.
Comment 7 php4fan 2020-11-18 16:15:55 UTC
> The information we asked for was:

I know, and what I said in comment 4 still holds.


For example, Telegram Desktop and TortoiseHg (and others I don't remember right now).

Actually, it turns out both of them come with a .desktop file but I didn't know that what I needed was a desktop file to begin with.

When I right click on the panel (assuming that's what you call the thing at the bottom of the screen where the application icons are), there should be an option "Add application", and among other options, it should suggest me to browse for a .desktop file. There's not even that.

But also, I might want to just add an icon to launch a shell script that wasn't even designed to be a desktop application (not to mention a binary that simply doesn't come with a .desktop file).
Comment 8 php4fan 2020-11-18 16:29:45 UTC
> Yes, and I asked that because I was unsure whether the issue was caused by a 
> defective app not shipping with a correct desktop file, or it was from using a 
> CLI app or some other app without a .desktop file and the reporter needed to 
> create one manually.

It's for both cases (the former not necessarily being "a defective application" but just a program that wasn't designed with a desktop environment in mind). In either case, I just want to create a button that is a shortcut to launch an executable. If a .desktop file is needed for that, a trivial one can be created automatically. I literally just want to be able to tell the system: "please, add a button here that launches this binary". The natural place where I'd expect to find such a functionality is a right click on the place where I want to add the shortcut, i.e. the panel.
Comment 9 Nate Graham 2020-11-18 18:36:45 UTC
So your complaint specifically is that there is no way to do this via right-clicking on the panel, even though there are other ways to do it (drag-and-drop to panel; right-click on app entry in launcher menu > Pin To Task Manager/Add to Panel; create entry in kmenuedit and do one of the above).

That seems reasonable to improve. The current panel right-click menu has "Add Widgets..." but nothing there would do what you want because the generic desktop file launcher widget is not exposed in the widgets list there. Perhaps it should be.
Comment 10 Bug Janitor Service 2024-10-02 21:48:13 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4781