[Rd] closing R graphics windows?

Jan T. Kim jttk|m @end|ng |rom goog|em@||@com
Tue May 26 20:02:17 CEST 2020

>From my rusty memory of X11 hacking, this should be elementary at
the X11 end of things -- something along the lines of adding key
event handling and responding to the Ctrl-W event.

There may be no need for this for X11, though, as the normal X11
way is to have the window manager manage such stuff. As an example,
I use fvwm and adding the line

    Key (R_x11) W            A        C      Close

to my .fvwm2rc pretty much seems to achieve the behaviour you may
expect, at least "phenotypically", i.e. the R_x11 window disappears
when I press Ctrl-W.

The closing of the window seems to be picked up at the R end, calls
to dev.cur() show the X11 cairo device after plotting something and
the null device after closing the window via the fvwm key binding.

Personally, I have some lingering suspicions about possible ill
effects caused by closing a window and causing such side effects in
the process. My usual practice is to keep the keyboard focus on the
terminal running R, and to call dev.off() if I've messed up my
graphics window too badly.

Best regards, Jan

On Tue, May 26, 2020 at 12:49:24PM -0400, Ben Bolker wrote:
>    Does anyone have any idea how hard it would be/where to start if one
> wanted to hack/patch R to allow X11 graphics windows that had keyboard focus
> to be closed with standard keyboard shortcuts (e.g. Ctrl-W to close on
> Linux)?  Has this been suggested/tried before?
>    cheers
>     Ben Bolker
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

More information about the R-devel mailing list