Skip to main content

Suspend processes when X window not visible (i3-wm only)

Project description

FFSuspend

A small script to monitor processes and i3 events in order to SIGSTOP GUI processes when their X windows are not on a visible i3 workspace.

But WHY?!

I'm travelling a lot by train and use that time to work on stuff on my laptop. I tend to keep open some programs, like a browser with some documentation or library reference. However some programs, after being used for a while, tend to consume up to one CPU core just for idling (looking at you, firefox), which significantly lowers battery life and brings me in the uncomfortable situation to have a constantly warm computer on my lap. So instead of tackling the root cause, I went for the easiest route and this script is the result of that.

Dependencies

This is a hacky script that defers much of its functions by parsing the output of some utility programs. These need to be installed for it to work:

  • i3-msg
  • killall
  • ps
  • xdotool
  • xsel

Caveats / Disclaimer

The X clipboard protocol is an IPC protocol that talks to the current owner of the clipboard, whenever its contents is requested. If this process is SIGSTOPed, applications tend to freeze indefinitely, whenever trying to read the clipboard contents.

While there is probably a cleaner solution, FFSuspend has a hacky feature that monitors clipboard contents and skips one cycle of stopping a process, when the clipboard was changed while that process' window was visible. This can be enabled with the -c commandline flag.

There may be other 'interesting' sideeffects when SIGSTOPing processes, so be wary and use at your own risk.

License

FFSuspend is licensed under the GPLv3 or later, see LICENSE.txt.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ffsuspend-0.1.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ffsuspend-0.1-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file ffsuspend-0.1.tar.gz.

File metadata

  • Download URL: ffsuspend-0.1.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.7

File hashes

Hashes for ffsuspend-0.1.tar.gz
Algorithm Hash digest
SHA256 dd27341f64ed40e161c4c109a4e28f806900c00a5c692bda54691ade5101ec25
MD5 c607bf335cb705d9b628ee14be887155
BLAKE2b-256 1bce431f8f4623050893b26dff8dce61a0267a9eb8a7b06ea54de744758abd98

See more details on using hashes here.

File details

Details for the file ffsuspend-0.1-py3-none-any.whl.

File metadata

  • Download URL: ffsuspend-0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.7

File hashes

Hashes for ffsuspend-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2449fe5b328c69821a8f51d555c5aa0cd30808cc54f68eb54ce6e016eae10499
MD5 21b985191c60aa2b7ff4fd007fb32523
BLAKE2b-256 563a36fc19e777d637756a30f0947199afdf03d8e48ed8c486be3c2500aba15e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page