Does the "prevent sleeping" toggle in the power icon on the task bar work in this case?
Linux
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
If you mean the "Manually block sleep and screen locking" toggle in the battery icon in the systray, then no, that didn't stop the lid action.
Yeah that's the one I meant. Damn, that's too bad
On systemd systems the systemd-inhibit
command is supposed to make this possible. You can "inhibit" suspending, shutting down, restarting, the lid closed action itself, etc.
However, it has a fatal flaw. It only honors inhibits of the root user. There's more: when you inhibit sleep as root, instead of locking the screen and turning it off, it will just pop up a polkit password dialog to request permission to sleep. The screen will still drain your battery, and your account will stay opened up.
You can work around the first issue by either
a) creating a one liner bash script in /usr/local/bin that runs the inhibit command, and setting up sudo so that running that script does not require a password
b) creating a non-script program in the same place that runs this command, setting the owner of this program file to root, and the setuid bit on it
If you are more creative, you could also find the way to change the lid close action from a program of yours, and make a program that places some kind of UI element (maybe a taskbar widget?) on the screen with which you can quickly toggle between sleeping or just locking the screen.