[RESOLVED] How to enable airplane mode on lid close

Hi! I’m using OpenSUSE with Gnome on an AMD Framework and I want to enable airplane mode on lid close (and disable on open). I only found some search results on how to prevent that behaviour, but none to enable it.
My settings in the Gnome power settings are very basic, do they clash with /etc/systemd/logind.conf settings? That file doesn’t exist for me, is it even considered?


I love this idea, however we are not actively testing against OpenSUSE at this time.

That said, you could do a:

sudo find /etc/systemd -name "*logind*"

To see where it is as the path may differ.

As far as going into airplane mode, scripting this would be easiest I suspect. Using rfkill block all and unblock all is the least painful approach. Perhaps even create a custom systemd service; something sort of like:

Description=Script to run when laptop lid is closed/opened



I don’t have the cycles to build this out now for testing, but it “could” be doable on supported distros like Fedora or Ubuntu LTS.

1 Like

I got it to work by installing acpid and creating

# /etc/acpi/events/lidconf 
# run a script on lid open/close events
action=/etc/acpi/actions/lid.sh "%e"


# /etc/acpi/actions/lid.sh 
state=$(echo "$1" | cut -d " " -f 3)
case "$state" in
        # do what needs to be done when the lid is opened
        # I almost never use bluetooth, so I'll enable it manually.
        rfkill unblock wifi
        # do what needs to be done when the lid is closed
        rfkill block all
        # panic: not a state I know about!
        echo "PANIC STATE" >> /var/logs/lidaction.log

EDIT: I had a bug, the branches were switched. It’s fixed now.


Nicely done and thanks for sharing this with the community. :slight_smile: