@@ -10,18 +10,16 @@ default plugins provided are:
10
10
11
11
1 . Plugin to inhibit sleep while any audio is playing.
12
12
13
- 2 . Plugin to inhibit sleep while [ Plex] ( https://plex.tv/ ) media server is serving
14
- content.
13
+ 2 . Plugins to inhibit sleep while [ Plex] ( https://plex.tv/ ) or
14
+ [ Jellyfin] ( https://jellyfin.org/ ) media server is serving media
15
+ server is serving content.
15
16
16
- 3 . Plugin to inhibit sleep while [ Jellyfin] ( https://jellyfin.org/ ) media server is serving
17
- content.
18
-
19
- 4 . Plugin to inhibit sleep while a specified process is running. I
17
+ 3 . Plugin to inhibit sleep while a specified process is running. I
20
18
use this to prevent sleep while my home backup is running.
21
19
22
20
You can also create your own custom plugins. They are extremely trivial
23
21
to create as can be seen in the [ provided
24
- examples] ( https://github.com/bulletmark/sleep-inhibitor/tree/master /plugins) .
22
+ examples] ( sleep_inhibitor /plugins) .
25
23
A plugin can be created in shell script or any programming language. It
26
24
must simply return an exit code to indicate whether the system should can be
27
25
slept/suspended, or not. _ Sleep-inhibitor_ runs each plugin at the
@@ -31,23 +29,23 @@ inhibit sleep or not until at least the next check period.
31
29
The latest version of this document and code is available at
32
30
https://github.com/bulletmark/sleep-inhibitor .
33
31
34
- :warning : ** Warning** : Unfortunately this program is currently slightly
32
+ :warning : ** Warning** : Unfortunately this program is currently somewhat
35
33
handicapped due to [ this systemd
36
34
issue] ( https://github.com/systemd/systemd/issues/14812 ) . Until this
37
35
issue is addressed, your system may not automatically [ re-] suspend if
38
36
still idle after it has been inhibited, even though _ sleep-inhibitor_
39
37
has removed the inhibit.
40
38
41
- ### Motivation
39
+ ## Motivation
42
40
43
41
When looking for a solution for this issue I found the
44
42
[ autosuspend] ( https://autosuspend.readthedocs.io/en/3.0/index.html )
45
- package but, apart from providing plugins, that package actually
43
+ package but, in addition to providing plugins, that package also
46
44
implements the complete sleep, resume, and wakeup logic. I also found
47
45
the configuration and documentation confusing. I am happy with and
48
- prefer to use the native sleep systems and I desired a simpler more
49
- lightweight approach that merely provided the ability to inhibit sleep
50
- for some special situations.
46
+ prefer to use the native Linux sleep systems and I desired a simpler
47
+ more lightweight approach that merely provided the ability to inhibit
48
+ these sleep systems for some special situations.
51
49
52
50
1 . On Linux desktop systems, I prefer to use the standard GNOME power
53
51
management GUI tools to automatically manage sleep/suspend (via
@@ -67,7 +65,7 @@ inhibit sleep for specified conditions. _Sleep-inhibitor_ uses
67
65
[ ` systemd-inhibit ` ] ( https://www.freedesktop.org/software/systemd/man/systemd-inhibit.html )
68
66
to execute the sleep inhibition lock.
69
67
70
- ### Installation
68
+ ## Installation
71
69
72
70
[ Arch] ( https://www.archlinux.org/ ) users can just install
73
71
[ _ sleep-inhibitor_ from the
@@ -77,50 +75,52 @@ the next Configuration section.
77
75
Python 3.7 or later is required. The 3rd party ruamel.yaml package is
78
76
also required. Note [ _ sleep-inhibitor_ is on
79
77
PyPI] ( https://pypi.org/project/sleep-inhibitor/ ) so just ensure that
80
- ` python3-pip ` and ` python3-wheel ` are installed then type the following
81
- to install (or upgrade):
78
+ [ ` pipx ` ] ( https://pypa.github.io/pipx/ ) is installed then use it to
79
+ install [ ` pipxx ` ] ( https://github.com/bulletmark/pipxx ) :
80
+
81
+ $ pipx install pipxx
82
82
83
- $ sudo pip3 install -U sleep-inhibitor
83
+ Then use ` pipxx ` to install sleep-inhibitor:
84
84
85
- If you want to install it yourself from the source repository:
85
+ $ sudo pipxx install sleep-inhibitor
86
86
87
- $ git clone https://github.com/bulletmark/sleep-inhibitor.git
88
- $ cd sleep-inhibitor
89
- $ sudo pip3 install -U .
87
+ To upgrade:
90
88
91
- To uninstall:
89
+ $ sudo pipxx upgrade sleep-inhibitor
92
90
93
- $ sudo pip3 uninstall sleep-inhibitor
91
+ To remove:
92
+
93
+ $ sudo pipxx uninstall sleep-inhibitor
94
94
95
95
Some plugins require other software to be installed. E.g. If you use the
96
- [ ` plex-media-server ` ] ( https://github.com/bulletmark/sleep-inhibitor/blob/master /plugins/plex-media-server)
96
+ [ ` plex-media-server ` ] ( sleep_inhibitor /plugins/plex-media-server)
97
97
or
98
- [ ` jellyfin-server ` ] ( https://github.com/bulletmark/sleep-inhibitor/blob/master /plugins/jellyfin-server)
98
+ [ ` jellyfin-server ` ] ( sleep_inhibitor /plugins/jellyfin-server)
99
99
plugins then you must install [ ` curl ` ] ( https://curl.se/ ) .
100
100
101
- ### Configuration
101
+ ## Configuration
102
102
103
103
To start, copy the sample
104
- [ ` sleep-inhibitor.conf ` ] ( https://github.com/bulletmark/sleep-inhibitor/blob/master /sleep-inhibitor.conf)
104
+ [ ` sleep-inhibitor.conf ` ] ( sleep_inhibitor /sleep-inhibitor.conf)
105
105
configuration file to ` /etc/sleep-inhibitor.conf ` and then edit the
106
106
sample settings in that target file to add/configure plugins to your
107
107
requirements. The instructions and a description of all configuration
108
108
options are fully documented in the [ sample configuration
109
- file] ( https://github.com/bulletmark/sleep-inhibitor/blob/master /sleep-inhibitor.conf) .
109
+ file] ( sleep_inhibitor /sleep-inhibitor.conf) .
110
110
111
- $ sudo cp /usr/share/ sleep-inhibitor/sleep-inhibitor.conf /etc
111
+ $ sudo cp "$( sleep-inhibitor -P) /sleep-inhibitor.conf" /etc
112
112
$ sudoedit /etc/sleep-inhibitor.conf
113
113
114
- ### Automatic Startup as systemd Service
114
+ ## Automatic Startup as systemd Service
115
115
116
116
If you installed from source or via ` pip ` then copy the included
117
- [ ` sleep-inhibitor.service ` ] ( https://github.com/bulletmark/ sleep-inhibitor/blob/master /sleep-inhibitor.service)
117
+ [ ` sleep-inhibitor.service ` ] ( sleep-/sleep-inhibitor.service )
118
118
to ` /etc/systemd/system/ ` (note that [ Arch] ( https://www.archlinux.org/ )
119
119
users who installed from
120
120
[ AUR] ( https://aur.archlinux.org/packages/sleep-inhibitor ) can skip this
121
121
first step):
122
122
123
- $ sudo cp /usr/share/ sleep-inhibitor/sleep-inhibitor.service /etc/systemd/system/
123
+ $ sudo cp "$( sleep-inhibitor -P) /sleep-inhibitor.service" /etc/systemd/system/
124
124
125
125
Start sleep-indicator and enable it to automatically start at reboot with:
126
126
@@ -135,37 +135,39 @@ To see status and logs:
135
135
$ systemctl status sleep-inhibitor
136
136
$ journalctl -u sleep-inhibitor
137
137
138
- ### Plugins
138
+ ## Plugins
139
139
140
140
To use the [ standard
141
- plugins] ( https://github.com/bulletmark/sleep-inhibitor/tree/master /plugins)
141
+ plugins] ( sleep_inhibitor /plugins)
142
142
distributed with this package just specify the plugin name (i.e. the
143
143
file name) as the ` path ` parameter in the [ configuration
144
- file] ( https://github.com/bulletmark/sleep-inhibitor/blob/master /sleep-inhibitor.conf) .
144
+ file] ( sleep_inhibitor /sleep-inhibitor.conf) .
145
145
To use your own custom plugins, just specify the absolute path to that
146
146
plugin. E.g. you can put your custom plugin at ` /home/user/bin/myplugin `
147
147
and just specify that full path in the [ configuration
148
- file] ( https://github.com/bulletmark/sleep-inhibitor/blob/master /sleep-inhibitor.conf) .
148
+ file] ( sleep_inhibitor /sleep-inhibitor.conf) .
149
149
150
150
A plugin can be any executable script/program which simply returns exit
151
151
code 254 to inhibit suspend, or anything else (usually 0 of course) to
152
152
not suspend. They can be very trivial to create as the provided [ example
153
- plugins] ( https://github.com/bulletmark/sleep-inhibitor/tree/master /plugins)
153
+ plugins] ( sleep_inhibitor /plugins)
154
154
demonstrate. A plugin can be created in any language you prefer such as
155
155
Shell, Python, Ruby, C/C++, etc.
156
156
157
157
The plugin does not normally receive any arguments although you can
158
158
choose to specify arbitrary arguments to any plugin via the configuration
159
159
file, e.g. a sensitive token/password as the example
160
- [ ` plex-media-server ` ] ( https://github.com/bulletmark/sleep-inhibitor/blob/master /plugins/plex-media-server)
160
+ [ ` plex-media-server ` ] ( sleep_inhibitor /plugins/plex-media-server)
161
161
plugin requires, or the process name for the example
162
- [ ` is-process-running ` ] ( https://github.com/bulletmark/sleep-inhibitor/blob/master /plugins/is-process-running)
162
+ [ ` is-process-running ` ] ( sleep_inhibitor /plugins/is-process-running)
163
163
plugin.
164
164
165
- ### Command Line Usage
165
+ ## Command Line Usage
166
+
167
+ Type ` sleep-inhibitor -h ` to view the usage summary:
166
168
167
169
```
168
- usage: sleep-inhibitor [-h] [-c CONFIG] [-p PLUGIN_DIR]
170
+ usage: sleep-inhibitor [-h] [-c CONFIG] [-p PLUGIN_DIR] [-P]
169
171
170
172
Program to run plugins to inhibit system sleep/suspend.
171
173
@@ -175,9 +177,11 @@ options:
175
177
alternative configuration file
176
178
-p PLUGIN_DIR, --plugin-dir PLUGIN_DIR
177
179
alternative plugin dir
180
+ -P, --package-dir just show directory where sample conf/service files,
181
+ and default plugins can be found
178
182
```
179
183
180
- ### License
184
+ ## License
181
185
182
186
Copyright (C) 2020 Mark Blakeney. This program is distributed under the
183
187
terms of the GNU General Public License. This program is free software:
0 commit comments