Blog Post

Byobu shows me next meeting

Have I ever told you all how much I love byobu? I have always used screen, though I really never tweaked it all crazy like many did. Recently I typed screen at the command line and I was presented with this thing called byobu. I went ahead and gave it a shot, and at first I will say I was rather annoyed with the bar at the bottom of my screen, and my scrollwheel didn’t work with byobu the way it did with screen. I went ahead and changed my workflow in order to get used to byobu. A couple of weeks ago, I got nosey, and wanted to know how byobu was doing its thing. After a while of messing around, and seeing everything it could display, I wanted more! And since quite a few of you on IRC wanted it, well here it is.

See, I use the cli more than I do the desktop, which is weird seeing as I am an avid KDE lover and hacker. Here is my current workflow via the command line:

With byobu, I have it set up to automatically create 5 windows (the 4 above, plus a regular zsh shell). Since I use the command line so much, I tend to forget about meetings from time-to-time as I don’t get any warning of them, until it is either to late or I have totally missed it. So I thought, since I use the command line so much, how can I have something simple to show me the next meeting. Then I thought: I could use gcalcli to read the Fridge meeting calendar, and then have the next meeting output to the bar in byobu, so I will always see the next meeting. Currently with byobu, it isn’t the easiest thing in the world to add custom items such as this, but I have been told they are coming soon! Awesome!

So, here is what my new addition looks like:

To get this, I had to do the following:
Step 1: Create crontab task
Create a crontab task to create a file in my home directory that contains a list of meetings:

*/5  * * * * gcalcli --nc --ignore-started agenda "`date`" > $HOME/.gcal_agenda.txt

Step 2: Create a script for byobu
Create the following script (/usr/lib/byobu/gcal_agenda) and then make it executable:

if [ "$1" = "--detail" ]; then
        head -2 /home/nixternal/.gcal_agenda.txt | tail -1
        exit 0
GCAL=$(head -2 /home/nixternal/.gcal_agenda.txt | tail -1)
printf "\005{+b }%s\005{-} " "$GCAL"

Step 3: Add a tick to the common profile
In /usr/share/byobu/profiles/common, you need to add the following:

backtick 200    67      67              byobu-status gcal_agenda

Add this line right after the last backtick line you see.

Step 4: Add output to the hardstatus string
We need to add the number 200 that represents our backtick in the previous step to the hardstatus string line in $HOME/.byobu/profile. profile is a symbolic link to the current color profile you are using in bybobu, so if you ever change your theme, you will lose this setting until you add it to the next theme. Here is what my hardstatus string line looks like in $HOME/.byobu/profile:

hardstatus string '%99`%{= kw} %100`%112`%= %102`%101`%200`%127`%114`%115`%108`%128`%125`%126`%113`%119`%117`%116`%106`%104`%103`%105`%107`%123`%120`%121`'

That is all on one line. See the %200 in that line, that is our gcalcli output. That is the one we need to add in there.

Step 5: Make byobu use it
For some reason, byobu didn’t automatically pick up my new script in /usr/lib/byobu, even after reloading (F5), so I added gcal_agenda=1 to $HOME/byobu/status, did a reload (F5), and it was there.

I think this is everything, hopefully I didn’t forget anything. If you try it, and it doesn’t work, let me know.

EDIT: I am a moron, not /var/lib, but /usr/lib. I have made the changes to the post already. Also make sure you have gcalcli up and running with your calendars first. To add the fridge calendar, you subscribe to it from your Google calendar.

EDIT: I redid the last 3 steps because I totally forgot them originally. Thanks to Chris Johnston to pointing this one out!

This entry was posted in Application and tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
  • Archives

%d bloggers like this: