Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a way to assign a keyboard shortcut to hide or unhide a specific gnome-panel?

EDIT: Is there was a way to make a button combination have the auto-hide panel slide out, as if I had hovered my mouse on that side of the screen?

share|improve this question
    
Great question! I want to know this too! Nothing i could find in either compiz or keyboard shortcuts –  MestreLion Apr 7 '11 at 23:47
add comment

1 Answer 1

up vote 4 down vote accepted

There is a trick to do that.

Part One - How to hide/show all gnome panels

1) Make this file:

gedit ~/.gpnaelhs

2) Paste this into it:

#!/bin/bash

count=0
while read line
do
   keys[$((++count))]="${line}/auto_hide"
done <<EOF
$( gconftool-2 --all-dirs "/apps/panel/toplevels" )
EOF

case $( gconftool-2 --get "${keys[1]}" ) in
   "0" | "false" | "False" )
      new="true"
      ;;
   * )
      new="false"
      ;;
esac

for key in "${keys[@]}"
do
   gconftool-2 --set "$key" --type bool "$new"
done

#End of File  

3) Save.

4) Make it executable:

sudo chmod +x ~/.gpnaelhs

5) Make a shortcut for it:

gnome-keybinding-properties  

6) Click "Add" and put a name (p. ex. "Gnome Panel Hide - Unhide") and the command

bash -c '~/.gpnaelhs'

enter image description here

7) Click "Ok"

8) Click "Disable" and choose your shortcut (p. ex. Ctrl + P

Part Two - How to hide/show only one gnome panel

1) First please backup your settings

gconftool --dump /apps/panel > ~/.panel.settings.backup.xml

and

mkdir ~/.panel.folders.backup && cp -r ~/.gconf/apps/panel/toplevels/ ~/.panel.folders.backup/

2) Now we have to do 2 things. First: edit the file ~/.gpnaelhs and change "/apps/panel/toplevels" for "/apps/panel/toplevels/panel_0" (change the number as needed).

3) Then: delete the folders named panel_0 or panel_1 or panel_2 ... at /apps/panel/toplevels.

Enjoy!

Reference.

share|improve this answer
    
Thanks a lot! It works, except for one thing; when banishing the panel that is on auto-hide, applications will fill up the entire space of the screen, even if there is a panel on top that isn't set to auto-hide. I was wondering if there was a way to make a button combination have the auto-hide panel slide out, as if I had hovered my mouse on that side of the screen. –  John Apr 8 '11 at 21:40
1  
Now that he's edited his question you can just integrate that comment into your answer. –  Jorge Castro Apr 9 '11 at 4:07
    
Edited the answer to add what you want. I've deleted my comments to make the page more clean ;-) –  desgua Apr 9 '11 at 18:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.