phillipberndt / autorandr

Auto-detect the connected display hardware and load the appropriate X11 setup using xrandr
2.49k stars 123 forks source link

how to make autorandr not execute on wakeup if display is locked? (i3lock) #214

Open oryband opened 4 years ago

oryband commented 4 years ago

If my laptop locks itself (using i3lock-color) while using a profile (e.g. laptop monitor only) and then wakes up when another profile is available (external monitor), autorandr will execute on wake up from suspend/hibernate and switch to the new profile. The laptop is still "locked" i.e. input goes to the locker (still "displayed" on the laptop monitor from the previous profile), but the lock screen dissappears, which looks like the machine is unlocked and usable.

Using Arch Linux.

oryband commented 4 years ago

Update: This also happens without switching to the second profile i.e. when the laptop wakes from sleep, only the laptop display is on, lock screen is invisible but the laptop is locked.

chmduquesne commented 4 years ago

To prevent a profile from being loaded, place a script call block in its directory. The script is evaluated before the screen setup is inspected, and in case of it returning a value of 0 the profile is skipped. This can be used to query the status of a docking station you are about to leave.

I would advise writing something that detects if the screen is locked and returns a non zero value if this is the case.

dmitrySorokin commented 1 year ago

@oryband have you solved this issue?

oryband commented 1 year ago

@oryband have you solved this issue?

i don't use it anymore. can close

johnchristopher commented 10 months ago

If my laptop locks itself (using i3lock-color) while using a profile (e.g. laptop monitor only) and then wakes up when another profile is available (external monitor), autorandr will execute on wake up from suspend/hibernate and switch to the new profile. The laptop is still "locked" i.e. input goes to the locker (still "displayed" on the laptop monitor from the previous profile), but the lock screen dissappears, which looks like the machine is unlocked and usable.

To prevent a profile from being loaded, place a script call block in its directory. The script is evaluated before the screen setup is inspected, and in case of it returning a value of 0 the profile is skipped. This can be used to query the status of a docking station you are about to leave.

I would advise writing something that detects if the screen is locked and returns a non zero value if this is the case.

Hi ! I am hitting the same roadblock (using i3lock), but coming from a different angle: laptop is connected to external monitor, monitor is active, laptop monitor is not, then systemctl suspend & i3lock, laptop sleeps, I unplug monitor, I wake up laptop, autorandr switches to default profile (which is laptop screen without any other monitors in my case), laptop displays current window manager with everything visible but no lock graphics or inputs, screen is frozen though, keyboard can be used to unlock/unfreeze.

Now, what logic are you suggesting to put in the block script ? Killing the locker and restarting it ? But that would be a security and UX problem, right ?

Is the logic to "move" the locker gaphic "output" to another screen ? Is it something that can be done ?

I am thinking the problem is more an i3lock problem (it should by default be displayed on any available screen) than an autorandr one.

[Unit]
Description=autorandr execution hook
After=sleep.target
# Note: StartLimitInterval was renamed to StartLimitIntervalSec in systemd-230.
# See autorandr bug #69. Do not rename for now, as the old name is kept for
# compatibility.
StartLimitInterval=5
StartLimitBurst=1

[Service]
ExecStart=/usr/bin/autorandr --batch --change --default default
Type=oneshot
RemainAfterExit=false

[Install]
WantedBy=sleep.target

Digging a bit (see https://github.com/meskarune/i3lock-fancy/issues/188#issuecomment-1869837447), I found out I can't reproduce the issue with slock so either it's an i3lock problem or an i3lock/awesome problem. Edit: can reproduce with alock.

hyunlee1o commented 1 week ago

I also have this problem. It's annoying, i have a binding specifically for this.