53
submitted 8 months ago* (last edited 8 months ago) by MrTHXcertified@lemdro.id to c/linux@lemmy.ml

In KDE 5, the Activities settings had an option for overriding (among other things) what actions closing the laptop lid did, so temporarily disabling the lid switch was as simple as switching Activities.

Now, in KDE 6, Activities have been reworked and this option was removed. What is an alternative way for me to, on demand, disable the laptop lid and keep it from putting the system to sleep? And then easily re-enable it again without a reboot or logging off?

The new Activities options for disabling "automatically turning off the screen" and "automatically sleeping and locking" have no effect.

Operating System: openSUSE Tumbleweed 20240314 KDE Plasma Version: 6.0.2 KDE Frameworks Version: 6.0.0 Qt Version: 6.6.2 Kernel Version: 6.7.9-1-default (64-bit) Graphics Platform: Wayland Processors: 12 × Intel® Core™ i7-10710U CPU @ 1.10GHz Memory: 15.5 GiB of RAM Graphics Processor: Mesa Intel® UHD Graphics Manufacturer: Micro-Star International Co., Ltd. Product Name: Prestige 15 A10SC System Version: REV:1.0

top 4 comments
sorted by: hot top controversial new old
[-] carzian@lemmy.ml 5 points 8 months ago

Does the "prevent sleeping" toggle in the power icon on the task bar work in this case?

[-] MrTHXcertified@lemdro.id 2 points 8 months ago

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.

[-] carzian@lemmy.ml 1 points 8 months ago

Yeah that's the one I meant. Damn, that's too bad

[-] ReversalHatchery@beehaw.org 3 points 8 months ago* (last edited 8 months ago)

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.

this post was submitted on 16 Mar 2024
53 points (94.9% liked)

Linux

48143 readers
732 users here now

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

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS