DSwain- The New Day

Tuesday, March 28, 2006

Having Fun W/Gnome and Jamboree

So I managed to get my main computer up and running pretty well. It works, but xfce4-svn was giving me problems, and xfce4 just doesn't tickle my fancy after the svn magic. In light of this, I decided to take Gnome for a spin since 2.14 is on the Arch repo's now. I must say, for a first note; Gnome is really showing its power now with this new release. Memory usage has been dropped for me by over half, and the system is simply snappy now. I am quite happy, to say the least.

At any rate, I'm still a person of simplicity. Bulky applications and such just don't work for me. The king of them being iTunes. I just simply cannot admire that program. I guess it works for some, but not for me. Things like smart playlists and libraries of music are great concepts, but not worth the overhead which iTunes provides. There's a few alternatives on Linux to iTunes. Things like Rhythmbox, Banshee, and Armorak come to mind for most. I discovered a nice jewel myself called Jamboree. It gives all the little neat things you could want in a program like this (smart playlists, music library) and does what it's suppose to (open, play music, close) without failing and also happens to be very small.

While this is fine and all, there's one thing I would have appreciated for it: A system tray icon for it. Searching for one a little bit resulted in me finding out what I knew, which was that there isn't any. I decided to have a little fun and tune up my scripting skills and create my own controller. My end result looks something like this:



First, I started by figuring out how I could control the program in an easy manner. If you explore with the CLI a little bit, you'll find that Jamboree (along with many other Gnome apps I discovered on my little project) you can control it via the CLI very easily. Just what we needed in this case, also. Borrowing a little example from the people at IBM (here) I wrote myself up a script to handle the controls via the CLI. My script turned out like this:
jam_on() {
jamboree
exit 0
}

jam_off() {
jamboree -q
exit 0
}

jam_tog() {
jamboree -t
exit 0
}

jam_next() {
jamboree -n
exit 0
}

jam_prev() {
jamboree -p
}
if [ -z $1 ]; then
jam_on
fi
case "$1" in
on)
jam_on
;;
off)
jam_off
;;
tog)
jam_tog
;;
next)
jam_next
;;
previous)
jam_prev
;;
esac

Simple and quick, but it's enough to call the script and then give it an argument to follow the function. Essentially, this takes the commands like this:

jam_control $ARG1

Where the variable $ARG1 is simply on, off, previous, next, or tog. Also, the script checks for is the argument is a null statement, then it simply runs the program again. So, if it's running, nothing will happen and if it isn't running, the program will open up.

if [ -z $1 ]; then
jam_on
fi

So, now that's tested and working, the next thing I had to accomplish was to make it actually graphical and useful in this case. At first my thought was to make it work like a system tray icon where I could click on it and get a list of things to do. Since I realized this was out of my scope of work or work ethic at that, I needed something more simple than that. My next thought was making just icons for it, but obviously that would be too confusing to keep track of and cluttered. I realized then I could make it real quick and easy like the script also if I borrowed some already created things. Jamboree has its icon stash (on Arch Linux) stored in /opt/gnome/share/jamboree . Easily enough, I created three buttons (Previous/Next/Play&Pause) and used the actual icons from Jamboree on the tool bar. Each button just points to the location of the script and gives the particular argument needed. The end result is what you see above, working in perfect order. So, if you're looking for a quick button fix or something to do, here's a way to do it.

Yeah okay I get it. Me=Nerd. Peace out.

-dswain

0 Comments:

Post a Comment

<< Home