Search Suggest

KDE Connect / GSConnect: How To Lock/Unlock Your Linux Desktop Using An Android Device

KDE Connect and GSConnect support running commands from an Android device to your Linux desktop. This article explains how to lock and unlock your Linux desktop using a single tap on your Android device, via the KDE Connect Android app. You'll also find a workaround for GNOME 3.34 which has its session managed by systemd, and complicates this a bit.

KDE Connect is a tool that enables devices like a desktop running Linux and Android devices to communicate with each other. To use it, you must install the desktop component on your Linux desktop, and the Android app on an Android device. GSConnect is a complete implementation of KDE Connect created for the GNOME Shell desktop.

It's worth noting that the commands we'll use in this article for locking / unlocking your screen are desktop-agnostic, and work with any desktop environment (and any Linux distribution) that uses logind.

What's more, there's no need to enter your password when unlocking the screen. That's because the lock/unlock commands we'll use below don't require super user privileges; also, the unlock command is able to unlock your session without a password because KDE Connect is able to run commands on your Linux desktop even when the screen is locked.

Edit: Take a look at a video showing screen locking/unlocking using the KDE Connect Android app and GSConnect installed on Fedora 31 (with GNOME 3.34; I'm using scrcpy to show my Android phone screen on the desktop):


To be able to lock / unlock your screen using your Android device open KDE Connect / GSConnect and:

  • KDE Connect: in the application plugins list, make sure the "Run commands" plugin is enabled, then click the Run commands configure button
  • GSConnect: click on your device name and you'll find a Commands section in the sidebar

KDE Connect commands
KDE Connect commands

Đăng nhận xét