You are not logged in.

#1 2023-01-31 23:11:03

hully
Member
Registered: 2022-11-14
Posts: 164

Wake up from suspend when connecting external monitor

I have my laptop setup to suspend when I close my lid (through systemd-logind).

How can I wake up when connecting external monitor?

Offline

#2 2023-01-31 23:33:23

hully
Member
Registered: 2022-11-14
Posts: 164

Re: Wake up from suspend when connecting external monitor

I tried the following udev rule.

The only thing I get is a crash of my Wayland compositor:

ACTION=="change", SUBSYSTEM=="drm", HOTPLUG==1, RUN+="systemctl default"

Offline

#3 2023-01-31 23:42:01

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Wake up from suspend when connecting external monitor


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#4 2023-02-01 07:15:31

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,398

Re: Wake up from suspend when connecting external monitor

The only thing I get is a crash of my Wayland compositor:

No you don't.

man systemctl wrote:

default
           Enter default mode. This is equivalent to systemctl isolate default.target. This
           operation is blocking by default, use --no-block to request asynchronous behavior.

I don't think I've ever seen HDMI causing ACPI events, but
1. udev rules won't help here. Ever. The OS isn't processing anything while in S3
2. If the PCI of your GPU doesn't show up in the wakeup table, there isn't even a remote chance to wake the system by plugging the HDMI
3. A usb dock might work and you'll typically be able to configure the system on any kind of USB action (plugging a usb key)

Sanity check:
The plan isn't to close the display, have it undesiredly enter S3 and then immediately wake it again by plugging the HDMI cable. Is it?
Because then you could just inhibit the lid-sleep, https://man.archlinux.org/man/systemd-inhibit.1.en

Offline

#5 2023-02-02 13:42:04

hully
Member
Registered: 2022-11-14
Posts: 164

Re: Wake up from suspend when connecting external monitor

No you don't.

So what is "default mode"?

1. udev rules won't help here. Ever. The OS isn't processing anything while in S3

I will double check but I think it was triggered

2. If the PCI of your GPU doesn't show up in the wakeup table, there isn't even a remote chance to wake the system by plugging the HDMI

What is the "wakeup table" and how can I check that?

The plan isn't to close the display, have it undesiredly enter S3 and then immediately wake it again by plugging the HDMI cable. Is it?

Yes it's exactly that

1. Close the lid
2. Plug HDMI
3. Have the system wake up so that I can use the laptop

Because then you could just inhibit the lid-sleep, https://man.archlinux.org/man/systemd-inhibit.1.en

So I should run something like:

sudo systemd-inhibit --what=handle-lid-switch sleep 60

before closing the lid?

Isn't there a simpler method?

Last edited by hully (2023-02-03 13:24:44)

Offline

#6 2023-02-02 14:14:41

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,398

Re: Wake up from suspend when connecting external monitor

So what is "default mode"?

https://wiki.archlinux.org/title/System … _boot_into

I will double check but I think it was triggered

Not while the system was suspended. That is without a doubt completely impossible.

So I should run something like:

No. Where did you take the "sleep 60" from?
You inhibit handlign the lid switch to not have it idle the system. That's all.

Isn't there a simpler method?

Don't use the lid to suspend the system?
Attach the HDMI output *before* you close the lid?

If you casewise don't want the lid to suspend the system, you'll have to communicate that somehow.

Offline

#7 2023-02-02 15:47:13

hully
Member
Registered: 2022-11-14
Posts: 164

Re: Wake up from suspend when connecting external monitor

All right.

No. Where did you take the "sleep 60" from?
You inhibit handlign the lid switch to not have it idle the system. That's all.

The doc says it needs a process to run and the action is inhibited as long as that process is running.

sudo systemd-inhibit --what=handle-lid-switch

Just returns a table with the current inhibitors.

Then to disable suspend on lid close I have to override logind config with a conf file in `/etc/systemd/logind.conf.d/` right?

Offline

#8 2023-02-02 16:42:06

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,398

Re: Wake up from suspend when connecting external monitor

Sorry, I've never used it but … assumed … it could also act as client for org.freedesktop.login1.Manager.Inhibit
https://www.freedesktop.org/wiki/Softwa … d/inhibit/

dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.ListInhibitors

But

dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 org.freedesktop.login1.Manager.Inhibit string:"handle-lid-switch" string:"me" string:"because" string:"block"

returns a file dscriptor (prints an inode) that you'd need to (keep) open for the inhibit to stay, so indeed you'll have to run some stupid dummy process. Sorry.

Offline

#9 2023-02-03 11:12:43

hully
Member
Registered: 2022-11-14
Posts: 164

Re: Wake up from suspend when connecting external monitor

Actually waybar has a module for inhibiting suspend.

So I can simply click on the module and then connect the monitor.

Seth, I'm getting better at this.

Offline

Board footer

Powered by FluxBB