?? 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
I use keyboard shortcuts to interact with my window manager. One of those shortcuts closes the currently focused window. This is on Linux. The only annoying thing for me is that 'plot()' is not interruptible, so neither Ctrl-C nor the window manager can stop a plot once it has started - but I submitted a bug to fix this a long time ago. If I use the keyboard to close the window while a plot is being drawn, then it has to finish drawing before the window actually closes. Frederick 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 at r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-devel >
>From my rusty memory of X11 hacking, this should be elementary atthe 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 at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel
> The only annoying thing for me is that 'plot()' is not interruptible, so neither Ctrl-C nor the window manager can stop a plot once it has started - but I submitted a bug to fix this a long time ago. If I use the keyboard to close the window while a plot is being drawn, then it has to finish drawing before the window actually closes.When R first shifted to Cairo, there was a noticeable performance loss, which could be fixed by changing to the nondefault (but traditional) "X11" graphics device. But that was about ten years ago. And at present, I'm not using Linux on a regular basis, and haven't been following changes to the graphics devices. Perhaps someone who is more familiar with graphics devices under Linux, could comment on options to increase performance...? P.S. Cairo does produce high-quality graphics, better than any PDF viewer I've seen.