How to hide KDE panel with i3wm

I’m using KDE 5.27.10 with i3wm. I also use KDE panel instead of i3’s. How can I utilise the auto-hide feature of kde panel? Or at least hide the panel on keyboard shortcut?

I’ve been trying to move the panel to a scratchpad, but that didn’t work. Of course, changing kde panel visibility setting to auto-hide does not make any difference. my i3 config.

Do you have an item on the panel that has “unhide when a window wants attention” ticked? Post a screenshot of your KDE panel.

This might not have anything to do with i3 at all.

I don’t have any item that has a “unhide when a window wants attention” checkbox.
My panel items are:

  • i3Pager
  • 2x Panel Spacer
  • Window Title
  • Resources Monitor (Fork)
  • System Tray
  • Digital Clock
  • Lock/Logout

I’m not sure about everything else because I don’t use Plasma, but I think this one is doable via plasma desktop scripting and qdbus.

Take a look at the documentation if you want to dive deep into it.

The program to hide the panel is probably as simple as calling a function and passing it a panel id or something. Once you have written the program, you have to launch it via qdbus. The command to launch qdbus can then be bound to a keyboard shortcut that you can trigger everytime you want to hide the panel.

After some digging I came across this command:

qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript "panels()[0].height = -1"

It would change panel size to -1, which is basically hiding it. However, this has stopped working since Plasma 5.27. I don’t think KDE API involves other functionality for hiding panel.