X11 Window information for plots

On X11 systems, windows generally provide information about themselves
to the system. These include things like the window title, window
class, window role, and window type. These allow window managers to
properly handle the windows, and in some window managers (like KDE's
kwin), lets you set rules for windows of certain types.

As best as I can tell, by default matplotlib does not provide most of
this information. It provides the window title and the window type,
but it doesn't seem to provide the window class or the window role.
These two properties, however, are exactly the properties someone
would want to use when trying to set up rules for particular windows.
This makes it impossible to set window-specific rules for the plots.

Is there something in the matplotlib configuration that would let
someone set these properties, and if not is there any way matplotlib
could set them itself?

I'm sorry if this is a common question.

-Todd

You're right -- matplotlib doesn't set any of these attributes. Fixing this problem would involve adding a few lines of code to set them in each GUI backend (since each GUI toolkit, gtk, qt, tk etc. presumably handles them differently). Is this something you'd be interested in providing a patch for?

Mike

···

On 01/15/2011 03:06 PM, todd rme wrote:

On X11 systems, windows generally provide information about themselves
to the system. These include things like the window title, window
class, window role, and window type. These allow window managers to
properly handle the windows, and in some window managers (like KDE's
kwin), lets you set rules for windows of certain types.

As best as I can tell, by default matplotlib does not provide most of
this information. It provides the window title and the window type,
but it doesn't seem to provide the window class or the window role.
These two properties, however, are exactly the properties someone
would want to use when trying to set up rules for particular windows.
This makes it impossible to set window-specific rules for the plots.

Is there something in the matplotlib configuration that would let
someone set these properties, and if not is there any way matplotlib
could set them itself?

I'm sorry if this is a common question.

-Todd

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Maybe, I am not that familiar with X11 programming. Do you happen to
know which source files I should change?

-Todd

···

On Tue, Jan 18, 2011 at 8:39 AM, Michael Droettboom <mdroe@...86...> wrote:

You're right -- matplotlib doesn't set any of these attributes. Fixing
this problem would involve adding a few lines of code to set them in
each GUI backend (since each GUI toolkit, gtk, qt, tk etc. presumably
handles them differently). Is this something you'd be interested in
providing a patch for?

Mike

On 01/15/2011 03:06 PM, todd rme wrote:

On X11 systems, windows generally provide information about themselves
to the system. These include things like the window title, window
class, window role, and window type. These allow window managers to
properly handle the windows, and in some window managers (like KDE's
kwin), lets you set rules for windows of certain types.

As best as I can tell, by default matplotlib does not provide most of
this information. It provides the window title and the window type,
but it doesn't seem to provide the window class or the window role.
These two properties, however, are exactly the properties someone
would want to use when trying to set up rules for particular windows.
This makes it impossible to set window-specific rules for the plots.

Is there something in the matplotlib configuration that would let
someone set these properties, and if not is there any way matplotlib
could set them itself?

I'm sorry if this is a common question.

-Todd

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I think I've found it. But now I need to know what the values should
be. I assume the application name should be "matplotlib" (no quotes,
with no capitalization). What about the window role? I am think
either "figure" or "plot" would be good, probably the former (once
again without quotes and with no capitalization). Is that reasonable?
It is easy to change later, although the change should be consistent
across all backends.

The other issue is whether I should use the same window role for all
backends, or separate roles for each backend (such as "qt4 figure").
Does anyone have an opinion on this?

-Todd

···

On Tue, Jan 18, 2011 at 12:54 PM, todd rme <toddrme2178@...287...> wrote:

Maybe, I am not that familiar with X11 programming. Do you happen to
know which source files I should change?

-Todd

On Tue, Jan 18, 2011 at 8:39 AM, Michael Droettboom <mdroe@...86...> wrote:

You're right -- matplotlib doesn't set any of these attributes. Fixing
this problem would involve adding a few lines of code to set them in
each GUI backend (since each GUI toolkit, gtk, qt, tk etc. presumably
handles them differently). Is this something you'd be interested in
providing a patch for?

Mike

On 01/15/2011 03:06 PM, todd rme wrote:

On X11 systems, windows generally provide information about themselves
to the system. These include things like the window title, window
class, window role, and window type. These allow window managers to
properly handle the windows, and in some window managers (like KDE's
kwin), lets you set rules for windows of certain types.

As best as I can tell, by default matplotlib does not provide most of
this information. It provides the window title and the window type,
but it doesn't seem to provide the window class or the window role.
These two properties, however, are exactly the properties someone
would want to use when trying to set up rules for particular windows.
This makes it impossible to set window-specific rules for the plots.

Is there something in the matplotlib configuration that would let
someone set these properties, and if not is there any way matplotlib
could set them itself?

I'm sorry if this is a common question.

-Todd

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

I think I've found it. But now I need to know what the values should
be. I assume the application name should be "matplotlib" (no quotes,
with no capitalization). What about the window role? I am think
either "figure" or "plot" would be good, probably the former (once
again without quotes and with no capitalization). Is that reasonable?
It is easy to change later, although the change should be consistent
across all backends.

The other issue is whether I should use the same window role for all
backends, or separate roles for each backend (such as "qt4 figure").
Does anyone have an opinion on this?

-Todd

My guess is that they should all have the same name. Any given run of
matplotlib can only use one backend at a time. I don't see a value in
distinguishing the source of the figures.

Ben Root

···

On Tuesday, January 18, 2011, todd rme <toddrme2178@...287...> wrote:

On Tue, Jan 18, 2011 at 12:54 PM, todd rme <toddrme2178@...287...> wrote:

Maybe, I am not that familiar with X11 programming. Do you happen to
know which source files I should change?

-Todd

On Tue, Jan 18, 2011 at 8:39 AM, Michael Droettboom <mdroe@...86...> wrote:

You're right -- matplotlib doesn't set any of these attributes. Fixing
this problem would involve adding a few lines of code to set them in
each GUI backend (since each GUI toolkit, gtk, qt, tk etc. presumably
handles them differently). Is this something you'd be interested in
providing a patch for?

Mike

On 01/15/2011 03:06 PM, todd rme wrote:

On X11 systems, windows generally provide information about themselves
to the system. These include things like the window title, window
class, window role, and window type. These allow window managers to
properly handle the windows, and in some window managers (like KDE's
kwin), lets you set rules for windows of certain types.

As best as I can tell, by default matplotlib does not provide most of
this information. It provides the window title and the window type,
but it doesn't seem to provide the window class or the window role.
These two properties, however, are exactly the properties someone
would want to use when trying to set up rules for particular windows.
This makes it impossible to set window-specific rules for the plots.

Is there something in the matplotlib configuration that would let
someone set these properties, and if not is there any way matplotlib
could set them itself?

I'm sorry if this is a common question.

-Todd

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Matplotlib-users mailing list

That is what I thought as well.

There are three properties to deal with. First the window class.
This contains two strings. One is simply the application name. The
other, however, is a class. I can't find a good explanation of what
this is supposed to be. For Firefox, this is "Navigator" for the
browser and "Places" for the bookmarks manager. For libreoffice
writer, it is VCLSalFrame.DocumentWindow.

The third is the window role. For the firefox browser, this is
"browser". For the bookmark manager, it is "organizer".

So as best as I can tell, the role is a general description of the
sort of application it is, such as a web browser. For matplotlib, I
think this should probably be "plot" or "graph" or something along
those lines.

The class, on the other hand, seems to be an application-specific
description of what the role is within the application. I think this
should probably be "figure".

Does that sound reasonable?

-Todd

···

On Tue, Jan 18, 2011 at 8:58 PM, Benjamin Root <ben.root@...1304...> wrote:

On Tuesday, January 18, 2011, todd rme <toddrme2178@...287...> wrote:

I think I've found it. But now I need to know what the values should
be. I assume the application name should be "matplotlib" (no quotes,
with no capitalization). What about the window role? I am think
either "figure" or "plot" would be good, probably the former (once
again without quotes and with no capitalization). Is that reasonable?
It is easy to change later, although the change should be consistent
across all backends.

The other issue is whether I should use the same window role for all
backends, or separate roles for each backend (such as "qt4 figure").
Does anyone have an opinion on this?

-Todd

My guess is that they should all have the same name. Any given run of
matplotlib can only use one backend at a time. I don't see a value in
distinguishing the source of the figures.

Ben Root

Hi!

> The class, on the other hand, seems to be an application-specific
> description of what the role is within the application. I think this
> should probably be "figure".

Just an idea: What about exposing this (or maybe all) of the values in the api to be set dynamically by the user? Of course providing a useful default value as well.

The thought behind is that it's hard to guess in what context the user wants to use the figure. And perhaps the user has 21 plots of some type and one which is different and he wants to treat differently.
But at the same time - you also could do this if you adjust the window title.

Jochen

···

todd rme wrote on 19.01.2011 04:40:

I'm not sure what the complete motivation behind all of this is, but
if you just want to set the window title, that's already available:

fig = plt.figure()
fig.canvas.set_window_title("Look at me!")

Ryan

···

On Wed, Jan 19, 2011 at 4:48 AM, Jochen Deibele <jochen.deibele@...2639...> wrote:

todd rme wrote on 19.01.2011 04:40:
> The class, on the other hand, seems to be an application-specific
> description of what the role is within the application. I think this
> should probably be "figure".

Just an idea: What about exposing this (or maybe all) of the values in
the api to be set dynamically by the user? Of course providing a useful
default value as well.

The thought behind is that it's hard to guess in what context the user
wants to use the figure. And perhaps the user has 21 plots of some type
and one which is different and he wants to treat differently.
But at the same time - you also could do this if you adjust the window
title.

--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

Thanks, but that's not the intention.

Some windowmanager on X11 systems provide the possibility to manage windows due to some criteria. You can f.ex. force all windows of your browser to open minimized or always on top etc. As far as I understood the discussion it is about what information should be provided to make this kind of window-handling possible.

Jochen

···

Ryan May wrote on 19.01.2011 16:00: > On Wed, Jan 19, 2011 at 4:48 AM, Jochen Deibele<jochen.deibele@...2639...> wrote:

todd rme wrote on 19.01.2011 04:40:
  > The class, on the other hand, seems to be an application-specific
  > description of what the role is within the application. I think this
  > should probably be "figure".

Just an idea: What about exposing this (or maybe all) of the values in
the api to be set dynamically by the user? Of course providing a useful
default value as well.

The thought behind is that it's hard to guess in what context the user
wants to use the figure. And perhaps the user has 21 plots of some type
and one which is different and he wants to treat differently.
But at the same time - you also could do this if you adjust the window
title.

I'm not sure what the complete motivation behind all of this is, but
if you just want to set the window title, that's already available:

fig = plt.figure()
fig.canvas.set_window_title("Look at me!")

I agree. If we are going to do this, we might as well do it right. Anybody who isn’t using this feature will not see a difference, but those who do manage their windows with rules can benefit significantly from just having sensible default values and from having the ability to explicitly set the value. Therefore, this should probably be something that is added to the rcParams and the user can specify a value by keyword argument to the Figure init method.

Ben Root

···

On Wed, Jan 19, 2011 at 4:48 AM, Jochen Deibele <jochen.deibele@…2639…> wrote:

Hi!

todd rme wrote on 19.01.2011 04:40:

The class, on the other hand, seems to be an application-specific

description of what the role is within the application. I think this

should probably be “figure”.

Just an idea: What about exposing this (or maybe all) of the values in

the api to be set dynamically by the user? Of course providing a useful

default value as well.

The thought behind is that it’s hard to guess in what context the user

wants to use the figure. And perhaps the user has 21 plots of some type

and one which is different and he wants to treat differently.

But at the same time - you also could do this if you adjust the window

title.

Jochen

That is far outside the scope of my capabilities. I already have wx
and gtk backends set up (although it needs to be tested) with
hard-coded values, and qt4 half-working (and tested, this doesn't
appear to be possible in qt). I can submit patches for that, and if
someone else wants to make it configurable they can do so. I'll set
it up to use variables that you can then do what you want with.

-Todd

···

On Wed, Jan 19, 2011 at 10:22 AM, Benjamin Root <ben.root@...1304...> wrote:

On Wed, Jan 19, 2011 at 4:48 AM, Jochen Deibele <jochen.deibele@...3411....> > wrote:

Hi!

todd rme wrote on 19.01.2011 04:40:
> The class, on the other hand, seems to be an application-specific
> description of what the role is within the application. I think this
> should probably be "figure".

Just an idea: What about exposing this (or maybe all) of the values in
the api to be set dynamically by the user? Of course providing a useful
default value as well.

The thought behind is that it's hard to guess in what context the user
wants to use the figure. And perhaps the user has 21 plots of some type
and one which is different and he wants to treat differently.
But at the same time - you also could do this if you adjust the window
title.

Jochen

I agree. If we are going to do this, we might as well do it right. Anybody
who isn't using this feature will not see a difference, but those who do
manage their windows with rules can benefit significantly from just having
sensible default values and from having the ability to explicitly set the
value. Therefore, this should probably be something that is added to the
rcParams and the user can specify a value by keyword argument to the Figure
__init__ method.

Ben Root

That would be a good start. I have no objections to starting off with that.

Ben Root

···

On Wed, Jan 19, 2011 at 10:20 AM, todd rme <toddrme2178@…287…> wrote:

On Wed, Jan 19, 2011 at 10:22 AM, Benjamin Root <ben.root@…1304…> wrote:

On Wed, Jan 19, 2011 at 4:48 AM, Jochen Deibele <jochen.deibele@…2639…> > > > wrote:

Hi!

todd rme wrote on 19.01.2011 04:40:

The class, on the other hand, seems to be an application-specific

description of what the role is within the application. I think this

should probably be “figure”.

Just an idea: What about exposing this (or maybe all) of the values in

the api to be set dynamically by the user? Of course providing a useful

default value as well.

The thought behind is that it’s hard to guess in what context the user

wants to use the figure. And perhaps the user has 21 plots of some type

and one which is different and he wants to treat differently.

But at the same time - you also could do this if you adjust the window

title.

Jochen

I agree. If we are going to do this, we might as well do it right. Anybody

who isn’t using this feature will not see a difference, but those who do

manage their windows with rules can benefit significantly from just having

sensible default values and from having the ability to explicitly set the

value. Therefore, this should probably be something that is added to the

rcParams and the user can specify a value by keyword argument to the Figure

init method.

Ben Root

That is far outside the scope of my capabilities. I already have wx

and gtk backends set up (although it needs to be tested) with

hard-coded values, and qt4 half-working (and tested, this doesn’t

appear to be possible in qt). I can submit patches for that, and if

someone else wants to make it configurable they can do so. I’ll set

it up to use variables that you can then do what you want with.

-Todd