Skip to content
Permalink
Newer
Older
100644 123 lines (93 sloc) 4.01 KB
Dec 11, 2017
1
XSuspender
2
==========
3
[![Build Status](https://travis-ci.org/kernc/xsuspender.svg?branch=master)](https://travis-ci.org/kernc/xsuspender)
4
5
Automatically suspend inactive X11 applications.
6
7
Find a better maintained description here: https://kernc.github.io/xsuspender/
8
9
When an application window loses focus, XSuspender tries to match it to
10
one of the rules in its configuration. If a match is found, the
11
application is sent a SIGSTOP signal (preventing the process from obtaining
12
further CPU time). Upon windows regaining focus, the process is seamlessly
13
continued where it had left off.
14
15
#### Advantages
16
17
* **Reduce battery use (increase battery run-time).**
18
Make your laptop run on battery for as long as your mobile phone does,
19
using roughly the same technique.
20
* **Reduce interaction latency on low-end CPUs.**
21
With fewer clients requesting processing power, there's more of it to go
22
around where it's needed.
23
* **Reduce CPU fan noise.**
24
Save the tinnitus for old age.
25
* **Avoid apps plotting stuff behind your back.**
26
That Kali you're running in a VM is perfectly fine, but god
27
only knows what Microsoft Windos is doing.
28
* **Suspend processes using well-known Unix signals SIGSTOP & SIGCONT ...**
29
... or custom shell scripts. Decades of portable operating systems
30
engineering at its finest.
31
* **Preconfigured for recent versions of popular software.**
32
Chromium, Firefox, JetBrains IDEs, qBittorrent, VirtualBox ...
33
34
#### Quirks
35
36
* Quirky. See [Notes] below.
37
* May prevent suspended windows from redrawing until re-gaining focus.
38
* May make your web downloads stall and your in-browser media
39
playback stop if you configure it thus.
40
* Prevents pasting from clipboard while the selection source process
41
is suspended
42
([explanation](https://unix.stackexchange.com/questions/316715/xclip-works-differently-in-interactive-and-non-interactive-shells/316890#316890)).
43
* Relies on windows having their `_NET_WM_PID` hint set correctly.
44
* Won't work in remote X sessions.
45
* Won't work with Wayland.
46
47
48
Installation
49
------------
50
51
#### Binary packages
52
53
Install binary package for your GNU/Linux distribution:
54
55
[![Binary packages](doc/distros.svg)](https://software.opensuse.org//download.html?project=home%3Akernc%3Axsuspender&package=xsuspender)
56
57
Dec 11, 2017
58
#### From Source
59
60
```bash
61
# Install build dependencies, namely GLib and Libwnck
62
sudo apt install libglib2.0-dev \
63
libwnck-3-dev \
64
make cmake gcc pkg-config
65
```
66
67
```bash
68
# Fetch a copy of the source code
69
git clone https://github.com/kernc/xsuspender
70
cd xsuspender
71
72
# Move to build directory for an out-of-tree build
73
cd build
74
75
# Configure and make
76
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ..
77
make
78
make test
79
80
# Install within chosen prefix
81
sudo make install
82
```
83
84
Usage
85
-----
86
For brief usage instructions, run:
87
88
```bash
89
xsuspender --help
90
```
91
92
#### Configuration debugging
93
94
To have it print verbose debug messages about what it is doing, run the
95
program with environmental variable `G_MESSAGES_DEBUG=all` set:
96
97
G_MESSAGES_DEBUG=all xsuspender
98
99
This is _strongly recommended_ to confirm your customized configuration
100
rules indeed work as you expect.
101
102
If xsuspender is auto run by your X session manager, you might find clues
103
to its unexpected behavior in _~/.xsession-errors_.
104
105
Notes
106
-----
107
[Notes]: #notes
108
109
* Processes that take a long time to shut down after their window already
110
disappears may be stopped in the middle of their termination routines.
111
Avoid with reasonably generous `suspend_delay`.
112
* Windows that minimize to system tray need to be awaken frequently to
113
respond to click events in a seamless manner.
114
* Don't configure xsuspender for software you want to keep continuously alive
115
in the background, such as music players, daemons, IM clients ... If you
116
frequently stream music from YouTube, you might give
117
[Clementine], [Minitube], [YouTube Viewer] or [SMTube] a try.
Dec 11, 2017
118
119
[Clementine]: https://www.clementine-player.org
120
[Minitube]: https://flavio.tordini.org/minitube
121
[YouTube Viewer]: https://github.com/trizen/youtube-viewer
122
[SMTube]: https://www.smtube.org
You can’t perform that action at this time.