Skip to content

Unify WM_CLASS across backends #8394

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

Merged
merged 1 commit into from
Apr 14, 2017
Merged

Unify WM_CLASS across backends #8394

merged 1 commit into from
Apr 14, 2017

Conversation

languitar
Copy link
Contributor

Qt uses the first argument of sys.argv to set the WM_CLASS attribute. So
far, a space character was used. Replace it with "matplotlib-qt5" to be
more recognizable. This enables interpretable rules for certain window
managers which use WM_CLASS.

This is related to #4746 and #6743.

@anntzer
Copy link
Contributor

anntzer commented Mar 28, 2017

Currently Qt4 uses " ", " "; Tk sets "tk", "Tk", GTK3 uses sys.argv[1]. I think using either matplotlib everywhere, or matplotlib-$backend, is fine. Can you look into whether this can easily be done with the other backends?

@languitar
Copy link
Contributor Author

I had a short look at qt4 but didn't see the location where this is set. Can you give me a hint on the relevant source parts for the other backends?

@anntzer
Copy link
Contributor

anntzer commented Mar 28, 2017

Well, I don't know either :-)

@languitar
Copy link
Contributor Author

I think I have found all relevant locations and updated the PR accordingly.

@languitar languitar changed the title Set a reasonable WM_CLASS in Qt5 backend Unify WM_CLASS across backends Mar 29, 2017
@tacaswell tacaswell added this to the 2.1 (next point release) milestone Mar 29, 2017
@anntzer
Copy link
Contributor

anntzer commented Mar 29, 2017

Right now (with this PR) some backends use "matplotlib", "Matplotlib" and others use "matplotlib", "matplotlib". Can you check how easy to keep this uniform across backends? (either way is fine)

There's also the wxagg backend but a quick googling suggests it can't set WM_CLASS (not sure though).

@languitar
Copy link
Contributor Author

I tried, but I think not all GUI toolkits give access to control this completely.

@anntzer
Copy link
Contributor

anntzer commented Mar 30, 2017

No worries.

@anntzer anntzer changed the title Unify WM_CLASS across backends [MRG+1] Unify WM_CLASS across backends Mar 30, 2017
@tacaswell
Copy link
Member

There is also the native osx backend, but unless you have a mac that one is hard to work on.

@languitar
Copy link
Contributor Author

Is there anything like WM_CLASS for cocoa applications?

@tacaswell
Copy link
Member

Not sure. There is also the 'gtk' backend (which is different than the gtk3 backend).

@languitar
Copy link
Contributor Author

I have updated the commit to include the old and broken gtk backend. For wx I couldn't find any public API that allows setting the WM_CLASS.

@jenshnielsen
Copy link
Member

@languitar As far as I know the GTK(2) backend should be working and not broken, but quite difficult to install (that is the GTKAgg and GTKCairo variants, the GDK variant is deprecated and possibly broken)

@languitar
Copy link
Contributor Author

The backend that I touched (backend_gtk.py) issued a deprecation message when I executed it. That's what I was referring to.

@tacaswell
Copy link
Member

👍

One last picking thing, we have settled on the convention of capitalizing Matplotlib in text, should we use that here too? I am leaning towards yes, but could be easily talked into either direction.

@jenshnielsen
Copy link
Member

Ok thats fine. There are actually 2 subclasses of that backend that are not deprecated. The GTK backend uses GDK to do the actual drawing (which is different from all other backends) but the GTKAgg and GTKCairo backends which uses Agg and Cairo and are subclassed of the GTK backend are not since they use more standard matplotlib renders

@anntzer
Copy link
Contributor

anntzer commented Apr 3, 2017

wx probably doesn't expose such an API (http://wxpython-users.1045709.n5.nabble.com/Setting-WM-CLASS-td3270267.html).

@anntzer
Copy link
Contributor

anntzer commented Apr 12, 2017

@tacaswell It should probably be "matplotlib", "Matplotlib" if you care about case: https://tronche.com/gui/x/icccm/sec-4.html
That means Matplotlib for Qt and Tk.

Consistently use "matplotlib" as the WM_CLASS attribute for Tk, Qt* and
GTK backends.

This is related to #4746 and #6743.
@languitar
Copy link
Contributor Author

Updated accordingly, at least for the backends where this is possible.

@anntzer
Copy link
Contributor

anntzer commented Apr 13, 2017

@tacaswell this looks ready to go

@tacaswell tacaswell merged commit b2ee7a3 into matplotlib:master Apr 14, 2017
@QuLogic QuLogic changed the title [MRG+1] Unify WM_CLASS across backends Unify WM_CLASS across backends Apr 14, 2017
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.

4 participants