Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Pause playback when machine is locked #2687

Open
eriqs opened this issue Aug 4, 2017 · 10 comments
Open

Feature Request: Pause playback when machine is locked #2687

eriqs opened this issue Aug 4, 2017 · 10 comments

Comments

@eriqs
Copy link

eriqs commented Aug 4, 2017

OS:
Windows 10

Issue Descriptions:
Feature Request: Pause playback when machine is locked

Steps to Reproduce:
I love the app, thank you! The one thing I don't like is that it doesn't have the option to pause playback when my computer is locked, like other similar apps I have used. I use this at work, and always lock my computer when I walk away so I would like to have the music pause when I do this, and resume when I return - rather than needing to pause and resume it manually. Thank you again for the excellent app!

@jostrander
Copy link
Collaborator

There really is no formal API for this in electron as far as I can tell. So we can't reliably add this.

@eriqs
Copy link
Author

eriqs commented Aug 7, 2017 via email

@MarshallOfSound
Copy link
Owner

@jostrander It's not that there's no formal way to do it in Electron, I don't think there's a way to do it on all platforms.

I think macOS fires a sleep event, which doesn't exactly equal lock, and windows might fire a window message to the top level window we might be able to read, but on linux it's entirely up to the WM what to tell the windows and when 🤔

Something to offload to a magical native module I feel, I'll take a look in chromium though and see if they've done the hard work for us.

@flippinger
Copy link

Any way to do this via Windows task scheduler? At least there is a trigger "on workstation lock".

image

@Kytech
Copy link

Kytech commented Aug 11, 2017

This can be implemented in Windows through the System Media Transport Controls, though we'd have to work out the double skip issue that is currently unresolved. (See this PR)

@JasonLG1979
Copy link

On Linux it can be accomplished over DBus.

@liamdawson
Copy link

I think macOS fires a sleep event

High Sierra supports locking without sleep, so that method won't work in all cases.

@IndefiniteBen
Copy link

@Kytech Yes please. Music control during connected standby is just about the only thing making me wish for a native Windows store version of GPM.

@tuur29
Copy link

tuur29 commented Nov 16, 2018

I made a very quick nodeJS script that uses the Playback API: https://github.com/tuur29/scripts/blob/master/pauseGPMDP.js

@JasonLG1979
Copy link

JasonLG1979 commented Nov 17, 2018

I would think the builtin powerMonitor electron API would be what you'd want to use primarily although for Linux as powerMonitor does not appear to support screen lock events you'd still need DBus for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants