Skip to content

helanabi/i3cat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Overview

i3cat makes adding entries to an i3bar status line a breeze!

i3bar is the status bar of the tiling window manager i3.

Examples

Although these examples use i3status for illustration, i3cat doesn'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).

Motivation

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

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)

Installation

  • Download the main script
  • Make it executable: chmod +x i3cat.py
  • Place it in your PATH, e.g. cp i3cat.py ~/.local/bin/i3cat

Exit code

i3cat exits with the same code as the invoked command.

Future improvements

  • Support colors

LICENSE

This project is licensed under the GNU General Public License v3.0 or later.
See the COPYING file for details.

About

A lightweight CLI utility for adding entries to an i3bar status line

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages