Sunday, 16 May 2010

Remap some kyes

In awesome I left the "Mod4" (Win-key) as modifier, but the keyboard on my laptop has only one suck key. Moreover, there is an useless "Context-Menu" key. Let's remap it to the another Mod4:

Content of .Xmodmap:
keycode 135 = 133

(you can get keycodes from xev)
then add to autostart:
xmodmap ~/.Xmodmap

Wednesday, 5 May 2010

Awesome: keycodes instead of symbols in rc.lua

For people working with two keyboard layouts as me for instance, it always borrows, then an awful.key doesn't work on the second (ru) layout. You could look for the keycodes pressing the keys while xev is running, but I found it slow:

xev &>/tmp/keycodes
...press needed keys...
cat /tmp/keycodes | grep keycode | awk '{print $7 " = \"#" $4 "\""}' | tr -d '),' | uniq
...
PROFIT!

I got:
a = "#38"
b = "#56"
c = "#54"
d = "#40"
e = "#26"
f = "#41"
g = "#42"
h = "#43"
i = "#31"
j = "#44"
k = "#45"
l = "#46"
m = "#58"
n = "#57"
o = "#32"
p = "#33"
q = "#24"
r = "#27"
s = "#39"
t = "#28"
u = "#30"
v = "#55"
w = "#25"
x = "#53"
y = "#29"
z = "#52"

The bindings look like this
awful.key({ modkey }, z, function () awful.util.spawn("ncmpcpp prev") end),
awful.key({ modkey }, x, function () awful.util.spawn("ncmpcpp play") end)
...
and so on