Meet py3status

This is the first public release of one of my open-source projects, don’t hesitate to share some feedback and/or thoughts with me.

Background

As a sysadmin, I haveΒ a lot of consoles open on multiples desktops and my 30″ screen was still not enough to cover my needs. To make things short, I needed to spare every pixel I could and KDE was really frustrating me as it was wasting a lot of space and ran quite a bunch of useless stuff in the background (akonadi/nepomuk anyone ?).

Then came my cyclic rage about it and I finally found my preciousΒ : i3wm. I just love it as it is what I ever needed : a lightweight yet very functional and handy WM.

  • No more resizing my consoles to fit next to each other and I can still use floating windows for the needed applications.
  • No more huge and pixel-hungry task bar, just a simple and very efficient one.

customization

The problem when you start using something new and awesome is that you get a lot of ideas on what you could do with it and how you’d love to customize it. I mean, when using KDE or Gnome, your ideas are quickly shaped by the fact that you’d have to learn some exotic framework or language to implement them.

  • Did you ever ask yourself how to add your own stuff in your task bar on KDE or Gnome ?
  • What if the customization options you want are not available in your WM menus ?

Well, my answer was “never mind” tbh and I slowly even lost the idea of implementing anything on my task bar.

i3bar & i3status

After switching to i3wm, my first customization was to name my workspaces and setup my own colors to adjust the look & feel of my desktop. Then I started to tune the program responsible for displaying useful information on my bar : i3status. As you may know, you have some limited modules which can take care of displaying some useful information on your bar such as the free disk space on a disk partition or your wired/wireless network status.

But then I asked myself the same questions as I used to on my KDE days : what if I want more ? my own stuff on my task bar ?

Introducing py3status

Thanks to the i3bar open and simple protocol and the robust (even if somewhat limited) i3statusΒ program, I could finally hack into my bar. Naturally, I had to do it myself and there was a few examples available on the net but nothing really handy and extensible enough. That’s how I had the idea of developping py3status !

philosophy & goals

  • no extra configuration file needed
  • rely on i3status and its existing configuration as much as possible
  • be extensible, it must be easy for users to add their own stuff/output by writing a simple python class which will be loaded and executed dynamically
  • add some built-in enhancement/transformation of basic i3status modules output

available now on github

I’m glad to announce that I pushed it today on github ! You can start using py3status now and give your feedback. I hope this project will help users get more of their i3wm environment and encourage their hacking power !

Join the Conversation

16 Comments

  1. Thanks for this πŸ™‚ I really like the flexibility of py3status! However I would have one feature request. Then original i3status allows me to “killall -s USR1 i3status” in order to force a redraw of the status bar instantaniously. This currently doesn’t work in py3status, right? I have looked inside the code but I do not understand it enough to implement this feature myself because I do not see where the redraw is triggered. Would it be possible for you to implement this feature?

    1. Hi Michael, thanks for you kind words πŸ™‚

      When py3status starts, it spawns a i3status process in a separate thread (you can see it with a “pstree”) so this means that you really have a i3status process running and the “killall -s USR1 i3status” will still work.
      However, py3status tries to read i3status’ output every INTERVAL seconds (specified by the py3status -n option, 1sec default) so after forcing a refresh of i3status you would need to wait at most INTERVAL seconds before py3status shows it your bar. This could sound okay if you have a 1 second INTERVAL but could be a problem for longer intervals indeed.

      I will try to implement a USR1 signal handling on py3status which will trigger a USR1 signal for its i3status child AND forces a refresh whatever the INTERVAL. So you’d just have to USR1 py3status and it will handle i3status + refresh instantly for you. I hope this will answer fully your feature request πŸ™‚

      I’ll reply here when it’s done, thanks again for your interest.

        1. Hello Michael,

          I’m glad to announce py3status v0.5 featuring the SIGUSR1 behavior you asked and I explained earlier. Enjoy πŸ˜‰

  2. This is looking great, so I gave it a try… Somehow I’m failing somewhere.
    I followed all your steps, looked in the i3 docs to be sure.
    I end up with an empty bar.

    Hoping you can help…

    1. Okay… I tried the i3status command in my terminal it’s returning an error:

      Unknown output format: “i3bar”

      That is weird… so something is wrong with my i3 I guess.

        1. Thanks for the fast reply!

          I’ve got a bit further. I’m running Lubuntu and it seems the repo’s were not updated with the newest i3. So right away the bar had different colors at the reinstall.

          Still can’t get it to work though. I have copied your conf…

          1. i3status outputs JSON means it works now. Does py3status now works as well ?

            As for the examples, the most straightforward way to do so is :
            – create a .i3/py3status/ folder in your home directory
            – copy the module you want to use from the examples directory of the py3status sources to the .i3/py3status/

            Reload i3 (mod+shift+R)

          2. Yes! I got it. Thank you very much for your help. Very easy actually. I had to install requests via pip also. I’m still kind of new to Linux and I keep learning things every day.

            So far it’s looking great. This will give me some inspiration to up my Python skills.

            Thanks for the help and py3status of course. I will mos def spread the news.

            PS. Really like your pics.

          3. Great news, I’m glad you’re enjoying it (thx also for the pics)

            Don’t hesitate to join the #py3status channel on FreeNode IRC if you need help or simply want to hang around and share your experience πŸ˜‰

            Have fun

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.