Bug 471909 - [Plasma Wayland] Screen lock not inhibited when playing media content with mpv
Summary: [Plasma Wayland] Screen lock not inhibited when playing media content with mpv
Status: RESOLVED DOWNSTREAM
Alias: None
Product: plasmashell
Classification: Plasma
Component: Power management & brightness (show other bugs)
Version: 6.3.0
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: wayland-only
Depends on:
Blocks:
 
Reported: 2023-07-03 18:00 UTC by Tom Seewald
Modified: 2025-02-26 18:54 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Seewald 2023-07-03 18:00:50 UTC
SUMMARY
The Plasma (Wayland) screen lock is not inhibited/disabled when playing video content in mpv. I do not recall this ever happening on Plasma using X11.


STEPS TO REPRODUCE
1. Play video file (.mkv, .mp4, etc.) with mpv
2. Do nothing while waiting for the screen lock time to be reached
3. Screen will lock despite the video continuing to play

OBSERVED RESULT
Screen goes black and locks.

EXPECTED RESULT
The screen is not locked while video content is playing.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 38 KDE Plasma
KDE Plasma Version: 5.27.6
KDE Frameworks Version: 5.107.0
Qt Version: 5.15.10
mpv Version: 0.35.1

ADDITIONAL INFORMATION
Playing video content via a web browser does inhibit the screen lock.
Comment 1 ratijas 2023-07-04 11:21:28 UTC
It's up to a player to inhibit screen locking and sleep.

mpv is a very minimal player at its core, but it's extensible via plugins. One such plugin provides MPRIS integrations (so you could control it via media buttons on your keyboard, and in the Media applet in Plasma panel); another such plugin could provide integration with sleep inhibition features of your OS.

For example: https://git.sr.ht/~anteater/mpv-inhibit-suspend
Comment 2 Tom Seewald 2023-07-04 15:14:46 UTC
But mpv *does* inform the compositor of this via the wayland's idle inhibit protocol [1]. The link you posted is a workaround for Gnome's lack of support of the idle inhibit protocol, that is not due to mpv not supporting a standard way of inhibiting sleep/screen lock. I don't think KDE Plasma is working as intended by ignoring a standard wayland protocol.

"A common problem is that Linux desktop environments ignore the standard screensaver APIs on which mpv relies. In particular, mpv uses the Screen Saver extension (XSS) on X11, and the idle-inhibit protocol on Wayland." [2]

[1] https://wayland.app/protocols/idle-inhibit-unstable-v1
[2] https://mpv.io/manual/master/
Comment 3 ratijas 2023-07-05 10:29:37 UTC
OK, I didn't know about that. Sorry for closing.
Comment 4 Pedro V 2023-11-18 08:21:10 UTC
Given the provided steps, can't reproduce on:
Operating System: Kubuntu 23.10
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.10
Kernel Version: 6.5.0-10-generic (64-bit)
Graphics Platform: Wayland

However I did find a way to get the claimed problem a different way. When minimizing mpv, it no longer inhibits screen locking for me, technically resulting in screen locking while media is still playing, but then this behavior seems to be intended and I find it desirable, so likely it's not about this.

Found this because ironically I kind of have the opposite issue. I just found out that media playback inhibits turning off the screen for me even on the lock screen where the inhibition no longer makes sense.
Comment 5 John 2025-02-21 18:09:00 UTC
I can reproduce / confirm it on Debian 13 (Trixie) with the unstable repository and:

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:
KDE Plasma Version: 6.3.0
KDE Frameworks Version: 6.11.0
Qt Version: 6.7.2
Kernel Version: 6.12.15-amd64 (64-bit)
Graphics Platform: Wayland


HARDWARE SPECIFICATIONS
Hardware: Laptop Dell Inspiron 5770 (17" 1080p@60Hz screen)
CPU: Intel® Core™ i5-8250U CPU @ 1.60GHz
GPU 1: Mesa Intel® UHD Graphics 620 (main, Vulkan capable)
GPU 2: AMD Radeon R5 M465 Series
RAM: 8 GiB (7.7 GiB usable)

mpv-version:
mpv 0.39.0 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
libplacebo version: v7.349.0
FFmpeg version: 7.1-3+b2
FFmpeg library versions:
   libavcodec      61.19.100
   libavdevice     61.3.100
   libavfilter     10.4.100
   libavformat     61.7.100
   libavutil       59.39.100
   libswresample   5.3.100
   libswscale      8.3.100
Haruna, that is based on libmpv inhibits it properly!
VLC also does it!
I even tried to make it full screen and windowed again, but it didn't help.

Does mpv need to be started with some parameters to do it?
As I started it with none (other than the vide file name)
Comment 6 Nate Graham 2025-02-26 18:54:26 UTC
Ultimately, if other apps work, this isn't a Plasma problem; it's an app problem for not properly using the inhibition tools and APIs.