[R] Basic question about X11()

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Wed Aug 27 23:15:09 CEST 2008


2008/8/27 Patrick Connolly <p_connolly at slingshot.co.nz>:

> Your question is one relating to your window manager.  The display
> parameter for x11() does not relate to desktops.  All the desktops are
> part of the same display.  Some very clever R-devel people might be
> able to think of a way of making a specific X call to achieve what you
> want, but it seems unlikely to me that it could be make to work with
> more than one window manager.
>
> It's very simple in KDE to set up keyboard shortcuts to move a window
> to a specific desktop.

 There's some X11 command utilities to muck with window placements:

 devilspie: this runs in the background and watches for windows being
created. If any match the rules given in a file then a function is
applied, so for example any window with 'R' in the title can be moved
to Workspace 2. You can set the title on an X11 window with
X11(title="WS2"). (The config files (.ds files) are written in a
lisp-like language but there's plenty of help on the web)

 wmctrl: this is a shell command that moves (and otherwise plays with)
existing windows. For example if you do:

wmctrl -r "R Graphics" -t 2

 it will move the window with title "R Graphics" to workspace 2. You
could run this in R after doing X11() with the R function call
system("wmctrl ...etc...")

Both these methods will cause the window to briefly flash in the
current workspace before moving. Some window managers have the
facility to place specific windows in specific workspaces by putting
them in config files if you don't want the window to flash up in front
of the user.

Good luck with that then...

Barry



More information about the R-help mailing list