Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unknown wmclass in linux (missing dock icon) #419

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jrom99
Copy link
Contributor

@jrom99 jrom99 commented Jan 10, 2025

Split from #400

On Linux, Pymol has a dash/dock gear icon and WMCLASS "python3", I've fixed this so now it exports the correct WMCLASS (which for gnome means that it is now able to find the correct icon).

@@ -1223,6 +1223,10 @@ def execapp():
window = PyMOLQtGUI()
window.setWindowTitle("PyMOL")

# fix linux dash icon/missing wmclass
QtCore.QCoreApplication.setApplicationName("PyMOL")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, the application name is already PyMOL. Confirmed with:

assert app.applicationName() == "PyMOL"

@@ -1223,6 +1223,10 @@ def execapp():
window = PyMOLQtGUI()
window.setWindowTitle("PyMOL")

# fix linux dash icon/missing wmclass
QtCore.QCoreApplication.setApplicationName("PyMOL")
QtGui.QGuiApplication.setDesktopFileName("org.pymol.PyMOL")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use app?

app.setDesktopFileName("org.pymol.PyMOL")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been some time since I've read the docs on how to fix it, if I recall correctly it was because of transient pop ups without a parent.

@@ -1223,6 +1223,10 @@ def execapp():
window = PyMOLQtGUI()
window.setWindowTitle("PyMOL")

# fix linux dash icon/missing wmclass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem to be a problem with KDE or IceWM on X11. So I suggest to be more specific that this is a fix for "Gnome Dash".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have access to a system with KDE/Wayland? It seems that this is Wayland specific actually, since you can specify wmclass for xorg in the .desktop file directly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under KDE/Wayland:

  • Without setDesktopFileName(): Generic icon in taskbar ❌
  • With app.setDesktopFileName("org.pymol.PyMOL") and launching from a org.pymol.PyMOL.desktop file with Icon=application-x-clementine: Taskbar shows application-x-clementine icon ✔️
  • With app.setDesktopFileName("org.pymol.PyMOL") and launching from a differently named .desktop file (e.g. PyMOL.desktop): Generic icon in taskbar ❌

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do pop ups also have these icons? Or is it only the main window?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pop ups get the same icon.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great! I've updated the code to use app directly, as well as the comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants