SolDoesTech / HyprV4

452 stars 133 forks source link

Can't get Swayidle to work w/ Dual Monitor setup no matter what #62

Open jontstaz opened 9 months ago

jontstaz commented 9 months ago

This is bugging me like crazy. I have tried about a hundred different ways of making my monitors turn off/idle but no matter what I do, the furthest I can get is successfully getting my main monitor to idle but my second monitor will instantly come back on 2 seconds after going black.

Here's the script that works for my main monitor (DP-1) but the second monitor (HDMI-A-2) goes black for 2 seconds then comes back on (also tried it without the killall -SIGUSR1 swayidle with the same result):

swayidle -w -d \
    timeout 300 '~/.config/hypr/scripts/lock.sh' \
    timeout 360 'hyprctl dispatch dpms off DP-1 && hyprctl dispatch dpms off HDMI-A-2 && sleep 1 && killall -SIGUSR1 swayidle' \
    resume '
        hyprctl monitors | grep HDMI
        ret=$?

        if [ $ret -eq 0 ]   
        then
            hyprctl dispatch dpms on DP-1
        else
            hyprctl dispatch dpms off HDMI-A-2 
        fi
        ' \
    before-sleep '~/.config/hypr/scripts/lock.sh' \
    lock '~/.config/hypr/scripts/lock.sh'
...
exec-once = ~/.config/hypr/scripts/idle.sh
...
swaylock \
    #--screenshots \
    --clock \
    --indicator \
    --indicator-radius 100 \
    --indicator-thickness 7 \
    --effect-blur 7x5 \
    --effect-vignette 0.5:0.5 \
    --ring-color bb00cc \
    --key-hl-color 880033 \
    --line-color 00000000 \
    --inside-color 00000088 \
    --separator-color 00000000 \
    --grace 0 \
    --fade-in 0.2 \
    -f

I've also tried a number of suggestions from various Reddit threads and Github issues which everyone else said worked for them but of course failed for me. Such as:

exec-once = swayidle -d -w timeout 300 'hyprctl dispatch dpms off && swaylock -f' resume 'hyprctl dispatch dpms on'

There is one error in the output that appears when the second monitor turns itself back on automatically after the 2 seconds of idle: [main.c:626] Screencopy failed. I'm not sure what's causing it. BTW I ensured that the little eye icon, which indicates the idle inhibitor, on the top waybar is disabled (eye with a cross through it - the default)

If anyone has been able to successfully get swayidle working, please help me. This is so ridiculously annoying. There's no reason it shouldn't work. For some extra context, my main monitor is connected via Display Port and my secondary monitor via HDMI. That shouldn't be an issue though as one of the suggestions I tried was posted by someone with that exact same setup and it worked for him.

jontstaz commented 9 months ago

Any help anyone? Still can't get it working.

jontstaz commented 9 months ago

@SolDoesTech

pahb18 commented 3 months ago

I'm having the same issue. Were you able to fix this in the end?