22 November 2012

Script for Autokey


Autokey for Linux is an incredibly useful tool for anyone who types several hours a day.


I just did my first script.

Sometimes I need to create text lists, for clarify purposes, like the next one

--------------------------
Q1

--------------------------
Q2

--------------------------
Q3


And then I would fill them.

With this script, you can select the text up to the Q, then run the script from Autokey and it will create the list for you from 0 to 9.


text = clipboard.get_selection()
for x in xrange(10):
    keyboard.send_keys(text+str(x))
    keyboard.send_keys("\n")



If I need more, then I just select the text below and it will create Q10 to Q19. Simple.

--------------------------
Q1

17 November 2012

Using laptop as wake up radio alarm (v2)

I have the laptop connected to an external monitor (VGA).

Using lxrand I can switch off/on any/both of the screens.

The problem is that, sometimes, when I use pm-suspend, the computer enters on a 'kind of suspended mode' from where it cannot get unsuspended (resume). The only choice I have is to do a hard power-off.

I have observed that that does not happen if both screens are on, so I added one more thing to the wake up alarm line, which is getting quite long by the way.


[solution]

#Switch on both screens before suspend
su -c "DISPLAY=:0.0   xrandr --output LVDS --auto"  username



#After suspend, go back to only external monitor
su -c "DISPLAY=:0.0   xrandr --output LVDS --off"  username


What goes in the middle is now

sleep 3; chmod 666 /sys/class/rtc/rtc0/wakealarm ;  echo 0 > /sys/class/rtc/rtc0/wakealarm;   echo `date -d "tomorrow 7:05" +%s` > /sys/class/rtc/rtc0/wakealarm ; pm-suspend; sleep 10 ; grep names /etc/resolv.conf.june.2011 > /etc/resolv.conf ; mplayer-playlist http://yp.shoutcast.com/sbin/tunein-station.pls?id=65456


The grep thing is to update resolv.conf as it gets messed sometimes :o)
Too Cool for Internet Explorer