DankMaterialShell icon indicating copy to clipboard operation
DankMaterialShell copied to clipboard

Screen is being locked when playing Youtube videos on Firefox

Open colutti opened this issue 2 months ago • 7 comments

Compositor

  • [ ] niri
  • [X ] Hyprland
  • [ ] dwl (MangoWC)
  • [ ] sway
  • [ ] Other (specify)

Distribution

CachyOS.

dms version

0.4.2

Description

Screen is being locked when playing Youtube videos on Firefox

I have configure the Power Options as above. When I am watching Youtube videos on Firefox, my screen is being locked after detecting I am idle.

Image

Expected Behavior

Firefox should prevent the screen on being locked when it is playing a video.

Steps to Reproduce

  1. Configure the Power Options to lock the screen after X minutes
  2. Open a youtube video on firefox. Do not touch the mouse or keyboard during X minutes

Error Messages/Logs

nohup: ignoring input
dms v0.4.2
  INFO  go: Spawning quickshell with -p /usr/share/quickshell/dms

██████╗  █████╗ ███╗   ██╗██╗  ██╗
██╔══██╗██╔══██╗████╗  ██║██║ ██╔╝
██║  ██║███████║██╔██╗ ██║█████╔╝
██║  ██║██╔══██║██║╚██╗██║██╔═██╗
██████╔╝██║  ██║██║ ╚████║██║  ██╗
╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═══╝╚═╝  ╚═╝
  INFO  go: DMS API Server listening on: /run/user/1000/danklinux-113487.sock
  INFO  go: API Version: 15
  INFO  go: Protocol: JSON over Unix socket
  INFO  go: Request format: {"id": <any>, "method": "...", "params": {...}}
  INFO  go: Response format: {"id": <any>, "result": {...}} or {"id": <any>, "error": "..."}
  INFO  go:
  INFO  go: Initializing managers...
  INFO  go:
  INFO  go: Attempting to initialize Wayland gamma control...
  INFO  go: setupRegistry: starting registry setup
  INFO  go: setupRegistry: found zwlr_gamma_control_manager_v1
  INFO  go: setupRegistry: gamma control manager bound successfully
  INFO  go: Bound wl_output id=5 registry_name=61
  INFO  go: Bound wl_output id=6 registry_name=66
  INFO  go: Output 5 name: DP-2
  INFO  go: Output 6 name: HDMI-A-1
  INFO  go: setupRegistry: discovered gamma_manager=true, outputs=2
  INFO  go: setupRegistry: filtered 2 physical outputs from 2 total outputs
  INFO  go: setupRegistry: completed successfully (gamma controls will be initialized when enabled)
  INFO  go: D-Bus monitoring for suspend/resume events enabled
  INFO  go: Wayland gamma control initialized successfully
  INFO  go: Attempting to initialize DWL IPC...
  INFO  go: DWL: starting registry setup
  INFO  go: Network backend detection: NetworkManager present. Using NM API.
  INFO  go: DWL: Bound wl_output id=10 registry_name=61
  INFO  go: DWL: Bound wl_output id=11 registry_name=66
  INFO  go: DWL: manager not found in registry
  INFO  go: Wayland event dispatcher started
  INFO  go:
  INFO  go: Ready! Capabilities: [plugins gamma brightness]
  INFO  go: Brightness manager initialized
  INFO  go: Logind backend initialized - will use for brightness control
  INFO  go: Sysfs backend initialized with 0 devices
  INFO  go: Freedesktop manager initialized
  WARN  go: Failed to initialize bluez manager: no bluetooth adapter found: Could not activate remote peer 'org.bluez': unit failed
  WARN  go: Bluez manager unavailable: no bluetooth adapter found: Could not activate remote peer 'org.bluez': unit failed
  INFO  go: Loginctl manager initialized
  INFO: Launching config: "/usr/share/quickshell/dms/shell.qml"
  INFO: Shell ID: "85ecfc916fcda75f6106502e8dabb0ab" Path ID "85ecfc916fcda75f6106502e8dabb0ab"
  INFO  go: [SecretAgent] Registered with NetworkManager (id=com.danklinux.NMAgent, unique name=:1.608, fixed path=/org/freedesktop/NetworkManager/SecretAgent)
  INFO: Saving logs to "/run/user/1000/quickshell/by-id/qkf2dl8g5t/log.qslog"
  INFO  go: Network manager initialized
  INFO  go: DDC backend initialized
  INFO qml: CompositorService: Detected Hyprland
  INFO qml: AudioService: Sound effects enabled
  INFO qml: NetworkService: Initializing...
  INFO qml: PolkitService: Initialized successfully
  INFO qml: IdleService: Initialized with idle monitoring support
  WARN quickshell.dbus.objectmanager: Failed to create DBusObjectManagerInterface for "org.bluez" "/" : QDBusError("", "")
  WARN quickshell.I3.ipc: $I3SOCK is unset. Trying $SWAYSOCK.
  WARN quickshell.I3.ipc: $SWAYSOCK and I3SOCK are unset. Cannot connect to socket.
  WARN quickshell.service.notifications: Could not register notification server at org.freedesktop.Notifications, presumably because one is already registered.
  WARN quickshell.service.notifications: Registration will be attempted again if the active service is unregistered.
  INFO: Configuration Loaded
  INFO qt.multimedia.ffmpeg: Using Qt multimedia with FFmpeg version n8.0 GPL version 3 or later
  WARN: parseSampleFormat: parse error "Object: size 224, type Spa:Pod:Object:Param:Format (262147), id Spa:Enum:ParamId:EnumFormat (3)" "  Prop: keySpa:Pod:Object:Param:Format:mediaType (1), flags 00000000" "    Id 1 (Spa:Enum:MediaType:audio)" "  Prop: key Spa:Pod:Object:Param:Format:mediaSubtype (2), flags 00000000" "    Id 4        (Spa:Enum:MediaSubtype:dsd)""  Prop: key Spa:Pod:Object:Param:Format:Audio:bitorder (65543), flags 00000000" "    Id 1        (Spa:Enum:ParamBitorder:msb)" "  Prop: key Spa:Pod:Object:Param:Format:Audio:interleave (65544), flags 00000000" "    Int 4" " Prop: key Spa:Pod:Object:Param:Format:Audio:rate (65539), flags 00000000""    Choice: type Spa:Enum:Choice:Range, flags 00000000 28 4" "      Int 384000" "      Int 352800" "      Int 1536000" "  Prop: key Spa:Pod:Object:Param:Format:Audio:channels (65540), flags 00000000" "    Choice: type Spa:Enum:Choice:None, flags 00000000 20 4" "      Int 2" "  Prop: key Spa:Pod:Object:Param:Format:Audio:position (65541), flags 00000000" "    Array: child.size 4, child.type Spa:Id" "      Id 3        (Spa:Enum:AudioChannel:FL)" "      Id 4        (Spa:Enum:AudioChannel:FR)"
  WARN: parseSampleFormat: parse error "Object: size 144, type Spa:Pod:Object:Param:Format (262147), id Spa:Enum:ParamId:EnumFormat (3)" "  Prop: keySpa:Pod:Object:Param:Format:mediaType (1), flags 00000000" "    Id 1 (Spa:Enum:MediaType:audio)" "  Prop: key Spa:Pod:Object:Param:Format:mediaSubtype (2), flags 00000000" "    Id 3        (Spa:Enum:MediaSubtype:iec958)" "  Prop: key Spa:Pod:Object:Param:Format:Audio:iec958Codec (65542), flags 00000000" "    Choice: type Spa:Enum:Choice:Enum, flags 00000000 24 4" "     Id 1        (Spa:Enum:AudioIEC958Codec:PCM)" "      Id 1        (Spa:Enum:AudioIEC958Codec:PCM)" "  Prop: key Spa:Pod:Object:Param:Format:Audio:rate (65539), flags 00000000" "    Choice: type Spa:Enum:Choice:Range, flags 00000000 28 4" "      Int 48000" "      Int 32000" "      Int 48000"
Input #0, wav, from '/usr/share/quickshell/dms/assets/sounds/freedesktop/audio-volume-change.wav':
  Metadata:
    encoder         : Lavf62.3.100
  Duration: 00:00:00.06, bitrate: 1420 kb/s
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
  WARN scene: QML FileView at @Common/SettingsData.qml[896:5]: Read of /home/colutti/.config/DankMaterialShell/plugin_settings.json failed: File doesnot exist.
  INFO qml: Theme: Dynamic colors file loaded successfully
  WARN qml: I18n: Falling back to built-in English strings
Input #0, wav, from '/usr/share/quickshell/dms/assets/sounds/freedesktop/message.wav':
  Metadata:
    encoder         : Lavf62.3.100
  Duration: 00:00:00.31, bitrate: 1413 kb/s
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
Input #0, wav, from '/usr/share/quickshell/dms/assets/sounds/freedesktop/message-new-instant.wav':
  Metadata:
    encoder         : Lavf62.3.100
  Duration: 00:00:01.03, bitrate: 1411 kb/s
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
Input #0, wav, from '/usr/share/quickshell/dms/assets/sounds/plasma/power-unplug.wav':
  Metadata:
    encoder         : Lavf62.3.100
  Duration: 00:00:03.00, bitrate: 1411 kb/s
Input #0, wav, from '/usr/share/quickshell/dms/assets/sounds/plasma/power-plug.wav':
  Metadata:
    encoder         : Lavf62.3.100
  Duration: 00:00:03.00, bitrate: 1411 kb/s
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
  WARN quickshell.service.polkit.listener: failed to register listener: GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: An authentication agent already exists for the given subject
  WARN quickshell.service.polkit: failed to register listener on path "/org/quickshell/PolkitAgent"
  WARN quickshell.service.sni.watcher: Ignoring invalid StatusNotifierItemregistration of :1.325/StatusNotifierItem to watcher
  INFO qml: Detected distribution: CachyOS
  INFO qml: Theme: Setting desired theme - image mode: dark type: scheme-tonal-spot
  INFO qml: CompositorService: Detected Hyprland
  INFO qml: NetworkService: Network capability detected, using DMSNetworkService
  INFO qml: NetworkService: Switched to DMSNetworkService, networkAvailable: true
  INFO qml: DMSService: Connected (API v15) - ["plugins","network","loginctl","freedesktop","gamma","brightness"]
  INFO qml: SessionService: Native inhibitor available: true
  INFO qml: Theme: Dynamic colors file loaded successfully
  INFO qml: Theme: Dynamic colors file loaded successfully
  INFO qml: Theme: Matugen worker completed successfully
  INFO qml: Theme: Dynamic colors file loaded successfully
  WARN scene: QML QQuickImage at @Widgets/DankCircularImage.qml[21:5]: Cannot open: file:///home/colutti/.face
  WARN scene: QML QQuickImage at @Widgets/DankCircularImage.qml[21:5]: Cannot open: file:///home/colutti/.face
quickshell.service.pam.subprocess: Waiting for parent confirmation...
quickshell.service.pam.subprocess: Starting pam session for user "colutti"with config "login" in dir "/etc/pam.d"
quickshell.service.pam.subprocess: Relaying pam message: "Password: " echo: 0 error: 0 responseRequired: 1
quickshell.service.pam.subprocess: Got response for request.quickshell.service.pam.subprocess: Authenticated successfully.

colutti avatar Nov 09 '25 07:11 colutti

interestingly, I cannot reproduce this problem which I'm not sure about - maybe firefox is running under XWayland?

But I added an option you can try as a workaround

Image

bbedward avatar Nov 09 '25 16:11 bbedward

Hello

How can I test it? Do i need to use the git version? Because I dont see the option. Firefox is running under wayland.

colutti avatar Nov 09 '25 17:11 colutti

On arch you can try dms-shell-git

I didn't have the problem myself but also that's on niri so might be different

bbedward avatar Nov 09 '25 17:11 bbedward

I just tested it and it did not work. Still locking my screen. I can try hyprlock for example while disabling the dms idle. If it also does not work it is probably because Firefox is not sending the event

colutti avatar Nov 09 '25 18:11 colutti

In addition I am on a Desktop, not a laptop so I do not have a battery. And the video is not on fullscreen. I have it normally loaded in youtube and a terminal besides firefox

Image Image

colutti avatar Nov 09 '25 18:11 colutti

as far as I can tell its creating the inhibitor when media is playing, and that setting is on. Maybe something in your hyprland config or build is preventing dms from creating the inhibitor? They are, ultimately, overridable by the compositor

bbedward avatar Nov 09 '25 21:11 bbedward

My configs are OK I think.

❯ hyprland --version
Hyprland 0.52.0 built from branch unknown at commit unknown unknown (unknown).
Date: unknown
Tag: unknown, commits: 0

Libraries:
Hyprgraphics: built against 0.3.0, system has 0.3.0
Hyprutils: built against 0.10.1, system has 0.10.1
Hyprcursor: built against 0.1.13, system has 0.1.13
Hyprlang: built against 0.6.3, system has 0.6.3
Aquamarine: built against 0.9.5, system has 0.9.5

no flags were set

colutti avatar Nov 10 '25 06:11 colutti

I meet the same issue these days and I have keep prevent idle for media enabled.

Is there anyway I can do some help?

Recently I just update niri and dms, and I start to use uwsm to manage niri and other apps, is this the reason?

feng-yifan avatar Dec 04 '25 16:12 feng-yifan

I can confirm this issue on my system. Running on NixOS unstable, with Hyprland, and DMS flake install. All up-to-date.

The one other observation I might be able to add is that the dms systemd service does not seem to be present on my system (although explicitely enabled in nix config as per the documentation). Not sure if this might be related.

ernestha avatar Dec 10 '25 10:12 ernestha

Same issue for me - my monitor turns off in 5 minutes per my configuration even though I'll have a video playing in Youtube in Firefox.

I'm using Hyprland.

Image

The output of systemd-inhibit --list:

WHO            UID USER PID  COMM           WHAT  WHY                                       MODE
NetworkManager 0   root 691  NetworkManager sleep NetworkManager needs to turn off networks delay
UPower         0   root 1366 upowerd        sleep Pause device polling                      delay

gerwalk avatar Dec 14 '25 16:12 gerwalk

This feels specific to Hyprland or specific hyprland configurations since I could never reproduce it. I removed the prevent idle for media option entirely since also it feels like Hyprland doesnt respect the inhibitor.

We don't create systemd inhibitors though, we create them via wayland.

bbedward avatar Dec 14 '25 16:12 bbedward

This happens to me as well and I'm using nixos with mangoWC. I tested both firefox and chromium. If I inhibit idle with the idle inhibitor widget then the screen doesn't turn off. My mango configuration is just the default, I only added some binds.

povvke avatar Dec 14 '25 21:12 povvke

This is the fix 848991cf5bfd7edf884bcb36697eca0573f8f344

  • DMS takes the dbus screensaver interface, if nothing else owns it (on niri for example it already handles this, so it will be a no-op there)
  • Firefox and others request screensaver inhibit when playing media, DMS uses this to control the built-in inhibitor it already has (quickshell-git only)

So, it will not work if something else is owning the screensaver interface (you can see in DMS logs some WARN log if it cant take ownership)

Tested on Mango successfully, but its compositor agnostic

bbedward avatar Dec 14 '25 21:12 bbedward

If you do have something else owning the screensaver interface (idk maybe hypridle or swayidle or something like that does it, or a screensaver app). Then you have two options.

  1. Disable it, so DMS can listen to the screensaver inhibit event
  2. Open a bug report with that project so it creates idle inhibitors correctly.

But this is solved, from the DMS perspective.

bbedward avatar Dec 14 '25 22:12 bbedward