3

Q: how do I keep EMMS from allowing my laptop to go to sleep?

I use EMMS to play music files. When I've got a long playlist going, I expect it to keep my laptop awake and continue working through the playlist, even when I'm not otherwise interacting with my laptop.

However: my laptop still falls asleep at its regularly scheduled time if I don't touch it. It seems to be the case that the laptop reaches the "go to sleep after X minutes" mark that I've set, finishes whatever track EMMS is currently playing, and then goes to sleep. It then begins the next track on the playlist immediately after it wakes up.

I'd like to have continuous play without needing to intervene. Currently, I have to tap a key or jiggle the trackpad every 15 minutes or so to prevent the sleep, which is obviously silly. How do I get continuous play and have EMMS prevent the laptop from sleeping?

FWIW: this is a problem on laptops with Linux (Fedora, Ubuntu) and OSX.

Dan
  • 32,584
  • 6
  • 98
  • 168
  • I think you could try sending `Resuming` signal: http://upower.freedesktop.org/docs/UPower.html though I didn't try it. – wvxvw Dec 14 '15 at 21:15
  • For the ubuntu-case you could install [x11-xserver-utils](https://packages.ubuntu.com/artful/x11-xserver-utils) and paste the following lisp code into your init file: `(defun xset-dpms-off () (call-process "xset" nil nil nil "-dpms")) (defun xset-dpms-on () (call-process "xset" nil nil nil "+dpms")) (add-hook 'emms-player-started-hook #'xset-dpms-off) (add-hook 'emms-player-finished-hook #'xset-dpms-on)` After restart of emacs emms controls the display power management. I think this also prevents the notebook from going to sleep. But, I am not sure about that... – Tobias Feb 27 '18 at 23:38
  • ... I think the idle time re-starts after switching dpms on. Therefore, the short breaks between two tracks should not cause the laptop to fall asleep. If the laptop falls asleep nevertheless we could do an experiment: Temporarily remove the hooks, call `(xset-dpms-off)` manually, and play the playlist. If the notebook remains awake then `xset-dpms-off` helps in principle and we only need to test whether there is a non-nil `(emms-playlist-next-noerror)` in `emms-player-finished-hook`. That is some work but feasible. – Tobias Feb 27 '18 at 23:49

0 Answers0