6

Question

Is it possible to prevent applications from using systemd-inhibit?

Why?

systemd-inhibit allows applications to override directives from /etc/systemd/logind.conf, in particular HandleLidSwitch=ignore, HandleLidSwitchDocked=ignore, and LidSwitchIgnoreInhibited=no.

At one point or the other, the developers of nearly every desktop environment has discovered that they can do this, including KDE, Gnome, and recently Enlightenment. This recent development in enlightenment is my current problem:

$ systemd-inhibit 
WHO           UID  USER    PID COMM          WHAT                                                                       WHY              MODE 
Enlightenment 1000 <username> 769 enlightenment handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch Normal Execution block

1 inhibitors listed.

$

Worse, I do not think the configuration of enlightenment allows specifying what should happen in that event, i.e. the lid being closed. As a consequence, the laptop suspends every time I close the lid. This is very bad and should never happen, which is why I had HandleLidSwitch=ignore, HandleLidSwitchDocked=ignore, and LidSwitchIgnoreInhibited=no in /etc/systemd/logind.conf in the first place. Without enlightenment running, everything is fine and I can close the lid without the system suspending automatically; when enlightenment runs, I cannot.

The way I see it, there is absolutely no reason whatsoever for any application to override anything in my /etc/systemd/logind.conf. Hence, I would like to try to prevent enlightenment_start from using the inhibitor (hoping that it is not built in such a way that it won't start any more if it cannot have the inhibitor.)

Related question

An answer to a similar question (about the same thing happening in gnome) seems to suggesr that systemd-inhibitors can only be removed by terminating the app responsible for the inhibitor. If this is not an option, it suggests preventing the original app from placing the inhibitor instead. It suggests reading the man page of dbus-daemon to see how to do that, but I do not see how this is related.

Approaches

  • Can I limit permissions for setting inhibitors for certain apps?
  • Can I disable inhibitors alltogether?
  • Can I set another inhibitor reversing the behavior of the one set by enlightenment?

Note on using alternative desktop environments etc

I understand that every desktop enviromnent developer aims for "user-friendlyness", commonly understood as making interaction with config files unnecessary by handling everything in their own application. Unfortunately, this makes it increasingly difficult to find a desktop environment that does not do that and leaves my system configuration alone but still offers a bit of functionality and does that with some reliability. An example: For instance, I looked into LXDE, which seems nice, except that when executing systemctl suspend purposefully (i.e., I really want the machine to suspend), it may or may not lock the screen. I am sure all of these issues can be solved somehow, but it seems a lot of hassle for just getting the functionality back that I had 10 years ago.

Software

System is Arch Linux with kernel 5.5.9, systemd is version 245.2, enlightenment is version 0.23.1.

1 Answer 1

2

logind.conf has an InhibitorsMax option. InhibitorsMax=0 will disable inhibitors altogether. Being able to just stop specific apps would be better, but this Is the best I have found so far.

1
  • Thanks. This seems like a very promising solution, though I can't currently test it. (Note that the question is more than 3 years old.) I will check and accept your answer when I have the chance to test it.
    – 0range
    Commented Jul 13, 2023 at 21:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .