klangman / CassiaWindowList

A WindowList/PanelLauncher applet for the Cinnamon desktop environment
https://cinnamon-spices.linuxmint.com/applets/view/372
GNU General Public License v3.0
13 stars 1 forks source link

Cannot (Or How To?) Pin Certain Windows #1

Closed abbasou closed 10 months ago

abbasou commented 1 year ago

It seems like some windows cannot be pinned to the window list. Wondering why this is or how to get around this? For example, apps launched from a binary or link to the binary cannot be pinned.

abbasou commented 1 year ago

Workaround: Add custom item in Cinnamon Menu, then right click -> Add to Panel. Doesn't seem to add to Cassia Window List specifically, but at least it adds a launcher to the Panel. Was hoping Cassia would behave like Windows Taskbar/Mac Launcher as a combination Window List/Launcher. Not sure why Cinnamon is behind in this regard when I think pretty much every other DE has this?

klangman commented 1 year ago

The way that applications are organized in Gnome (and KDE) is using the XDG Desktop Entry specification. This specifies the layout of ".desktop" files. It's these files that are the basis for a unique "application" in the DE. If a window does not have an associated ".desktop" files then it can not be pinned.

When you create a custom menu item in the Cinnamon Menu you are creating a ".desktop" file and specifying the executable that it will run. So in this way you are creating a unique application for your environment. Once this is done you can then pin that application to the CassiaWindowList (as well as most other window lists).

As for the "Add to Panel" not adding to CassiaWindowList: It did work at one point in time, but I tested it just now and for some reason it is not working for me ether. I'll look into that.

In theory an applet can register to take on the responsibility to handle the "Add to panel" requests, but only the 1st loaded applet that requests this responsibility will get called on that event. So if you have other applets loaded that take on this task and that applet is loaded before CassiaWindowList, then the "Add to panel" will not result in the application being added to CassiaWindowList. I don't think we have any easily accessible ability to adjust the order in which applets are ordered.

Was hoping Cassia would behave like Windows Taskbar/Mac Launcher as a combination Window List/Launcher. Not sure why Cinnamon is behind in this regard when I think pretty much every other DE has this?

Maybe I don't fully understand your meaning, but many WindowLists in Cinnamon have what I think you are describing including the default "Grouped window list" which is included with Cinnamon. You can "pin" applications so they will stay on the panel even when they are not running. They have the same dependency on the existence of a ".desktop" file being associated with the running window in order to "pin" it to the applets panel.

It's true the the default "Panel Launchers" applet will only launch new instances of applications added to the panel, but if you want Windows taskbar like behaviour you can use only the "Grouped Window List" and remove the "panel launchers" applet.

The new function that Cassia adds is that you can have a separate panel area with pinned buttons (like the panel launchers applet) but it will also allow this area to restore existing windows rather the always launch new ones.

klangman commented 1 year ago

As for the "Add to Panel" not adding to CassiaWindowList: It did work at one point in time, but I tested it just now and for some reason it is not working for me ether. I'll look into that.

I forgot that I had added a auto-hide panel with the standard "grouped window list" applet. It was the applet that was getting the "Add to panel" notification. That's why I didn't see items being added to the Cassia Window List. So I think the "Add to panel" should be working right for this applet as long as it's the first applet loaded to register for the responsibility of handling the "Add to panel" requests.

semog commented 1 year ago

I have created a ".desktop" file for my application, and I am using that launcher shortcut to start it, but CassiaWindowList still does not give the option to pin the window. It is also not using the application icon I specified in the desktop file. It is using the default icon. This is broken from CobiWindowList, since that applet works correctly with my application and its desktop file. Any help or troubleshooting tips are appreciated.

(Running Debian 12 Bookworm)

klangman commented 1 year ago

Can you paste a copy of your .desktop file here?

semog commented 1 year ago

Here's what my .desktop file looks like:

[Desktop Entry]
Name=My Test App
Exec=/home/user/myapp
Comment=
Terminal=false
Icon=myicon
Type=Application

What I discovered by looking at some of the system .desktop files (like Calculator), was that my file was missing an option called StartupNotify. This is a boolean value entry, and when I added it like this:

StartupNotify=true

then the application became pinnable! The displayed label in the applet tray changed from the window text to the text from the Name entry. However, the icon changed from the default bluish icon to the red rocket launcher icon, which is not the icon I specified in the .desktop file. This is at least progress!

Update: When I pinned the launcher, it didn't work exactly right. When I clicked it, it created a new entry in the applet panel for the launched application, and that newly launched application was not pinnable. It also did not pass the command line parameters to that newly launched application.

semog commented 1 year ago

Additional info: If I change the Exec= line to Exec=gnome-calculator in my .desktop file, and leave everything else the same (even with the StartupNotify entry removed), then the calculator will launch correctly and be pinnable. The calculator icon is displayed in the applet panel, which means that the icon specified in the .desktop file is not actually being used.

So, there seems to be something up with my app. It is a Flutter desktop app (built using Flutter 3.10.5). I think something must have changed with Debian 12 and whatever version of Cinnamon they are using that is different from Debian 11. Everything works correctly with my app on Debian 11.

klangman commented 1 year ago

I believe the below link describes what your application needs to do in order to function properly with regards to desktop file association. You are right that "StartupNotify=true" is a part of process. I had a problem with "dnfdragora" in Fedora not showing as "running" in any window-list but it would launch from a pinned button and by changing it's desktop file to "StartupNotify=true" from "StartupNotify=false" solved it.

https://specifications.freedesktop.org/startup-notification-spec/startup-notification-0.1.txt

See the environment variable DESKTOP_STARTUP_ID parts in the above.