Is there a DBus command to toggle auto-hide on a KDE Plasma panel?
You can do it easily through plasma desktop scripts, like this:
auto-hide on:
var panel = panelById(panelIds[0])
panel.hiding = 'autohide';
auto-hide off:
var panel = panelById(panelIds[0])
panel.hiding = 'none';
The bad news is there is no way to programatically run the script when you want it except perhaps for some kind of keyboard+mouse automation.
The closest you can get (per this discussion on KDE forum) is open the script in desktop console via
qdbus org.kde.plasma-desktop /MainApplication \
loadScriptInInteractiveConsole /path/to/js/file
There is bug #238817 in KDE Bugzilla filed on this.
As of July 2018, the answer suggested by @che doesn't work.
Here is something that does work though:
qdbus org.kde.plasmashell /PlasmaShell evaluateScript "p = panelById(panelIds[0]); p.height = 32 - p.height;"
32 is the height I like. Set that to a different number as you like.
Relevant KDE Bug: https://bugs.kde.org/show_bug.cgi?id=396796