What's the command to keep screen awake (prevent lockscreen)?
I know how to do it in the battery section through the GUI, but I'd like to set it up through a command, for automation purposes, and particularly for KDE Connect commands.
There is kde-inhibit --screenSaver <command> provided by KDE.
But these days, I would just recommend everyone to use systemd-inhibit --what=idle --why=<because> --who=<myself> <command> instead. Works across desktops and does the same thing.
Anything that runs as long as you want the block to be. Usually sleep is a good one, use sleep infinity if you want the blocker to never go away until the systemd-inhibit process is killed manually.
I don't know if this fits your use case (you didn't describe what you want to achieve in detail), but commands that can possible help if the screen did lock (or turn off):
8 replies
There is
kde-inhibit --screenSaver <command>provided by KDE.But these days, I would just recommend everyone to use
systemd-inhibit --what=idle --why=<because> --who=<myself> <command>instead. Works across desktops and does the same thing.What should I put in the
<command>part?Anything that runs as long as you want the block to be. Usually
sleepis a good one, usesleep infinityif you want the blocker to never go away until thesystemd-inhibitprocess is killed manually.Aaaah, that's probably what Plasma is doing.
Would yes command work ?
Presumably, but it prints "y" to the program output as fast as your CPU allows it, so that's probably not a very efficient way to do it.
I don't know if this fits your use case (you didn't describe what you want to achieve in detail), but commands that can possible help if the screen did lock (or turn off):
loginctl unlock-screenkscreen-doctor --dpms onWasn't that. I want to keep the screen on. No sleep, no lockscreen, no blackscreen, etc.