Thursday, February 14, 2013

Create archive from folder in Thunar on XFCE

OK this should be easy as Thunar comes with the thunar-archive-plugin installed on Debian Wheezy, which I'm using, but when you right click on a folder and select the Create archive option, you get a directory menu, and if you select the directory you're already in, the plugin will open the folder you want to archive, instead of creating an archive in the same directory. This seems to be a bug.

Interestingly, in Crunchbang (which uses the same plugin version, but from its own repository) if you do the same thing, the expected result happens: an archive of the folder and contents is created in the same directory. I suppose a patch must have been applied in Crunchbang.

There is an alternative method, which I found on XFCE Docs: add a custom action.
Name: Create tar.gz from folder
Command: tar czvf %n.tar.gz %n
File pattern: *
Appears if selection contains: Directories

Sunday, February 10, 2013

HP Deskjet 3050 j610 on Crunchbang Waldorf

My printer works well with the latest version of HPLIP available on Debian Testing (Wheezy). I've installed it with ease in a Gnome environment and in XFCE, so I was rather surprised to find that it didn't work in Crunchbang Waldorf, which is based on Wheezy.

After several hours Goolgling, I found the problem: not all the required dependencies of HPLIP are installed in Waldorf, and the required user permissions are not set.

To check if HPLIP is set up correctly, run:
sudo hp-check -t
If there are unmet dependencies or permission issues, run the required fix to install and add automatically.

My symptoms were:

Could see printer in System>Printers>Configure Printers but not use.
Could see printer in device setup HPLIP gui (hp-toolbox) but not install.
Could install printer via hp-setup as root, but could not print from inside web pages (could print a text file) and could not administer printer from Device Manager.

Install QuodLibet on Crunchbang Waldorf

Quod Libet is my favourite music player, and I wanted to install it on Crunchbang, but I noticed the install was going to bring a cascade of unwanted dependencies, including a second CD burner application, Brasero.

The problem is described here, and I found a solution (modified) here.
sudo apt-get --no-install-recommends install quodlibet quodlibet-plugins
This installs Quod Libet without the unnecessary recommended dependencies.

The panel icon for Quod Libet is black and does not work well with the dark panel in Cruncbang. I have replaced the icon with one developed for the Faenza theme by ~poupoul2.

The notification icon uses the .svg icon supplied, but the panel needs an .png icon. I created my own.

New icons go in /usr/share/pyshared/quodlibet/images/.

Update: Icons can also go in the active icon theme. For me, the Panel > 22 folder.

Check GMail script for Conky on Crunchbang Waldorf

I'm trying out Crunchbang Waldorf. I found a script for Crunchbang Statler (the previous version) that displayed the number of my new GMail messages in my Conky desktop display, but it didn't work with Waldorf. I was looking around for a simple and efficient script and eventually found one that works on the Arch Linux forum.

 I modified it a little not to show the number of emails on the server, just the number of new emails.
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import sys, imaplib

port = 993
server = ''

username = ''
passwd = 'password'

imap_server = imaplib.IMAP4_SSL(server, port)
    imap_server.login(username, passwd)
    print('?? new')
    sys.exit( 1 )

typ, data = ('Inbox', True)
if typ == 'OK':
    total = int(data[0])
    typ, data = (None, 'SEEN')
    if typ == 'OK':
        seen = len(data[0].split())
        print('{} new'.format(total - seen))

if typ != 'OK':
    print('?? new')

 Credit: rockin turtle.

Monday, February 4, 2013

How to lubricate a laptop CPU fan

My laptop fan was blowing a lot so I reckoned it was time to clean it. When I had finished, the fan was grinding, and unlike on previous occasions when the grinding has settled down, this time it didn't seem to want to stop.

It's an old laptop, in computer years, and it has been left running all day and sometimes all night for many days in those years, so I reckon that it might be time to replace the fan, except that it's a rebranded Taiwanese model with generic components, and a replacement doesn't seem to be available.

Googling the problem suggested it is possible to dismantle a fan and lubricate the shaft, but on my laptop the fan is integrated into the body of the heatsink, and it wasn't possible to put a screw driver under the body of the fan to pop it off.


I decided to try drastic measures and squirted some WD40 round the underside of the base of the fan. On starting the laptop, the grinding had gone, but I began to wonder if WD40 had been a good idea.

I consulted Google again, and what I found was a good example of the value of the internet: everything from wisdom to shite. Isaac Azimov wrote science fiction stories about a computer called Multivac that could answer any question from a terminal in the home. Today we have Google, which can answer any question from a terminal in the home. Unfortunately, you don't get one true answer, you get 10,000,000 answers, ranging from best understanding that current knowledge allows, to utter stupidity.

Some of the better advice: WD40 is actually a water dispersant and not a lubricant. A silicone oil or sewing machine oil would be a better choice. I'd go with that, if you actually have access to the shaft to apply it.

Some of the worst: spray WD40 into the heat sink grill to clean it. This is face-palm bad advice. WD40 is a penetrating and cleaning agent. It will penetrate the gap between the heat sink and the CPU and clean it of thermal conductive agent, to disastrous effect, and penetrate capacitors and other components and have completely unpredictable effects.

What exactly is WD40?  Modern science has the answer. Most of it is volatile hydrocarbon that is useful as a penetrating agent, or a water dispersant, or a solvent. The remainder is mineral oil, of various thickness.

Some advice says that WD40 will have no lubricating effect after a few days; some says the thick, non-volatile mineral oil residue will seize the fan; some says that it works.

So, is WD40 a good idea for laptop fans? I'm going with the empirical answer, which seems to be yes. It seems to work. Of course I'll have to wait and see, but I'm pretty sure the volatile hydrocarbons have evaporated, and the fan is working as new. I'm not sure whether this is due to the cleaning effect of the lighter components of WD40, or the lubricating effects of the heavier.

It could be worth a try, if you have a fan at the end of its lifetime that you can't disassemble. Try at your own risk of course.