Bitcoin donations are welcome:14snQXeLcnJtWUduKZ6rC2MHdPYrYar1Tw

Wednesday, June 29, 2011

Mediakeys for spotify in Linux

There is two ways of doing this.

1.) Native Spotify player for Linux (requires Unlimited or Premium)
Create spotify-control containing this (credits go to this allenap):

#!/usr/bin/env python

import dbus
import sys

if __name__ == '__main__':
    session = dbus.SessionBus.get_session()
    spotify = session.get_object(
        "org.mpris.MediaPlayer2.spotify",
        "/org/mpris/MediaPlayer2")
    for command in sys.argv[1:]:
        getattr(spotify, command)()

su
chmod 755 spotify-control

Next, put the file into i.e. /usr/bin/
Now you got a cmd way of controling your spotify player.. spotify-control Previous, spotify-control Next and spotify-control PlayPause...

If you are using fluxbox as I am, add the following to your ~/.fluxbox/keys

# Spotify
Mod4 Right :Exec $(spotify-control Next)
Mod4 Left :Exec $(spotify-control Previous)
Mod4 space :Exec $(spotify-control PlayPause)

Save, "reconfigure" (or restart fluxbox), and you are done..
Now you can use your windows button + Right/Left for Next/Previous or Space to pause :)


2.) If you are using spotify via wine..
This way is a bit more "unslick" and nasty.. But it works..
You do it the same way, except you use the following script located here..

Saturday, June 18, 2011

Add temperature to conky

After some recent debian updates, the proc files which conky got it's temperatures from disappeared. I found a way though to work around this, and get the temp into conky.

1.) First, open your console.
2.) Type acpi -t. This way you will see which sensors you can grab the temperatures from. You will get an output looking something like this:
Thermal 0: ok, 55.0 degrees C
Thermal 1: ok, 35.4 degrees C
Thermal 2: ok, 50.0 degrees C
Thermal 3: ok, 58.0 degrees C
Thermal 4: active, 60.0 degrees C
3.) Decide which thermal sensor you want the temperature from. In my case I found out the cpu was "Thermal 3". Now we are gonna sort out this line.
4.) Type: acpi -t | grep "Thermal 3". You should now get only the Thermal 3 line. So far so good. Now we need to sort out only the temperature, using "cut".
5.) Type: acpi -t | grep "Thermal 3" | cut -c16-19. The -c- might be different from you. Adjust it so you now get an output displaying ONLY the temperature.
6.) When you've made the correct command line, add it to your conkyrc like this:

${execi 1 acpi -t | grep "Thermal 3" | cut -c16-19}C

Laptop running warm and noisy fans

After some years of use my laptop started getting really warm when the work load increased. As a result of the heat, the fans also started making a lot of noise. This problem did not exist when I got it, or the first years..

The cause was pretty obvious. Dust and dirt had piled up inside my laptop, and especially on the fan(s). My laptop only have 1 fan, so I went straight for it. Following the service manual for my computer (hp nx7400) I removed the keyboard, and the fan came to sight.

Next I got the vacuum cleaner. Yep, that's right, the good ol' vacuum cleaner. It might be an idea to add a thinner tip on it while doing this. I didn't though. Next, the clue is to hold the fan so it wont spin when vacuum cleaning it. If you dont the fan might ending up spinning backwards, which could break it. While holding the fan, clean it thoroughly until it's dust free.. Next clean any heatsinks and other visible dust.

Now reassemble, and hopefully it should not run warm that easy, and the fans shouldn't spin up all the time! At least it worked great for me!