i3cat makes adding entries to an i3bar status line a breeze!
i3bar is the status bar of the tiling window manager i3.
Although these examples use i3status for illustration,
i3catdoesn't make any assumptions about how you generate your status line.
- Add static text
i3status | i3cat echo "Just do it!"
- Add command output
i3status | i3cat whoami
- Add multiple entries
i3status | i3cat whoami | i3cat date +'%A' | i3cat echo "Go for it!"
- Insert in a specific position
i3status | i3cat --position=3 whoami
- Throttle commands
i3status | i3cat --interval=60 curl ifconfig.me
if your status generator (e.g. i3status) updates every 5 seconds, this will re-run the command (i.e. curl ifconfig.me) every 5 minutes (5s * 60).
i3cat is a lightweight self-contained script that intercepts i3bar's JSON protocol to inject entries as efficiently as possible, by avoiding invocation of multiple external processes that would be necessary in a shell script e.g. sed -> jq -> sed.
usage: i3cat [-h] [-i N] [-p N] CMD [ARG ...]
Inject command output into i3bar status line
positional arguments:
CMD command to generate text for new entry
ARG optional command arguments
options:
-h, --help show this help message and exit
-i, --interval N Run CMD every N status updates (default: 1)
-p, --position N 0-based position for new entry (default: 0)
- Download the main script
- Make it executable:
chmod +x i3cat.py - Place it in your PATH, e.g.
cp i3cat.py ~/.local/bin/i3cat
i3cat exits with the same code as the invoked command.
- Support colors
This project is licensed under the GNU General Public License v3.0 or later.
See the COPYING file for details.