Prevent screen turning off during playback

Closes: #157

XDG portals expose a D-Bus interface allowing apps to prevent screen
idling, user switching, and other actions. That interface,
org.freedesktop.portal.Inhibit, does all of the heavy lifting here.

Idling = the screen dimming or shutting off.

Idling is inhibited when a video is actively playing.
Idling is NOT inhibited when videos aren't playing - this includes
paused or stopped videos.
This commit is contained in:
Josh Megnauth 2025-11-09 21:33:47 -05:00
parent fa1637fe51
commit bb087578df
No known key found for this signature in database
GPG key ID: 70813183462EFAD3
10 changed files with 331 additions and 40 deletions

View file

@ -1,12 +1,13 @@
[package]
name = "cosmic-player"
version = "0.1.0"
edition = "2021"
edition = "2024"
[build-dependencies]
vergen = { version = "8", features = ["git", "gitcl"] }
[dependencies]
ashpd = { version = "0.12", optional = true }
gstreamer-tag = "0.23"
image = "0.24.9"
serde = { version = "1", features = ["serde_derive"] }
@ -48,7 +49,7 @@ fork = "0.2"
[features]
default = ["mpris-server", "xdg-portal", "wgpu"]
xdg-portal = ["libcosmic/xdg-portal"]
xdg-portal = ["ashpd", "libcosmic/xdg-portal"]
wgpu = ["iced_video_player/wgpu", "libcosmic/wgpu"]
[profile.release-with-debug]