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 toggleLauncher.sh script.

#!/bin/bash

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

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.

Posted June 24, 2014 02:38 PM EDT

More Like This Post