Add a button to toggle auto-hide with XFCE on Ubuntu 12.04

I took the plunge today and installed Xfce on my Ubuntu Laptop after my last fight with unity on gnome after discovering the magic of panels and the fact you can have them auto hide I am glad I switched but one thing is missing a button the toggle the auto-hide so I cant turn it off easily with out going through many layers of menus, so I decided to add one. 5 minutes of googling later I found my answer here with these two commands:

xfconf-query -c xfce4-panel -p /panels/panel-[panel number]/autohide -s false
xfconf-query -c xfce4-panel -p /panels/panel-[panel number]/autohide -s true

where [panel number] is replaced with number of the panel you wish to control. Panel numbers here start at 0 where as the panel numbers the GUIs and menus use start at 1 so thats something to take note of.

further down in the thread I linked to earlier someone had posed to code to toggle the auto hide which I modified to work on both the default panels proved with Xfce

#!/bin/sh

PANEL1=$(xfconf-query -c xfce4-panel -p /panels/panel-0/autohide)
PANEL2=$(xfconf-query -c xfce4-panel -p /panels/panel-1/autohide)

if test $PANEL1 = false -o $PANEL2 = false; then
xfconf-query -c xfce4-panel -p /panels/panel-0/autohide -s true
xfconf-query -c xfce4-panel -p /panels/panel-1/autohide -s true
else
xfconf-query -c xfce4-panel -p /panels/panel-0/autohide -s false
xfconf-query -c xfce4-panel -p /panels/panel-1/autohide -s false
fi

I saved it, ran chmod +x on it to make it executable then tested it one I was happy it worked I copied it to /usr/bin (not good practice but i’m lazy) once all done I right clicked on the panel at the bottom of my screen from the context menu I chose Panel > Add New Items and launcher. right clicked on the new icon chose properties then the blank page with the green plus icon on the right of the window, set a name for the launcher and typed in the path and name though in my case as I had copied it to /usr/bin it just needed the file name finally I set an icon and clicked create and there it was good to go a couple of clicks to test it low and behold it works.

3 thoughts on “Add a button to toggle auto-hide with XFCE on Ubuntu 12.04”

  1. I was excited to find this. Unfortunately, it doesn’t work for me. I get:

    > bash: test: too many arguments
    > Property “/panels/panel-0/autohide” does not exist on channel “xfce4-panel”. If a new property should be created, use the –create option.

    Also, is this for XFCE? Your text says XFCE, but your header says LXDE.

    Thanks — Ander

    1. Hi sorry its a typo it is for xfce

      edit — Have you tried using the xfconf-query commands mentioned earlier in the post like this “xfconf-query -c xfce4-panel -p /panels/panel-0/autohide” it should return true or false

Comments are closed.