I went on a coding frenzy to implement most of the stuff I was not happy with py3status so far. Here comes py3status code name : San Francisco (more photos to come).
I always had the habit of using tabulators to indent my code. @Lujeni pointed out that this is not a PEP8 recommended method and that we should start respecting more of it in the near future. Well, he’s right and I guess it was time to move on so I switched to using spaces and corrected a lot of other coding style stuff which got my code a score going from around -1/10 to around 9.5/10 on pylint !
Threaded modules’ execution
This was the major thing I was not happy with : when a user-written module was executed for injection, the time it took to get its response would cause py3status to stop updating the bar. This means that if you had a database call to make to get some stuff you need displayed on the bar and it took 10 seconds, py3status was sleeping for those 10 seconds to update the bar ! This behavior could cause some delays in the clock ticking for example.
I decided to offload all of the modules’ detection and execution to a thread to solve this problem. To be frank, this also helped to rationalize the code better as well. No more delays and a cleaner handling is what you get, stuff will start appending themselves whatever the time they take to execute !
It was about time the examples available on py3status would also work using python3.
Some cool bugfixes happened since v0.5 and py3status broke the 20 github stars, I hope people are enjoying it.
- clear the user class cache when receiving SIGUSR1
- specify default folder for user defined classes
- fix time transformation thx to @Lujeni
- add Pingdom checks latency example module
- fix issue #2 reported by @Detegr which caused the clock to drift on some use cases
Since the first release of py3status, quite a bunch of bugfixes and features came such as python3 support and SIGUSR1 signal handling to force an update of the bar.
- bugfix : fix delta variable declaration
- examples : add GLPI open tickets counter module example
- python3 compatibility inspired by waaaaargh (Johannes Firlefanz)
- improvement : iterate over user classes in a sorted manner to allow a predictive ordering of outputs
- bugfix : dont fail if i3status output comes slower than py3status message polling interval
- feature : signal SIGUSR1 forces i3status and i3bar refresh, feature request by Michael Schaefer
So I exchanged some mails with Michael Stapelberg of i3wm who rightly pointed out that my initial installation method of py3status was un-pythonic. I was not satisfied of using a bash setup either and I couldn’t imagine a better opportunity to learn how to write a proper setup.py for my project.
Thanks to my Gentoo Linux packager experience, I knew what I had to do, so a few searchs and tests later I’m glad to announce that py3status installation is standard ! I of course also packaged py3status for Gentoo Linux users : meet x11-misc/py3status on my overlay.
py3status being a real command and not a simple python module, I had to find the way to have setuptools taking care of this for me. I was happy to find out that this is pretty easy and that it works on both Linux & Windows, it’s awesome !
I will explain all this in one of my next blog post as I’m sure it can be of interest.
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.
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.
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 ?
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 !