nsz32 / docklike-plugin

A Dock-like Taskbar Plugin for XFCE
GNU General Public License v3.0
334 stars 44 forks source link

VirtualBox Icons #76

Open tomas-chrastina opened 3 years ago

tomas-chrastina commented 3 years ago

I came to problems with displayed icons for VirtualBox machines. In taskbar is displayed only general VirtualBox icon. Separate icons are displayed in group list. image

Even when 1 machine is running, result is the same: image

Questions:

  1. How should I configure it, to display icon of Virtual Machine instead of general one?

  2. Is there any way to force window to be separated in taskbar? I'd like to have separate icon for each VirtualBox machine. Update: I also came to need (or would be nice) to have serparted window for Thunderbird application and windows with new writing email. But as far as I get it, it would be only possible to distinguish based on some rules (patterm, regex?) checking windows name.

Parameter Value
OS Xubuntu 20.04.1
Docklike 0.0~git20201226.10f92ec-0ppa1~20.04

I created custom .desktop file for each machine => not working Then I tried to add custom icon parameter => not working I also tried to add parameter StartupWMClass => not working

I guess that when I watched closely, it started with correct icon, but was replaced with general VirtualBox icon right away (in split second).

As I can see xprop parameters, even WM_CLASS is replaced (ignored?). I guess it's due to VirtualBox process took over?

Thank you in advance for help.

vm-xubuntu.desktop (Private data replaced with ###) ``` [Desktop Entry] Version=1.1 Type=Application Name=vm-xubuntu Comment=vm-xubuntu Icon=xubuntu-logo Exec=/usr/lib/virtualbox/VirtualBoxVM --startvm "{###}" Actions= Categories=menulibre-virtual-machines; StartupWMClass=vm-xubuntu ```
xprop (^WM) (Private data replaced with ###) ``` WM_STATE(WM_STATE): WM_NAME(STRING) = "xubuntu (VitualBox Guest Additions) [Running] - Oracle VM VirtualBox" WM_CLIENT_LEADER(WINDOW): window id # 0x7800008 WM_HINTS(WM_HINTS): WM_CLIENT_MACHINE(STRING) = "###" WM_CLASS(STRING) = "VirtualBox Machine", "VirtualBox Machine" WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST WM_NORMAL_HINTS(WM_SIZE_HINTS): ```
nsz32 commented 3 years ago

Icons in windows lists are the window declared icon (appears in the tittle bar too). Icons in panel are .desktop associated (especially with WM_CLASS prop). There is no way to do what you want, as window of vb instance have the same WM_CLASS as vb manager (cause they are associated). If you really want your expectations, goto https://github.com/nsz32/docklike-plugin/blob/10f92ec2fe8eee2c98980164fc021c49e631bbb9/src/Wnck.cpp#L173 You need to detect the WM_CLASS of virtualbox (set in groupName), then parse the window title, to set groupName to a value that is related to the vbox instance name. Then create the appropriate related.desktop file.

tomas-chrastina commented 3 years ago

Hello!

I don't know how does it work under the hood. So maybe just few theoretical thoughts/suggestions.

  1. As I mentioned, I could see, that it looks like, when new process starts, it is displayed as separated group with correct icon initially. And I guess there is a moment (hook/event) when icon is replaced and window grouped with other VirtualBox windows. I guess it is in the moment, when this new process of VirtualBox takes over. So maybe add some exception (customized) to spacial handling of icons for such programs? To use custom icon from windows. But I understand, it could became problematic, if there are more windows. But still then one of them (depending of open order) could be just fine?

  2. Add feature to special handling of icons when one window is open. To evaluate/check panel icon vs window icon. And if set so, override panel icon with window icon if they don't match. This could be define only for some user defined custom applications (rules) to avoid performance problems. So don't use it until someone set it explicitly.

  3. Add more general functionality of icon override. Add an option to define some rules (with window name with pattern/regex included) to override icons. To be able to define rule to use custom defined icon for specific windows/application alongside the default handling. It can solve many issues with strange icons displayed. It can be also part of a standard code later, for known/common applications. This way it would be possible to even add an option to keep this application as separated in panel, as mentioned in 2.

And what about question number 2.? Because I thought about adding it as feature request (and we'll see). But was waiting for answer for this first.

Thank you in advance.

nsz32 commented 3 years ago
  1. Yep, as I remember, VB starts an instance with WM_CLASS "VirtualBoxVM" for 1 second then set it to "VirtualBox Machine"
        1. Everything you say here is possible and, for sure, trustworthy. But I will not implement this, sorry.

You seems motivated for your features, so it embarrass me a little. Please understand that :

I started this project to fulfill my needs that it satisfies well since many months from now. I have shared it because I use many (huge or little) shared projects which I'm happy with (and even more because they are ... shared). Covidocircus gave me times in the right moment to develop docklike. I work now as a main developer on an very nice project that takes me many time : at home I don't want to see any lines of code, so it's simply impossible for me to work on a feature that I don't need or that didn't fix an error.

I will probably fix existing issues, implement #43 and integrate the current PR in near future to shutdown properly the project. My part. This is a free software, forkable, copyleft.

tomas-chrastina commented 3 years ago

No problem, I really get it ;).

It's just, it's finally like something Xfce should have by default. So maybe we all are just projecting our expectations here, and putting it on your shoulders.

Sure, maybe someone would continue. We'll see.

Nevertheless, thank you very much for great plugin and all of your effort.