Keyboard shortcut to toggle auto-hide unity launcher
If you want to do it Pythonic way.
#!/bin/python
import subprocess
AUTOHIDE = subprocess.check_output (["/usr/bin/dconf", "read", "/org/compiz/profiles/unity/plugins/unityshell/launcher-hide-mode"])
if (AUTOHIDE==1):
subprocess.call (["/usr/bin/dconf", "write", "/org/compiz/profiles/unity/plugins/unityshell/launcher-hide-mode", "0"])
else:
subprocess.call (["/usr/bin/dconf", "write", "/org/compiz/profiles/unity/plugins/unityshell/launcher-hide-mode", "1"])
you have to execute the programs by creating a subprocess.
And this is the bash script version
#!/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
The shortcut can be assigned like this.
One way to do it simply is to create a custom shortcut.
Access System Settings > Keyboard > Shortcuts > Custom shortcuts Then click '+' to add a new shortcut, and in the command box paste:
dconf write /org/compiz/profiles/unity/plugins/unityshell/launcher-hide-mode 0
This will create a shortcut for showing the launcher. Now to hide the launcher, you should create another shortcut adding the command:
dconf write /org/compiz/profiles/unity/plugins/unityshell/launcher-hide-mode 1
Of course, now you'll have one command for each function, but I put them side by side and find it very intuitive.
For Unity 2D the dconf lines should be
/com/canonical/unity-2d/launcher/hide-mode
There is also a third mode “Intellihide” whose value is 2.