README.md (1935B)
1 # Suspend Guard for Phosh
2
3 This project is REUSE compliant: https://reuse.software
4
5 ## What does it do?
6
7 Prevent auto-suspend as long as media (audio) is playing, e.g. from your
8 podcast- or music-player.
9
10 Some players (like `lollypop`) have built-in suspend-inhibit, but not all of
11 them have yet (e.g. `gnome-podcasts`) and some probably never will
12 (e.g. `firefox`).
13
14 ## How does it work?
15
16 The `sguard.sh` script checks every X seconds (default: 60), whether sound is
17 playing through any pulse-audio channel. If it is, it will inhibit suspend for
18 the next X+1 seconds, until it checks again.
19
20 ## Are there system requirements?
21
22 Yes, the script uses `pactl`, which is probably installed anyways and
23 `gnome-session-inhibit` which is part of the GNOME desktop and therefore part of
24 phosh.
25
26 ## Wouldn't it be better to check mpris for the current player state?
27
28 Indeed, that would be a _cleaner_ approach, and the script did exactly that
29 for a while. However, it turns out that phosh handles MediaPlayer/mpris events
30 in an odd way, such that it does not report any playing state, when the screen
31 is locked.
32
33 Additionally, some applications do not support mpris and would therefore be
34 unable to trigger the suspend-inhibit.
35
36 ## Use sguard
37
38 Just download this source directory, and run the Makefile:
39
40 ```bash
41 git clone https://src.jayvii.de/pub/pinephone-scripts.git
42 cd pinephone-scripts/sguard
43 make install
44 ```
45
46 This will place `sguard.sh` into `~/.local/bin/sguard.sh` and place the
47 systemd-service file under your user's directory. You can enable & start sguard
48 with:
49
50 ```bash
51 systemctl --user enable sguard --now
52 ```
53
54 ## Maintainer
55
56 - JayVii <jayvii [AT] posteo [DOT] de>
57
58 ## Contribute to sguard
59
60 Simply send a mail to one of the Maintainers, describing your issue(s) and ideally
61 proposing a solution as well :)
62
63 ### Contributors
64
65 - JayVii <jayvii [AT] posteo [DOT] de> (2021)
66 - HazardChem <pthom44 [AT] live [DOT] com [DOT] au> (2021)