Skip to main content

Kill idle terminal shells after a configurable period of inactivity

Project description

idle-term-killer

Kills terminal shell tabs that have been idle for too long.

A shell tab is killed when its PTY has had no I/O for longer than the configured threshold and it has no running child processes. The idle time is read from /dev/pts/<N> atime — the same source used by the w command. Works with any terminal emulator that forks shell children (xfce4-terminal, gnome-terminal, konsole, alacritty, kitty, etc.).

Install

pip install idle-term-killer

Configure

Create ~/.config/idle-term-killer/config.toml:

[daemon]
idle_time_minutes = 5
check_interval_seconds = 60

# Optional — these are the defaults
[terminals]
emulators = ["xfce4-terminal", "gnome-terminal", "konsole", "xterm", "alacritty", "kitty", "tilix"]
shells = ["zsh", "bash", "sh", "fish", "dash"]

The daemon does nothing and exits cleanly if this file is absent.

Run as a systemd user service

idle-term-killer install

This copies the service file to ~/.config/systemd/user/ and enables it. The service starts automatically on login.

idle-term-killer status     # check service status
idle-term-killer uninstall  # stop and remove the service

One-shot / dry-run

idle-term-killer --dry-run --verbose   # show what would be killed
idle-term-killer                       # kill idle shells once and exit

Requirements

  • Linux (uses /proc and /dev/pts)
  • Python 3.11+
  • psutil

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

idle_term_killer-0.2.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file idle_term_killer-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: idle_term_killer-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for idle_term_killer-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e20b8248b1a72a15a34c120c9aff3286fe40c5997cea4c14fb09b3b08256c3f3
MD5 c0f088943b69434cd30542b9b45829c8
BLAKE2b-256 5f3e24086cc7a5632cb6e76bf0c82ebf551f5003ef1a45981030be381eb43fd8

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