OGS notifier for the i3 window manager (Linux)

Hello All,

I use the i3 window manager under Arch Linux. The i3 window manager’s status bar is managed by a program called i3status. There is an extended version of i3status called py3status that lets you write your own modules for the status bar.

As I’ve had a terrible run of timeouts, mainly due to family and work commitments, I sat down and wrote a module for py3status to notify me of games on OGS where it was my turn to move. So far, it’s working very well for me.

Now, I strongly suspect that the set of people who use i3, py3status, and also play on OGS contains only me, but if anyone else happens to be interested then I’d be happy to share the code.

5 Likes

Link?

FYI I too use i3 under arch, as does @matburt, so there are at least three of us :slight_smile:

1 Like

I knew that I should have kept quiet… :smile:

Well, with the caveat that it’s rough-and-ready code, I’ve uploaded a version here: http://www.pseudonymity.net/~joss/files/ogs/ogs.py

Gratuitous screenshot here.

Assuming that you have py3status working, you’ll need to alter the PLAYER_ID variable on line 11 to your player ID, then drop the ogs.py file into your py3status directory. (That’s ~/.i3/py3status for me.)

If all works well, you’ll get an OGS: <n> readout on your i3bar, which will update every CACHE_TIMEOUT seconds (line 10). The text will be display in your i3bar’s ‘color_good’ colour. If any game has less than 24 hours to go, it will display in ‘color_degraded’. Less than six hours is ‘color_bad’. As such, when you’re playing a realtime game it will probably look like a warning.

Left-clicking on the text will open OGS in Chromium. As I haven’t polished it for other people’s use, the call to open the browser is hardcoded to use ‘chromium --app=http://online-go.com’, which is how I access OGS. That’s on line 35 and can be changed appropriately.

Any other click on the text should refresh the count, although it sometimes seems not to refresh if the network goes away. In that case it will display “OGS: -” in red. You can restart it easily either by restarting i3, or by issuing a ‘killall -USR1 py3status’.

As I said, it’s a little rough at the edges, and I’m far from being an active python hacker. Hopefully I’m not overly abusing the API or making obvious errors with the time remaining calculations.

2 Likes

Awesome :slight_smile:

On a unrelated note, I’m dismayed that your game page looks like the board is overlapping the chat and user - is it always like that on your system?

2 Likes

I had a moment where I thought your dismay was about the move I’d just made, or the horrible state of the game. :smile:

I’ve never noticed that overlap before. I think it was just an artefact of moving the window from a large screen to a small column. (I’m on a two-monitor setup at work at the moment, and had just moved a few windows over so that they all fit neatly into a screenshot.)

I think it might just be that Chromium hadn’t received any input since I moved the window. Tiling window managers are sometimes a bit harsh in how the move windows around, and that can cause problems for window content. I certainly can’t seem to reproduce it now.

Phew! Yeah I too have noticed without focus/input sometimes strange things happen. Glad to know it’s not a common occurrence :slight_smile:

Hey, for the record I’m also using i3.
But I stopped playing correspondance games a few months ago though :wink:

In retrospect, of course Go players are likely to be using i3. They’re Go players. :slight_smile: