...making Linux just a little more fun!

<-- 2c Tips | TAG Index | 1 | 2 | 3 | 4 | 5 | 6 | 7 | Knowledge Base

The Answer Gang

By Jim Dennis, Jason Creighton, Chris G, Karl-Heinz, and... (meet the Gang) ... the Editors of Linux Gazette... and You!



(?) "Tips if you've got some"

From Lew Pitcher

Answered By: Ben Okopnik, Thomas Adam, Karl-Heinz Herrmann, Rick Moen

OK, Here's a quick one for you.
I mostly use Blackbox as my window manager, and it doesn't come with a lot of tools. Often, I need to view a calendar, and since there's no native calendar function for Blackbox, I quickly invented one.
It consists of two parts:
Part 1 is a script that I call ~/bin/Xcal. It displays the results from cal(1) in an xmessage window, and has buttons to move forward and backward through the yearly calendar, and a button to quit the calendar completely.
This script looks like...
  [exec] (Calendar)  {~/bin/Xcal }
And that's it. One click brings up the calendar for the current year. I can move backwards and forwards in it, a year at a time, and dismiss it when I'm done. A simple, straight forward, lightweight solution to my desk calendar requirements.
(!) [Ben] Very nice, Lew!

(?) Thanks. It's a bit rough around the edges, but it works :-)

(!) [Ben] I've just tried it out, and it's quite the nifty gadget. [runs with scissors]

(?) Carefull with those sharp objects. You could cut(1) yourself, and that would hurt.

(!) [Ben]
if [ $I = "do" ]; then I=`ll make -sure to | paste -a BandAid | over -it`
(!) [Ben] I'm sure that I'll be tweaking it in various ways,

(?) Please be my guest. Tweaking is what we do, isn't it?

(!) [Ben] Well, yeah. :)

See attached Xcal-ben.sh.txt

(?) One comment/question

In blackbox, the window controls (i.e. "kill client" or the "x" close button) won't terminate the script. That's because the exit status isn't one of the three in the list.

So, try this tweak...

See attached Xcal-lew2.sh.txt

(!) [Ben] Seems like just changing 'Quit' to '*' should do it - since any option other than 'Next' or 'Prev' should exit.

(?) Yes. I thought of that. The only reason I coded it the way I did was for the convenience of the next 'tweaker'.

If I dropped the "Quit" regex from the case statement, it wouldn't be clear as to how the xmessage Quit option is handled. OTOH, adding a match all ('*') regex gives the next tweaker the clue that there are conditions other than 'Quit' that can (or should) cause the script to exit.

In any case, the next tweaker might decide that the exit status from a WM cancel should be different than the exit status from a 'Quit' button press, and recode the case statement to something like...

See attached Xcal-ben2.sh.txt

(!) [Ben] Note that with the '-default Quit' option, even hitting 'Enter' while Xcal has the focus will cause it to exit.

(?) True, but I didn't try that :-)

I tried clicking the WM 'kill client' decoration instead, and the script didn't exit.

Never overestimate the end user's capabilities. I've learned that in my other life (an 'IT Specialist' for a large Canadian bank, and a specialist in banking application programming). ;-)

(!) [Ben] but the basic functionality is just super all by itself.
Thanks!

(?) You're welcome. I've got lots from you guys, and I'm more than happy to give back.

(!) [Ben] [grin] That's my take on what I do, too. It's one of those good feedback loops - creates good synergy.

(?) [Jimmy] Since you've mentioned calendars, does anyone know of any calendar programs that can deal with recurring events without having to use ical?

My work schedule looks like this:

(Beginning June 6th on week 1 (i.e. I'm on Week 4 now), where the hours are 7.20 [AP]M to 7:50 [PA]M, except for one day)

        Fri  Sat  Sun  Mon  Tue  Wed  Thu
Week 1  PM   PM   PM             AM   AM
Week 2                 PM   PM   PM   PM
Week 3
Week 4  4pm  AM   AM   AM   AM

Is there anything around that can take a simple, text input and show what hours I'm working on a given date? The ical-based calendars mostly work, but most don't really handle overnight events and those that do take too bloody long to set up.

(!) [Thomas] There's the motif-based application: "plan".

(?) [Jimmy] Damn. I meant to say 'console-based'. I might give it a look, even if it does need such an obscure library :)

(!) [Karl-Heinz] plan has a commandline interface for a quick check of appointments and I think even setting.... yes: manpage has plenty of commandline options. Give it a go, but the "gui" is motif based. The whole is in three parts, the plan program, a deamon doing the "alarms" and a notifier popping up the alarm windows. It can also send mail.
(!) [Rick] Compiles with lesstif, too. (Ugly as sin, either way.)
I used to use the clunky old thing at a prior firm. Frankly, I much preferred my PalmPilot.
(!) [Ben] A while ago, I saw a CGI prog that was intended to demonstrate the Palm - and did a pretty darned good job of it, if I recall correctly (it's one of the things that helped me make up my mind about buying one, back when.) Let's see if I can still Google well...
Ah, there it is: Palm-FE
Enjoy.

(?) [Jimmy] Looks cool. Haven't tried it out yet, but calendaring is on the TODO :(


This page edited and maintained by the Editors of Linux Gazette
HTML script maintained by Heather Stern of Starshine Technical Services, https://www.starshine.org/


Each TAG thread Copyright © its authors, 2005

Published in issue 118 of Linux Gazette September 2005

<-- 2c Tips | TAG Index | 1 | 2 | 3 | 4 | 5 | 6 | 7 | Knowledge Base
Tux