You are not logged in.

#1 2024-12-19 05:07:28

nurali
Member
Registered: 2022-11-14
Posts: 43

[SOLVED]xss-lock with slock locks screen when playing fullscreen video

Hello all
I use dwm + xss-lock + slock(with dpms patch)
I have:

xset s 300
xss-lock -- slock &

in dwm's autostart script file
It did lock the screen after five minutes , and screen also gone black after two minutes (that is what slock dpms patch have done) as I expected
But when when I am watching a fullscreen video (in firefox, vlc), screen also get locked.
Wiki says that using xss-lock with dpms will not lock screen when watching videos, unfortunately it did
Did I missed something?

Last edited by nurali (2024-12-20 12:28:01)

Offline

#2 2024-12-19 07:13:13

Katataf1sh
Member
Registered: 2023-12-02
Posts: 18

Re: [SOLVED]xss-lock with slock locks screen when playing fullscreen video

nurali wrote:

Hello all
I use dwm + xss-lock + slock(with dpms patch)
I have:

xset s 300
xss-lock -- slock &

in dwm's autostart script file
It did lock the screen after five minutes , and screen also gone black after two minutes (that is what slock dpms patch have done) as I expected
But when when I am watching a fullscreen video (in firefox, vlc), screen also get locked.
Wiki says that using xss-lock with dpms will not lock screen when watching videos, unfortunately it did
Did I missed something?

I'm not particularly well versed about xss-lock, I've got limited experience with it, but, I believe you can fix this by tweaking your setup a bit. One way is to use a script that detects fullscreen windows and pauses xss-lock while they’re active. Something like this:

#!/bin/bash

while true; do
    ACTIVE_WINDOW=$(xprop -root _NET_ACTIVE_WINDOW | awk -F' ' '{print $NF}')
    IS_FULLSCREEN=$(xprop -id "$ACTIVE_WINDOW" | grep "_NET_WM_STATE_FULLSCREEN")

    if [ -n "$IS_FULLSCREEN" ]; then
        pkill -STOP xss-lock
    else
        pkill -CONT xss-lock
    fi

    sleep 5
done

Save it as prevent_lock.sh, make it executable, and add it to your autostart script. This should stop the screen from locking when something is fullscreen. If scripting isn’t your thing, you could try caffeine-ng. It’s a simple tool that prevents the screen from locking when videos are playing or specific apps are running. Just install it, run it, and it should work out of the box. Another option is to replace xss-lock with xidlehook. It’s more flexible and lets you set conditions like skipping the lock when a fullscreen window is active or audio is playing. For example:

xidlehook --not-when-fullscreen --not-when-audio --timer 300 'slock' '' &

If you’re mostly using Firefox, you can also try enabling "Inhibit DPMS" in its settings or use an extension like "Keep Awake" to prevent the screen from locking during playback. Personally, I’d go with either the script or caffeine-ng, depending on how much control you want. Let me know if this works for you.

Offline

#3 2024-12-19 08:59:37

seth
Member
Registered: 2012-09-03
Posts: 60,776

Re: [SOLVED]xss-lock with slock locks screen when playing fullscreen video

At least VLC used to have an option to disable the screensaver while playing?

https://wiki.archlinux.org/title/Session_lock#DPMS is BS, the player will have to disable the lock and/or dpms or fake interaction which I assume was the case for the author (mpv does that depending on the playback state, for mplayer see https://wiki.archlinux.org/title/MPlaye … _is_paused or https://man.archlinux.org/man/xss-lock.1#SIGHUP if you want the locker to hit when a video is paused)

To leverage Katataf1sh's approach, see https://man.archlinux.org/man/xss-lock.1#n
You could run the locker on the 2nd cycle and on the first cycle run a script that checks for fullscreen windows or the mpris playback state via dbus and sighup's xss-lock to kick the can down the road.
This way you won't have to permanently run a watchdog.

Offline

#4 2024-12-20 02:53:28

nurali
Member
Registered: 2022-11-14
Posts: 43

Re: [SOLVED]xss-lock with slock locks screen when playing fullscreen video

Katataf1sh wrote:

I'm not particularly well versed about xss-lock, I've got limited experience with it, but, I believe you can fix this by tweaking your setup a bit. One way is to use a script that detects fullscreen windows and pauses xss-lock while they’re active. Something like this:

#!/bin/bash

while true; do
    ACTIVE_WINDOW=$(xprop -root _NET_ACTIVE_WINDOW | awk -F' ' '{print $NF}')
    IS_FULLSCREEN=$(xprop -id "$ACTIVE_WINDOW" | grep "_NET_WM_STATE_FULLSCREEN")

    if [ -n "$IS_FULLSCREEN" ]; then
        pkill -STOP xss-lock
    else
        pkill -CONT xss-lock
    fi

    sleep 5
done

Save it as prevent_lock.sh, make it executable, and add it to your autostart script. This should stop the screen from locking when something is fullscreen. If scripting isn’t your thing, you could try caffeine-ng. It’s a simple tool that prevents the screen from locking when videos are playing or specific apps are running. Just install it, run it, and it should work out of the box. Another option is to replace xss-lock with xidlehook. It’s more flexible and lets you set conditions like skipping the lock when a fullscreen window is active or audio is playing. For example:

xidlehook --not-when-fullscreen --not-when-audio --timer 300 'slock' '' &

If you’re mostly using Firefox, you can also try enabling "Inhibit DPMS" in its settings or use an extension like "Keep Awake" to prevent the screen from locking during playback. Personally, I’d go with either the script or caffeine-ng, depending on how much control you want. Let me know if this works for you.

Thank you for replying.
I am kinda busy at this time, and I'll try everything that you've talked about
Thank you very much

Offline

#5 2024-12-20 02:56:27

nurali
Member
Registered: 2022-11-14
Posts: 43

Re: [SOLVED]xss-lock with slock locks screen when playing fullscreen video

seth wrote:

At least VLC used to have an option to disable the screensaver while playing?

https://wiki.archlinux.org/title/Session_lock#DPMS is BS, the player will have to disable the lock and/or dpms or fake interaction which I assume was the case for the author (mpv does that depending on the playback state, for mplayer see https://wiki.archlinux.org/title/MPlaye … _is_paused or https://man.archlinux.org/man/xss-lock.1#SIGHUP if you want the locker to hit when a video is paused)

To leverage Katataf1sh's approach, see https://man.archlinux.org/man/xss-lock.1#n
You could run the locker on the 2nd cycle and on the first cycle run a script that checks for fullscreen windows or the mpris playback state via dbus and sighup's xss-lock to kick the can down the road.
This way you won't have to permanently run a watchdog.

Thank you for replying and suggesstions.
I'll check and try them later

Offline

#6 2024-12-20 08:57:17

seth
Member
Registered: 2012-09-03
Posts: 60,776

Re: [SOLVED]xss-lock with slock locks screen when playing fullscreen video

https://wiki.archlinux.org/title/General_guidelines
Please don't bloat the thread w/ pointless full quotes and also please don't post stuff like "I will post some actual information later" - just post the actual information later.
This isn't IRC, communication is asynchronous by nature and lags in the communication expected.

Offline

#7 2024-12-20 12:27:25

nurali
Member
Registered: 2022-11-14
Posts: 43

Re: [SOLVED]xss-lock with slock locks screen when playing fullscreen video

Solved with:
In autostart.sh:

export MOUSE_DIRECTION=left
xset s 298 2
xss-lock -n /home/ali/Downloads/dwm/scripts/detect_fullscreen_and_move_mouse.sh -- slock &

And in detect_fullscreen_and_move_mouse.sh:

#!/bin/bash

WINDOW_ID=$(xdotool getactivewindow)
IS_FULLSCREEN=$(xprop -id "$WINDOW_ID" | grep -i "_NET_WM_STATE_FULLSCREEN")

if [[ "$IS_FULLSCREEN" =~ "_NET_WM_STATE_FULLSCREEN" ]]; then
    if [[ "$MOUSE_DIRECTION" == "left" ]]; then
        xdotool mousemove_relative -- 1 0
        export MOUSE_DIRECTION="right"
    elif [[ "$MOUSE_DIRECTION" == "right" ]]; then
        xdotool mousemove_relative -- -1 0
        export MOUSE_DIRECTION="left"
    fi
fi

Offline

Board footer

Powered by FluxBB