XSUSPENDER(1)
π xsuspender(1) β like, the whole manual, bestie
okay so real talk: this is the manual page for xsuspender, from the General Commands Manual section. it's a command-line program, it's iconic, and by the end of this page you're gonna get it fr fr. π«Ά
β¨ NAME β¨
xsuspender β auto-suspend inactive X11 applications
like... it puts your apps to sleep when you're not looking at them. no cap.
π¦ SYNOPSIS π¦
xsuspender
that's it. that's the whole invocation. she's low-maintenance. π
πΈ DESCRIPTION πΈ
okay so picture this: modern desktop GUI apps can use up a significant amount of system resources β CPU time and everything β just by sitting there idly running. like they're not even doing anything and they're still eating your CPU?? the audacity. π
XSuspender handles that. it respects your (very expressive) configuration and moderates those applications so they suspend all activity shortly after their windows lose focus. how? by sending them the Unix signal SIGSTOP. (or by executing a custom script β see the exec_suspend key down in CONFIGURATION π). then when the application window gets focus back, XSuspender sends it SIGCONT and it resumes execution exactly where it left off. slay.
the payoff is genuinely real: significant reduction in CPU use, which prolongs battery run-time (5-500%; subject to your own computing habits, bestie), reduces CPU fan noise π, and stops resource-hogging applications from plotting stuff behind your back β at least while you're not actively using them. main character energy for your laptop tbh.
buuut the method also has its share of drawbacks. see BUGS below. π
β¨ OPTIONS β¨
the program is mainly run without arguments. she knows what to do.
-h,--helpβ print short help and exit. that's the whole list, we love a minimal queen π
π ENVIRONMENT π
G_MESSAGES_DEBUGβ setG_MESSAGES_DEBUG=xsuspenderand the program will report debug messages about its activity to standard error. extremely useful, iykyk π₯XDG_CONFIG_HOMEβ if it's set, this is the directory where thexsuspender.confconfiguration file can be found. if it's missing, this location defaults to~/.config.
π FILES π
~/.config/xsuspender.confβ the configuration file the program reads.$XDG_CONFIG_HOME/xsuspender.confβ alternative configuration file, used when that variable is set.share/doc/xsuspender/examples/xsuspender.confβ example configuration file shipped with the program. go peek, it's giving tutorial π¦etc/xdg/autostart/xsuspender.desktopβ a desktop session auto-start launcher. disabled by default. to enable it, copy it into the~/.config/autostartdirectory (or$XDG_CONFIG_HOME/autostartwhere applicable) and edit it, settingHidden=false. alternatively, you may be able to enable it via the session application auto-start manager. your call bestie β¨
π CONFIGURATION π
the configuration key-value file is in INI format. notice, please and thank you:
- the file must be encoded in UTF-8
- comments follow the
#character - section and key names are case-sensitive (so don't get cute with the caps)
the file should contain a [Default] section which all other sections inherit and override on a per-key basis. very inheritance, very chic.
each non-[Default] section constitutes a rule that XSuspender will try to match and follow. sections can define the following keys (listed with their built-in default values, if any):
match_wm_name_contains,match_wm_class_contains,match_wm_class_group_containsβ these keys order xsuspender to apply the rule only to windows that contain the verbatim value string in theirWM_NAMEandWM_CLASSwindow manager hints. when multiple matching keys are specified, their logical conjunction (intersection) applies β meaning yes, all of them gotta match. to find applicable values, run:
xprop -notype WM_NAME WM_CLASS
and click on the window of interest. class group is the second string in the WM_CLASS atom. iykyk π
suspend_delay = 10β integer seconds to wait after the window loses focus before suspending it. setting a reasonable value avoids suspending processes too early during rapid task switching (we all alt-tab like maniacs, it's fine). if you set this value too low, upon process termination the process may stall in its termination routine if it hasn't been able to finish in time. and since we're unable to detect this β yeah β best give your processes ample time. be generous, she deserves it π«Άresume_every = 50β resume the suspended process every this many integer seconds to have it do (some of) its backlog of work. little stretch break, love that for them β¨resume_for = 5β resume the suspended process only for this long before suspending it again. blink and it's back to sleep π΄only_on_battery = trueβ apply the rule only when on battery power. you may wish to set this tofalsefor hopelessly annoying processes such as virtual machines running Windos. (their spelling, not mine π)auto_suspend_on_battery = trueβ if true, automatically apply this rule when switching to batter power, even if the matching window didn't just lose focus (but lost it some time before). yes the original says "batter". we respect the typo πsuspend_subtree_patternβ extended regular expression. if provided, when XSuspender suspends a process, it will also suspend all its descendant processes (children, grandchildren etc.) whose command-line string matches the pattern. set it to.to match and kill all descendants. this setting only applies whensend_signalsis also true.exec_suspend,exec_resumeβ before suspending / resuming the process, execute the string as a command-line shell script. if the script execution is successful (exit status0), proceed with process suspension, otherwise abort it. (process resumption is never aborted.) the executed script gets passed via the environment the following variables:PID(process id),XID(X11 window id of the triggering window), andWM_NAME(window title). you can use these keys to control suspension of your processes or disjoint components thereof in a custom way. in this case, you may also find thesend_signalskey to be of use. very DIY, very build-a-bear π§send_signals = trueβ if true, XSuspender kills the matching process withSIGSTOP/SIGCONTUnix signals. if false, XSuspender sends no signals of its own, deferring to customexec_suspendandexec_resumescripts to do the work. you're in charge now πdownclock_on_battery = 0β set to greater than zero to decrease the CPU time allotted to the matching process when running on battery power. for every one time slice running, the process sleeps for this many slices. thus, a value1decreases the CPU consumption of the process by 50%, a value of2by 66%, a value of N by N/(N+1)%, and so on. a value of0disables downclocking. this is a separate, stand-alone mechanism that limits CPU consumption of β also and in particular β focused windows. math ate, ngl π₯
π BUGS π
the following limitations and quirks are known (read this part, bestie, it matters):
- don't configure XSuspender for software you want to keep continuously alive in the background, such as music players and daemons. if you suspend IM clients, wake them up frequently (configuration key
resume_every) so they can process their queued network events. if you like to stream music from YouTube or similar, you might want to exempt your browser from suspension, or consider using a lighter-weight native client, such as Musictube. π΅ - windows that minimize to system tray, such as torrent and IM clients, need to be resumed frequently to respond to tray icon click events in a seamless manner. no one likes a laggy tray icon π
- pasting from clipboard is prevented while the selection source process is suspended. mitigate by using a clipboard manager that takes ownership of the selection. (this one bites people, fr fr.)
- suspended windows might not redraw until regaining focus. if something covers them, expect visual artifacts. that's just how it is π
- mouse-wheel scrolling might not work in suspended windows. they require keyboard input focus to resume.
- processes that take a long time to shut down after their window already disappears may be stopped in the middle of their termination routines. avoid with a reasonably generous
suspend_delay. β οΈ - XSuspender won't work in remote X sessions.
- XSuspender won't work with Wayland. (sorry wayland girlies π)
please raise any further bugs and ideas on the project's GitHub issue tracker. we love feedback π«Ά
π EXAMPLE π
here's an example configuration section for VirtualBox β steal it, it's cute:
# This is a comment.
[Default]
suspend_delay = 10
resume_every = 50
resume_for = 5
only_on_battery = true
auto_suspend_on_battery = true
send_signals = true
# Rule name is an alphanumeric string.
# Rule VirtualBox inherits from Default rule
[VirtualBox]
match_wm_class_contains = VirtualBox
# VirtualBox suspension is managed by VBoxManage utility.
send_signals = false
# We get the VM UUID via its process command line.
# NOTE: Unlike in this example, the whole script should be
# on a single line.
exec_suspend = VBoxManage controlvm "$(ps -o args= -q $PID | \
sed -E 's/.*--startvm ([a-f0-9-]+).*/\1/')" pause
exec_resume = VBoxManage controlvm "$(ps -o args= -q $PID | \
sed -E 's/.*--startvm ([a-f0-9-]+).*/\1/')" resume
find further examples in the example configuration file accompanying this distribution (see section FILES above). β¨
and to debug your configuration rules, run this:
G_MESSAGES_DEBUG=xsuspender xsuspender
honestly that one command will save you so much time. you're welcome π
π¦ SEE ALSO π¦
kill(1), xprop(1), regex(7), signal(7)
okay that's the whole page, you made it to the end!! π this has been xsuspender(1) from the General Commands Manual, dated 2017-12-13 β yes she's an older icon but she still serves. go suspend something, have fun, hydrate, and remember: don't suspend your music player π
β¨π
π¦ where this page comes from
- nixpkgs unstable: xsuspender 1.3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms