-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Description
When playing a video on YouTube (not in fullscreen), the computer can still idle and lock the screen. The sound-based detection for preventing screen lock doesn't work consistently. It works correctly when in fullscreen mode.
Current Behavior
- Play a YouTube video in normal (non-fullscreen) mode
- Video has audio playing
- After idle timeout, screen locks despite audio playback
- In fullscreen mode, idle inhibit works correctly
Expected Behavior
Audio playback should prevent screen lock regardless of whether the video is in fullscreen mode or not.
Technical Context
Relevant Files:
internal/infrastructure/idle/portal_inhibitor.go- XDG Desktop Portal idle inhibitioninternal/infrastructure/webkit/webview.go:621-637- Audio state detection vianotify::is-playing-audiointernal/ui/coordinator/content.go:1577-1629-setupIdleInhibitionHandlers()wiring
Current Implementation:
// Fullscreen handling - works
OnEnterFullscreen: idleInhibitor.Inhibit(ctx, "Fullscreen video playback")
OnLeaveFullscreen: idleInhibitor.Uninhibit(ctx)
// Audio handling - inconsistent
OnAudioStateChanged(playing bool):
if playing: idleInhibitor.Inhibit(ctx, "Media playback")
else: idleInhibitor.Uninhibit(ctx)Potential Issues:
- WebKit's
is-playing-audiosignal may not fire consistently for all media types - The signal might not trigger for embedded players (YouTube uses iframe)
- Audio state changes might be missed during page transitions
- Refcount issues if audio starts/stops rapidly
- D-Bus portal request may not complete before audio state changes
Suggested Investigation
- Add logging to
OnAudioStateChangedto verify signal is firing - Check if
IsPlayingAudio()returns correct state during playback - Verify D-Bus inhibit request completes successfully
- Test with different video sites to isolate YouTube-specific vs general issue
- Check if iframe isolation affects audio detection
- Consider polling-based fallback for audio state
Debug Commands
# Check current inhibit state
gdbus call --session --dest org.freedesktop.portal.Desktop --object-path /org/freedesktop/portal/desktop --method org.freedesktop.DBus.Properties.GetAll org.freedesktop.portal.Inhibit
# Monitor D-Bus signals
dbus-monitor --session "interface='org.freedesktop.portal.Request'"Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels