I would like to create a keyboard shortcut to toggle the auto-hide option for the unit launcher. Based on the answer on How to programmatically change the launcher's hide behaviour I tried to make a python script to do the job. Then I should just figure out how to run that with a keyboard shortcut.
My script looks like this:
#!/bin/python
AUTOHIDE=$(dconf read /org/compiz/profiles/unity/plugins/unityshell/launcher-hide-mode)
if (AUTOHIDE==1):
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
But running the script from a terminal (doing 'python scriptname.py' ) doesn't work. I get a "invalid syntax" error at $ sign.
You have to know that I have almost no knowledge of python (or writing scripts in general). (I've just spent a few hours searching the web for help and examples).
So the actual questions:
- What did I do wrong?
- Did I chose a way to complicated approach for this and how can I do it more easily in that case?