Skip to content

Instantly share code, notes, and snippets.

@jmz-b
Created June 29, 2019 19:50
Show Gist options
  • Save jmz-b/c984170b09f2be823a8a9e2d9178c3c9 to your computer and use it in GitHub Desktop.
Save jmz-b/c984170b09f2be823a8a9e2d9178c3c9 to your computer and use it in GitHub Desktop.
qdbus commands to toggle hide/show KDE plasma panel
!#/bin/sh
qdbus org.kde.plasmashell /PlasmaShell evaluateScript "p = panelById(panelIds[0]); p.height = 32 - p.height;"
@rojnwa
Copy link

rojnwa commented Mar 20, 2023

Doesn't work anymore after latest Plasma update (>=5.27)

@Tokukarin
Copy link

I am on 5.27.3 and it works, but not as expected, the window is still there a tiny amount.

@LanRenLan
Copy link

it works on my 5.27-3 too, though this command cannot hide the taskbar, only zoom it instead, but is useful for yakuake
you can use this command to resume the taskbar, just replace 42 with your original taskbar pixel, if you don't know how to get it to work, try a few combos by adjusting 40 and 42, I got this from ChatGPT and it works for me.
qdbus org.kde.plasmashell /PlasmaShell evaluateScript "p = panelById(panelIds[0]); p.height = p.formFactor === 2 ? 40 : 42;"

@Tokukarin
Copy link

@LanRenLan I debugged it a bit and found the following:
The reason why this script is not completely working anymore is because the minimum size you can give the taskbar is 20, so If you use the script above twice, you will end up with a different height.

I also went through the API/Documentation and I wrote a script for myself which almost hides it completely:

qdbus org.kde.plasmashell /PlasmaShell evaluateScript "p = panelById(panelIds[0]); p.maximumLength = 1500 - p.maximumLength;"
qdbus org.kde.plasmashell /PlasmaShell evaluateScript "p = panelById(panelIds[0]); p.height = '64' - p.height;"

Even though I invested a lot of time going through the documentation, writing and testing it.
I am actually not using it as I wrote another script that removes the panel and reloads plasma.
And when called again it will add the panel back and reload plasma again.

@LanRenLan
Copy link

@Tokukarin oh, I got what you are saying, the first script you wrote is making icons on the taskbar invisible, but the problem is the height didn't change is it leaves a blank. Now I'm………………god knows what happened during the 20 minutes when I'm writing this response, I probably just deleted the entire taskbar while I'm trying to resume the settings... I can see all icons of apps on my desktop extensions, but I cannot use them as a taskbar.......why is KDE letting users delete the taskbar with one click but cannot add one.......I probably have to delete all my plasma config files and restart

@Tokukarin
Copy link

@LanRenLan Just for clarification, my commands above do not delete anything. They just resize the taskbar.

@LanRenLan
Copy link

ok, I realized the taskbar is nothing but a combination of extensions before I actually start to delete files, but the entire desktop just crashed......I believe those are all solvable issues

@LanRenLan
Copy link

@Tokukarin You're right, I deleted the taskbar while spinning it around

@Tokukarin
Copy link

The commands above are just an addition to the original post.
The script I personally use actually deletes the taskbar but the commands above are not out of the deletion and restore script I made

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment