Remotely Lock & Unlock your Linux Desktop Using KDE Connect

Amazing thing is controlling your PC remotely, KDEConnect is making that possible. If you are wondering what is KDE Connect, you should take a look here.

Firstly, I must talk about the poor UX. I didn’t know the command feature has been on my devices for long, I thought it is still coming as an upgrade. Was so fortunate to have a friend tell me its been there and I have to add commands. I checked it out and voila! Found it! 🙂

When the feature of remote commands was announced to be in the next update, I already had in mind to do some cool things with it. One of it is to lock and unlock my PC 🙂 I sometimes find it uncomfortable when someone just walks in and see my laptop somewhere and decide to touch, I feel like spanking them on the head. But it’s not fair to tell someone to leave your system alone, so this is a very great help to me, to just lock my laptop on a touch and unlock it when I want without touching my keyboards 😉

So there are steps to do this, I will add the allowed commands for my mobile device and it becomes available to be run.

Adding Commands

Goto KDE Connect in System Settings and click on the paired device you wish to run command from. Scroll down to run commands and touch the options button, as highlighted below:

This will popup a dialog where we will put in allowed commands and name them. We are going to add 2 commands, the Lock and Unlock commands which are:

Login:

loginctl lock-session

Unlock

loginctl unlock-session

As below:

And Save.

Locking & Unlocking

After adding the commands, these commands are made available on the mobile app. Goto your mobile app and tap on any of the commands and see the magic! 😀