KDE5.20 — Lock and Unlock the desktop — The moderator has asked me to repost this here. It will still be a valid idea after MX21KDE has gone final:
I know that MX21KDE hasn't gone final yet, but here's an idea you might want to try if you are testing it, and it will still work after it's gone final:
One of the better things about the version of KDE being used in MX21 Beta, is the absence of the hamburger or its b*st*rd offspring, the ham sandwich. More than anything, I really didn't like that, in the older version shipped with MX19, there were multiple menus all over the place with the option to lock/unlock the plasmoid layout. But with the new version, there is no way at all! What this post describes is a way to put a single Lock/Unlock applet on a panel.
Anyway, I did a search on Google and some clever person at Reddit had the solution to a lock which I then adapted using the "Configurable Button" plasmoid which you can get from the KDE store. Maybe you can get it from "Discover" but I've already deleted that.
You add a "Configurable Button" to your desktop or panel. This enables you to add two alternating scripts, an On-script and Off script, each with their own icon. The Off script should be your start-up mode, so if you want to start the desktop with the desktop locked, your Off-Script will be:
Code: Select all
qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(true)"
To unlock the desktop, the On-Script is:
Code: Select all
qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(false)"
For the icons, I've looked in "all" and searched on lock, and found an open padlock icon for the on-script, and a closed one for the off-script. Don't add a Plasmoid Label (leave it blank) because that will appear as text on the panel next to the Icon which will take up space. It would have been nice if the Configurable Button's author made that a Pop-Up text instead.
To allow for the desktop to start Locked you need to create two scripts, I put them in /usr/local/bin/ and saved them as root. Once saved, right-click on their icons in a Root Dolphin in order to set the properties to allow them to be executed.
First is lock-desktop
Code: Select all
#!/bin/bash
sleep 10
qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(true)"
Second is lock-desktop-startup
Having two executable files might appear complicated, but doing it this way allows the locking to be delayed by the number of seconds after "sleep", while control is handed back to the system to get on with other stuff. Otherwise the KDE start-up sequence will unlock the desktop again. You have to add the lock-desktop-startup in the KDE System Settings under Startup and Shutdown > Autostart > Login Scripts
Now when you log in, your Panels will be locked, and you have to click on the padlock icon to unlock them.
P.S. Don't try this with MX19. I did, and some icons on my panels became permanently locked! And you're still stuck with the Lock/Unlock options on the panel in any case.