Bash Script to Toggle the Ubuntu Launcher

I’m trying to go very “Ubunty” with Trusty Tahr. Global menu (rather than with application window), window controls at top left (instead of at right), using Dash, and for the first time displaying the Ubuntu Launcher, shown at left of my Ubuntu Trusty Tahr desktop.

I’m liking the Launcher, and because I’m All-In Ubuntu with Tahr (when I’m not using Mint Qiana) I’m not going to set it on autohide. I haven’t gone crazy though. I need the ability to quickly make the Launcher disappear when I want it to, like when I’m fullscreen in Eclipse or something. Thanks to Ubuntists who have gone before and generously shared their solutions for toggling the Launcher I now have the ability to toggle it with a single keystroke.

There are several script options for this. I went with a Bash solution as opposed to Perl or something else. Here’s the script.


AUTOHIDE=$(dconf read /org/compiz/profiles/unity/plugins/unityshell/launcher-hide-mode)
if [[ $AUTOHIDE -eq 1 ]]
   dconf write /org/compiz/profiles/unity/plugins/unityshell/launcher-hide-mode 0
   dconf write /org/compiz/profiles/unity/plugins/unityshell/launcher-hide-mode 1

Toggle by Keystroke

We need to assign a keyboard shortcut to our script so that our Launcher will disappear and appear instantly. We’ll do that in System Settings -> Keyboard -> Custom Shortcuts.

With our Launcher Toggle key, we can be as Ubuntu as we wanna be.