jump to navigation

Quick shell script to randomly change wallpapers December 27, 2006

Posted by arungoodboy in linux, shell.
comments closed

For no particular reason, I was trying to figure a way to make my wallpaper switch randomly on each startup. After some brief googling around and some experimentation, I came up with this brief script that does the work just nice. (Alright, it may not be the neatest, fastest, or easiest way of doing it, but its the first thing that came in my mind. Hope it helps.)

Well before that here’s the list of assumptions: I use bsetbg for setting the wallpaper. You might want to use fbsetbg, fbsetroot or whatever. Also, I’m picking up the images from a folder in ~/pictures/recent. You might want to change that one too if you want to use the same script. And finally, I use Fluxbox, so I just need to mention this script in Fluxbox’s startup file to make it run each time. You’ll have to do similar stuff depending on your Window Manager, or just run a cron job or something.. So alright, here’s the file:

#!/usr/bin/bash
#randwall.sh: Randomly sets wallpaper each time it’s run

#Count how many images are there in my folder..
WCOUNT=`ls -1 ~/pictures/recent/* | wc -l`;

#Generate a random number within that range..
num=$[ ( $RANDOM % $WCOUNT ) + 1 ];

#Pick up that particular image..
MYPIC=`ls ~/pictures/recent/* |sed -n ‘ ‘$num’p ‘`;

#and set it as the wallpaper!
bsetbg $MYPIC;

Update: I know, I know, I’m a real idiot. I just found out you can do the exact same thing using fbsetbg -r folder-name. Oh well, at least it was useful learning about $RANDOM and all..

Opera 9 is mind blowing December 9, 2006

Posted by arungoodboy in web.
comments closed

I’ve been trying out Opera 9 the past few days, and I have to say I’m very impressed. Check out the size of the binaries in their website, its a meagre 5 MB file. The amount of features they’ve squeezed into that tiny size is just incredible. For starters.. its fast. Just for that one reason alone, I consider it worth the switch. Firefox struggles in my ageing comp, and I usually use Lynx or Dillo for a quick visit to the ‘net. Opera launches in a flash, in comparison.

 Features: Well, lets start with the in-built bittorrent client it has. Click on a torrent file and it gets launched automatically. Some config options are also available, so its a pretty useful feature for the lazy. And then there’s this very impressive mail client. It took me a couple of quick steps to get my gmail set up, and its seriously cool feature-wise. Its got labels, gmail style, isntead of the usual folders, and you can also read newsfeeds from the same place.

The usability features are just amazing. The keybindings are extensive, and I’ve already gotten a few favourites (Shift+Arrow keys to traverse links in a page, F8/F9 to switch to URL bar/page). The mouse gestures are pretty neat too, and work pretty fast unlike what I’d expected. There are the usual search engine keywords as well, I always prefer them to the search bar on top.

Extensions: um, there aren’t any. Perhaps its a good thing in a way, its nice to have different browsers with different featuresets I guess. Among the Firefox extensions I use most often, session-saving, undo-closed-tabs, and adblock are all in-built in Opera. I can live without the gmail manager extension as well, since I’m using Opera’s mail client itself. My biggest concern is that I don’t have the Foxmarks bookmarks sync extension with me now. I’ll probably have to look around for a workaround there. As an alternative to extensions, Opera does have widgets. I personally don’t use them (my window manager (Ion3) gives a full screen for each widget), but I had a look at a few and they were pretty nice.

Summary: I’m sticking with Opera at home, I’ve still not decided about the office. Its a really neat competitor to Firefox, and I should’ve probably tried this a long time back. Apart from very minor problems (its closed source, some people might not like that; some keybindings don’t seem to work at times, etc), Opera 9 has enough features to make it one helluva browser.
P.S. Go to this link after installing Opera, and press F11. Those guys sure think up some neat stuff.

Managing my mess of bookmarks (Part I) December 4, 2006

Posted by arungoodboy in web.
comments closed

I have a huge mess of bookmarks in Firefox, and faced considerable problems a few months back when I needed to sync them across my work and home PCs. In my quest for a decent bookmarking solution, I experimented with some extensions and online solutions. In this post (Part 1), I’ll cover my experiences with the extensions: Google Browser Sync and Foxmarks.

Google Browser Sync: Well, just don’t use this thing. the only reason I did was because it was the first one I’d heard of. My problems started right with installation, where, for some wierd reason, google had allowed the download only in the US and some other countries. So I asked my brother to download the .xpi and mail it across to me.

Apart from syncing your bookmarks, this extension also syncs your browsing history, cookies and passwords. Somehow I wasn’t that comfortable with my home sessions mixing with my work ones! Nor was the fact that google’d be archiving all this information very comforting either. So I turned off all the options except the bookmarks and got to work.

I found that this extension still had lots of work to do. There were far too many problems when it was trying to update a bookmark that I had later moved to some other folder. There were also unnecessary delays whenever I was closing Firefox, when the synchronisation would take place. From start to finish, this was one extension I wasn’t too comfortable using.

Foxmarks: These guys sure got it right. Ever since this was installed, I never had to worry about what was happening. It works unobtrusively in the background, and handles things perfectly. I got an occasional popup when I’d moved an extension to another folder, asking me which location I wanted to be sync’d with.

You’ll need to register in the Foxmarks website to upload your extensions there (which is what I’ve done). Alternatively, you can mention your own server in the options where it will perform the upload.

Foxmarks has effectively solved all my bookmarking worries. I highly recommend it! (I’ll review the online sites that I’d tried in a later post (del.icio.us and Furl))

Slackware custom search using Google Co op December 1, 2006

Posted by arungoodboy in web.
comments closed

I don’t know what rock I’ve been living under, but I just discovered Google’s nice new co-op feature in a Clipmarks page. There’s also a BBC article here.

So… here’s my own attempt: a custom search engine for Slackware specifically, and Linux in general. I’ve also left the ‘contribution’ option open, so if you know of more Slack links that would be useful, you’re welcome to add them.

Emacs bindings in Windows with Xkeymacs December 1, 2006

Posted by arungoodboy in emacs.
comments closed

I’ve been trying to learn GNU Emacs for quite awhile, and while I first started, I needed something to get me used to the bindings (I’d been using vi pretty much exclusively before). That’s when I found Xkeymacs.

Its made for windows, so I use it at office, and the little gem works wonderfully. It sits unobstrusively in the task bar, and gives emacs-style bindings for literally every window running on your desktop. I get a happy satisfaction when I can use Emacs bindings in MS Word: stuff like Alt+D (Delete word), Ctrl+K (Kill line), Ctrl+Space (Start mark)… pretty much everything in Emacs apart from the Alt+x combinations.

xkeymacs

Pretty much everything is configurable, on a per-window and per-binding basis. For example, I’ve disabled it for my Outlook for no particular reason. Also, I use Alt+D pretty frequently in Firefox to reach the URL bar, so that’s disabled too. If you’re going to run a game or something, you can quickly turn the whole thing off with Ctrl+Q.

And to top it all off, it also gives a keyboard layout to remap your keys. As any Emacs user will tell you, the very thing to do is to switch the Ctrl and Caps Lock keys. I very highly recommend this little app to people stuck in a windows box who still like having their Emacs bindings around.