Ubuntu – Hide the gnome-panel on one of the workspaces

gnome-panelworkspaces

I'm currently using 2 workspaces on Ubuntu 10.10, and compiz.

Is it possible to completely remove the gnome panel from one of the workspaces? I'd like to have a clean desktop to work with on the second workspace, and a regular desktop with panels on the first workspace. Is that at all possible?

Best Answer

(UPDATE)... I just fixed a "bug" where the script (below) would only look for "panel_6"
... Also, the script will only be of use for a single-monitor system...
... However, looking into it a bit further, it may be possible with Dual/Multi-monitors.
... Here is a link to something about Panels on a second monitor...
... moving panels (between screens)
... Im not sure if it's what you're after, but is seems more appropriate for multi-monitors.

Assuming that there is no "built-in" way to do it, as seems to be the case, I've cobbled up a script to "sort-of" do it... It simply sets the panels of your choice to auto-hide... and you can choose which workspace(s) via the args.

You can bind the script to the same keys that Compiz currently uses to switch works-spaces...

If you use any other method to get to the next workspace, it won't work, but you can also use the script to toggle the panel(s) on/off... (ooops! I haven't got the time today to finish that bit... :(

I haven't fine-tuned it yet, but it works (up to a point). It may or may not suit you.
(You will need wmctrl Install wmctrl)

Here is the script as it currently stands:


#!/bin/bash  

# Arg1: A capital letter; L or R .. to indicate the Left or Right direction for next work-space
#
# Arg[*]: Each arg, after the first, is the number (1-based) of a work-space for which you wish to hide the panel(s)
#         If no args are supplied, the current state will be toggled; show/hide ... hide/show
#
# Choose your panel identifiers by opening gconf-editor with this command:
# 
#    gconf-editor /apps/panel/toplevels/
#
# You can test each of the listed panels by clicking in the "Value" checkbox 
#  of the "auto-hide" item... 
#
# Then add the Panel-IDs which you want to be hidden,
#  as shown here  

panels="panel_6 panel_6" # I only use one panel, so I've just repeated it to make an "example" list  
######

dir=$1;
valids="LR" 
if [ "${valids/${dir}/}" != "$valids" ]
then shift 1
else exit 1
fi

eval $(wmctrl -d |sed -n "s/.*DG: \([0-9]\+\)x[0-9]\+ \+VP: \([0-9]\+\),.* \([0-9]\+\)x[0-9]\+ .*/wmax=\$(((\1\/\3))); wcur=\$(((\2\/\3)+1)); wide=\3; hide=false/p")

if [ "$wcur" -eq "$wmax" ] ; then 
  if [ "$dir" == "R" ] ; then
    wnew=1
  else 
    wnew=$((wcur-1))
  fi
elif [ "$wcur" -eq "1" ] ; then 
  if [ "$dir" == "L" ] ; then
    wnew=$wmax
  else
    wnew=$((wcur+1))
  fi
else
  if [ "$dir" == "R" ] ; then
    wnew=$((wcur+1))
  else
    wnew=$((wcur-1))
  fi
fi

wmctrl -o $(((wnew-1)*wide)),0

for w in $@ ; do
  if [ "$w" -eq "$wnew" ] ; then
    hide=true 
    break
  fi
done

for panel in $panels ; do
  gconftool-2 --set /apps/panel/toplevels/$panel/auto_hide --type bool $hide
done
exit
###############################################################################
Related Question