Thursday, December 25, 2008

Umlauts on the US keyboard with xmodmap

I'm totally dependent on my US layout keyboards, both on my stationary PC and my laptop because it proved to be my preferable way of coding, mainly because the majority of symbols used in most programming languages are easily accessible, sometimes even without the need for modifier keys (e.g. '{','}','\' and most of all '/'). Once I've tried the British English layout (back when I had the C1 'picture book' of Sony) which wasn't bad either and had some interesting ideas ('"' reachable via SHIFT+2) but it didn't convince me to make a full change.
I actually can even get used to QUERTZ-layouted keyboards (like the German or Swiss one) and other, non-coding-friendly QUERTY-layouts (like the Spanish one) quite fast because I get to use them from time to time when I use (read: fix) a friend's or family members' computer. But still, the US layout is my prefered choice and I wouldn't want to miss it on my own devices which was, by the way, one reason why I imported my last laptop from the states.
Nonetheless, every once in a while I need to use symbols like umlauts or the German eszett (ß) in order to write emails properly. That's why I'm using a couple of xmodmap rules to add that functionality in a convenient way: Umlauts are mapped to the ALT key and the corresponding vowel (e.g. ALT+u=ü), the same applies for the eszett (ALT+s=ß). My old rules stopped working some when because the keycode for the ALT key changed and thus interfered with other keys (in my case with the cursor keys). This is my current script which I'm using on X.org 1.5.2:

keycode 108 = Mode_switch
keycode 20 = minus underscore ssharp
keycode 34 = bracketleft braceleft udiaeresis Udiaeresis
keycode 47 = semicolon colon odiaeresis Odiaeresis
keycode 48 = apostrophe quotedbl adiaeresis Adiaeresis
keycode 26 = e E EuroSign EuroSign e E
keycode 30 = u U udiaeresis Udiaeresis u U
keycode 32 = o O odiaeresis Odiaeresis o O
keycode 38 = a A adiaeresis Adiaeresis a A
keycode 39 = s S ssharp ssharp s S

Labels: ,


Friday, December 5, 2008

create packages of E17 themes

Before the repository revamp there were packages for E17 themes in the repository on debian.alphagemini.org; they were based on a BASH script which fetched the themes listed on get-e.org. Now that get-e.org is gone, E17 themes can be found on exchange.enlightenment.org along with a whole lot of desktop wallpapers, 3rd party applications and modules. That's why I felt it was time for writing a new script, this time in python. It basically does the same, with less BASHish temp files, sed, grep or wget usage. To use it, simply run it in an empty directory as a normal user (no privileges are required) and run dpkg-buildpackage in the resulting folder. It can be downloaded here.

I've uploaded the packages to my repository, including the virtual package e17-themes which installs all available themes.

Currently included themes:

e17-theme-apple-17 - The Apple 17 theme for E17
e17-theme-baroque - The Baroque theme for E17
e17-theme-black-chrome - The Black Chrome theme for E17
e17-theme-blingbling - The BlingBling theme for E17
e17-theme-bloody-imago - The Bloody Imago theme for E17
e17-theme-blue-eyed-theme - The Blue Eyed Theme theme for E17
e17-theme-camou - The Camou theme for E17
e17-theme-cerium - The Cerium theme for E17
e17-theme-chrome - The Chrome theme for E17
e17-theme-clearlooks - The Clearlooks theme for E17
e17-theme-crema - The Crema theme for E17
e17-theme-crude - The Crude theme for E17
e17-theme-cthulhain - The Cthulhain theme for E17
e17-theme-dali - The Dali theme for E17
e17-theme-darkness - The Darkness theme for E17
e17-theme-darkrevolution - The Darkrevolution theme for E17
e17-theme-darkside - The Darkside theme for E17
e17-theme-dukes - The Dukes theme for E17
e17-theme-edjy - The Edjy theme for E17
e17-theme-fireball - The Fireball theme for E17
e17-theme-gant - The Gant theme for E17
e17-theme-grunge - The Grunge theme for E17
e17-theme-iceball - The Iceball theme for E17
e17-theme-imago - The Imago theme for E17
e17-theme-japan2007 - The Japan2007 theme for E17
e17-theme-kor - The Kor theme for E17
e17-theme-night-bling - The Night Bling theme for E17
e17-theme-nyz - The nyz theme for E17
e17-theme-pinkapple - The PinkApple theme for E17
e17-theme-purewm - The PureWM theme for E17
e17-theme-siro - The Siro theme for E17
e17-theme-smoke - The Smoke theme for E17
e17-theme-steampunk - The Steampunk theme for E17
e17-theme-winter - The Winter theme for E17
e17-theme-xliquid - The XLiquid theme for E17

Labels: , ,


Monday, December 1, 2008

classic template tag cloud

Since I'm hosting this blog on my own server I'm not able to use the blogger's new "Layouts customization" and thus can't display these fancy tag clouds which usually appear in the sidebar. However, I've found some solutions which add labels functionality to classic blogger templates, the most flexible of which seem to be using a PHP script which can be used in the template. So I've modified the script found on this blog, fixing a minor bug and adding two new features. First, the script now takes care of the actual amount of tagged articles under a certain label which can optionally be displayed next to the label (check the second source code snippet and uncomment the appropriate lines):

if(preg_match("/\/labels\//", $_SERVER['PHP_SELF'])) {
$files[$file] = substr_count(
file_get_contents($file),'<!-- End .post -->');
} else {
$files[$file] = substr_count(
file_get_contents(PREFIX.$file),'<!-- End .post -->');
}

Second, result pages invoked from links in the label cloud now correctly link to other results by conditionally removing the prefix to the label directory:

if(preg_match("/\/labels\//", $_SERVER['PHP_SELF'])) {
$output .= "<a style=\"".
get_style($low_end, $high_end, $size) . "\"".
"href=\"". htmlentities($name)."\">".
# Uncomment the next and comment the following line in order
# to display the number of posts for each given label.
#htmlentities(str_replace('.html','',$name))."(".$size.")</a> ";
htmlentities(str_replace('.html','',$name))."</a> ";
} else {
$output .= "<a style=\"".
get_style($low_end, $high_end, $size) . "\" ".
"href=\"".PREFIX. htmlentities($name)."\">".
# Uncomment the next and comment the following line in order
# to display the number of posts for each given label.
#htmlentities(str_replace('.html','',$name))."(".$size.")</a> ";
htmlentities(str_replace('.html','',$name))."</a> ";
}

The complete file can be downloaded here. Follow these steps to set it up and running:
  1. Copy the script to the root folder of your blog.
  2. Modify the SEARCH_DIR define in line 4 to suit your setup.
  3. Create a directory called cloudtemp in the ./labels directory of your root folder:
    # mkdir labels/cloudtemp
  4. Add the directive
    AddType application/x-httpd-php .html
    to your VirtualHost file, e.g. to the section.
  5. Reload your apache server:
    # /etc/init.d/apache2 reload
  6. If you'd like to display the number of related articles in brakets behind the label's name just follow the directives in lines 52 and 60.

Labels: , ,