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


No comments:

Post a Comment