Giter VIP home page Giter VIP logo

py9status's Introduction

py9status

an i3bar status line in python 3.

A minimalistic alternative to i3status, i3blocks or py3status. Each element of the status line is a Python class with a basic interface, polled by a controller class. Configuration is done by editing the entry point python code directly (and intuitively). This is much in the spirit of XMonad, except with fewer catamorphisms.

The emphasis is on total user control and code transparency. This application is geared toward those willing and able to program python to configure it.

configuring dispay style

To override the display style of a unit, write a class inheriting from it and override the format method. Details below.

A good place to do this would be in your local run_py9s.py file.

writing a new unit

To add a new unit, derive the PY9Unit class and override the three core methods:

  • read
  • format and, optionally,
  • handle_click

read takes no argument and produces a dict of output values. This dict will be processed by the format method. It is recommended to document the output well, following the convention in the example units.

format takes the dict output by read and outputs a string, with pango formatting, to be displayed on the statusline. For well written units, the documentation should document read's output, and format should be overwritable without delving into read's inner workings.

handle_click is called when the unit's output block is clicked on the status line. handle_click takes a dict corresponding to a click event (according to the i3bar JSON API) and returns nothing. Use your imagination.

controlling display style

In addition to in-string display styles and colours, which are controlled by unit.format, global styles conforming to the i3bar JSON API can be set in three ways, in increasing order of precedence:

    1. at the instantiation of the PY9Status controller in run_py9s.py by passing an i3 API-conformant style dict to the chunk_kwargs kwarg. This will be applied to all units.
    1. on a per-unit basis through the unit.permanent_overrides dict. When the unit's output is read, the style will be updated with these parameters.
    1. on a per-unit basis through the unit.transient_overrides dict. Each time the unit's output is read, the style will be updated with these parameters, and this dictionary will be cleared by the control loop.

Installation

    1. put py9core.py and py9s_default_units.py in your PYTHONPATH. pip install --user on this repo is the best way to achieve this.
    1. put a copy of run_py9s.py in your PATH and configure i3 to run it with status_command run_py9s.py in your config. For the default units to work out of the box, enable pango formatting.
    1. edit run_py9s.py to configure the output. Important entries to change are the network and drive names.

py9status's People

Contributors

qdbp avatar jeff-cai avatar ffatghub avatar

Stargazers

 avatar 大関 金城 秀喜 カシオ avatar

Watchers

James Cloos avatar  avatar

Forkers

jeff-cai

py9status's Issues

Change style

Perhaps make sets of style changes to be included in default installation?

Ideas:

  • Default (current setup)
  • Legacy (emulates i3 appearance)
  • User (if I want to make my own and not edit default)

default units need click functionality

Many of the default units could be improved by adding click functionality. Some ideas:

  • toggle between rates and total rx/tx for PY3Net on click
  • toggle to uptime in PY3Time on click

Handle `unit.name` conflicts

Currently having units with shared names in the initialization list leads to buggy undefined behaviour. This needs to be addressed.

Py9Wireless unit is failing

Unit shows as failing. (unit "PY9Wireless" failed)

I suspect it is because line 38 in py9wifi.py is old and no longer regex matches output in iw

38 info = sbp.check_output(["iw", "dev", self.wlan_if, "info"])

my output:

.:[19:23:09]:. ~ % iw dev wlp4s0 info
Interface wlp4s0
ifindex 3
wdev 0x1
addr e4:a7:a0:c6:ab:b5
type managed
wiphy 0
channel 149 (5745 MHz), width: 80 MHz, center1: 5775 MHz
txpower 22.00 dBm
multicast TXQ:
qsz-byt qsz-pkt flows drops marks overlmt hashcol tx-bytes tx-packets
0 0 0 0 0 0 0 0 0

However when trying to make changes locally I still can't figure out the fix.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.