Changing the panel position from a script

Brian J. Tarricone bjt23 at cornell.edu
Mon May 7 08:01:09 CEST 2007


On Sun, 6 May 2007 17:29:39 -0400 Erik Harrison wrote:

> On 5/6/07, Henk Boom <lunarc.lists at gmail.com> wrote:
> > Hi, is there a way to change the position of the panel from the
> > command line? I have a script which handles the screen rotation on
> > my tablet, and I would like the panel to follow the short edge of my
> > screen.
> 
> Well.....
> 
> What you COULD do (though I don't recommend it) is to have your script
> edit ~/.conf/xfce/panel/panels.xml, then kill and restart the panel.
> 
> But that's a hack, a HACK I say.

If you decide to do this, at least try to be safe:

xfce4-panel -s  # foces a save of the panel config
xfce4-panel -x  # quits panel without logging out
# do something here to change the panel config file
setsid xfce4-panel & disown # restart panel

... the idea being to make sure that the config file is always
consistent and you aren't modifying it while the panel is running.  The
extra stuff (setsid, disown) on the last line might not be necessary,
but it depends on how/from where you run the script (it can't hurt).

Note that if this script gets run by something that gets started before
X, it won't know about session management, so if you try to log out via
the panel after a screen rotation, it won't work.  It also won't know
which display the panel is running on.  ("export DISPLAY=:0" at the top
will at least fix that last one assuming a single display.)

	-brian




More information about the Xfce mailing list