Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[ SOLVED ] Debian 11 Gnome - youtube plays at login screen on suspend resume

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
remus
Posts: 85
Joined: 2008-06-03 02:39

[ SOLVED ] Debian 11 Gnome - youtube plays at login screen on suspend resume

#1 Post by remus »

As the title states...

I load up a youtube video in Brave OR Firefox web browser and start playing video

Close the laptop lid which initiates a suspend.

system suspends

open laptop lid and press power button

laptop resumes from suspend at login prompt AND the youtube video starts playing behind the login screen, as I can hear the sound...

Expected behaviour is that youtube video does NOT start playing behind the login screen.

System us fully up to date.

Any suggestions ?
Last edited by remus on 2021-11-29 16:12, edited 1 time in total.

User avatar
canci
Global Moderator
Global Moderator
Posts: 2502
Joined: 2006-09-24 11:28
Has thanked: 136 times
Been thanked: 136 times

Re: Debian 11 Gnome - youtube plays at login screen on suspend resume

#2 Post by canci »

I don't think this sort of behaviour is possible with every desktop environment on Linux. Maybe Gnome, KDE and Cinnamon have such a feature, but even then, maybe only with certain browsers. So, if you're using a window manager or small desktops like Xfce, LXDE, etc., don't expect that feature to be there. I'm not sure how this works, but I imagine both the desktop's power manager and the browser have to support technologies like MPRIS or similar in order for the desktop to tell browsers to shut up. I imagine that it might work with Firefox and Chrome-based browsers.

Here's a link where someone built the solution themselves:
https://saveman71.com/2019/automatic-pa ... nux-mpris/

Looks like fun :)
Image Stable / Asus VivoBook X421DA / AMD Ryzen 7 3700U / Radeon Vega Mobile Gfx (Picasso) / 8 GB RAM / 512GB NVMe

READ THIS:

* How to Post a Thread Here
* Other Tips and Great Resources

User avatar
sunrat
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 462 times

Re: Debian 11 Gnome - youtube plays at login screen on suspend resume

#3 Post by sunrat »

Maybe stop the video before you close the lid. :P
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

remus
Posts: 85
Joined: 2008-06-03 02:39

Re: Debian 11 Gnome - youtube plays at login screen on suspend resume

#4 Post by remus »

Thanks for the input.

This seems like a privacy issue imo.

I'll look into MPRIS and the link you posted

remus
Posts: 85
Joined: 2008-06-03 02:39

[ SOLUTION ] Debian 11 Gnome - youtube plays at login screen on suspend resume

#5 Post by remus »

The following solution causes my system to pause youtube playing in Brave browser when I resume to lock screen from suspend. Youtube resumes after a successful login. Apparently the pause-on-lock script + playerctl application also does the same for other music playing software, but I have not tested further.

I've patched this together from several points of reference.

This is probably not the best way to do it, feel free to suggest improvements.

# Install playerctl
sudo apt install playerctl

# Create playerctld systemd unit file
sudo nano /etc/systemd/system/playerctld.service

# Add the following to it
[Unit]
Description=Start playerctld daemon
After=default.target
[Service]
ExecStart=playerctld daemon
[Install]
WantedBy=default.target

# Set playerctld.service to autostart
sudo systemctl enable playerctld.service

# Download pause-on-lock script to
cd ~/Downloads ; curl -LJO https://raw.githubusercontent.com/folix ... se-on-lock

# Install the script
sudo install ~/Downloads/pause-on-lock /usr/local/bin/

# Create gnome autostart file
sudo nano ~/.config/autostart/pause-on-lock.desktop

# Add the following to it
[Desktop Entry]
Type=Application
Exec=pause-on-lock -c
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name=pause-on-lock

# Reboot - Any open files need saving first ?
sudo reboot

# TEST : Active lock screen or suspend system to test. Expected behaviour : Media should pause on suspend or lock screen, and resume after successful login.

# References
https://github.com/folixg/pause-on-lock
https://askubuntu.com/questions/919054/ ... ng-systemd
https://gist.github.com/jwebcat/5122366
https://www.linuxuprising.com/2019/08/p ... n-and.html
https://www.digitalocean.com/community/ ... unit-files
https://www.freedesktop.org/software/sy ... .unit.html

Post Reply