Apr22 Weather with rss

I like having weather report on my screen and being quite big fan of Conky I prefer using it. What I want isn’t that much, all I need it temperature and information about whether it’s sunny or not. Kaivalagi has excellent weather script Conky Forecast, it’s really versatile, but bit big for my needs. I used also a weather script which I found in ArchLinux forums. For some reason I thought it might be good idea try to use rss feed. I happened to see site called rssWeather.com mentioned in CrunchBang Forums. Conky has rss variable, but as far I know it only fetches the title. And while title was fine, it told the relevant information, it also had irrelevant stuff (and it’s ugly and takes space). For example this:

London, UNITED KINGDOM Weather :: 16C Mostly clear

Okey it tells the location, but I have fairly narrow Conky and the most important part was almost cut away… And if the actual content is this:

16C Mostly clear

Of course I rather have that. Finding solution was bit tricky (I’m not a script master ;) ). I found nice rss script for conky UbuntuForums, but I had to tweak it bit though to get it show the content instead of title. I opened feed’s source code and checked what xml tags were surrounding the content (<description>content</description>). After this I simply changed following part of script:

sed -e 's/<\/title>/\n/g' |\
grep -o '<title>.*' |\
sed -e 's/<title>//' |\

to this:

sed -e 's/<\/description>/\n/g' |\
grep -o '<description>.*' |\
sed -e 's/<description>//' |\

So instead of the title I get the content. :D Under are the relevant lines in my conkyrc:

City A : ${execi 3600 ~/bin/conky_rss.sh "url_rss" 1 1 }
City B : ${execi 3600 ~/bin/conky_rss.sh "url_rss" 1 1 }

This fetches the weather from two cities every hour and first number “1” tells how many articles you want to be shown from the feed. I don’t know meaning of the second “1” but, if it was “0” it didn’t work. Replace the url_rss with the feed you wish.

This is how it looks like on my desktop:

Sep25 Scrot in Openbox menu

Scrot is a simple but quite powerful command line screenshot tool. I have been using it now sometime already and it is a lot more versatile than for example gnome-screenshot. I wanted to make it little easier to use for me and decided to add my most used commands in Openbox menu. Of course first thing is to install Scrot. If you are using Ubuntu, just install it thru Synaptic Package Manager or type in terminal:

sudo aptitude install scrot

Adding the Scrot in Openbox menu

If you are new to Openbox, I recommend reading for example these:

* menu tutorial
* Openbox guide – urukrama’s weblog (especially “4. Configuring Openbox”)

So open the menu.xml -file (~/.config/openbox/menu.xml) in your favourite editor (for example gedit or Leafpad). Dot in front of config means it’s hidden, so you have to enable showing hidden folders/files if you look for it in your file browser (ctrl+h). Or you could type in terminal:

leafpad ~/.config/openbox/menu.xml

From my menu.xml -file:

<menu id="scrot" label="Scrot">
	<item label="Scrot (PrtSc)">
		<action name="Execute">
			<execute>
				scrot -e 'mv $f ~/images/screenshots/'
			</execute>
		</action>
	</item>
	<item label="delay 15">
		<action name="Execute">
			<execute>
				scrot -d 15 -e 'mv $f ~/images/screenshots/'
			</execute>
		</action>
	</item>
	<item label="Scrot area (Alt-PrtSc)">
		<action name="Execute">
			<execute>
				scrot -s -e 'mv $f ~/images/screenshots/'
			</execute>
		</action>
	</item>
</menu>

The first option takes screenshot immediately, second one has 15 seconds delay and with third one you can select the area (using the mouse) of the screen.

I have also set keybinding for each alternative (more about keybindings). This you can do by editing rc.xml -file (~/.config/openbox/rc.xml).

<keybind key="Print">
      <action name="Execute">
        <execute>scrot -e 'mv $f ~/images/screenshots/'</execute>
      </action>
    </keybind>
    <keybind key="A-Print">
      <action name="Execute">
        <execute>scrot -s -e 'mv $f ~/images/screenshots/'</execute>
      </action>
    </keybind>
    <keybind key="C-Print">
      <action name="Execute">
        <execute>scrot -d 15 -e 'mv $f ~/images/screenshots/'</execute>
      </action>
</keybind>

More about scrot options in scrot man page (you can access in man also by typing in terminal man scrot).