You are not logged in.
Pages: 1
Hi!
I'm trying to make a widget for awesome what shows the current keyboard layout by
setxkbmap -print | grep xkb_symbols | sed 's|.*+\([^"]\+\)+inet(.*|\1|'
which returns "ee" or "us" (estonian and us). The problem is it just doesn't show it (because I don't know lua properly).
Anyway here is my widget code what I tried to do:
-- Language
language_widget = widget({
type = "textbox",
name = "language_widget",
align = "right"
})
wicked.register(language_widget, "function", function (widgets, args)
local cmd = "setxkbmap -print | grep xkb_symbols | sed 's|.*+\([^\"]\\+\\)+inet(.*|\\1|\'"
local f = io.popen(cmd)
local l = f:read()
f:close()
return string.find(l)
end, 1);
Could someone help me out?
Offline
Hi, even if this is not the one you were going, a way is to go trough awesome-client, i.e.
1- create a textbox as you were already doing
language_widget = widget({
type = "textbox",
name = "language_widget",
})
2- put it wherever you want by placing it in the correct order in the wibox for, right after the clock maybe
-- Add widgets to the wibox - order matters
mywibox[s].widgets = { mylauncher,
mytaglist[s],
mytasklist[s],
mypromptbox[s],
gmailbox,
mytextbox,
language_widget,
mylayoutbox[s],
s == 1 and mysystray or nil }
mywibox[s].screen = s
end
3) put in a script something like
echo language_widget.text = \" $(setxkbmap -print | grep xkb_symbols | sed 's|.*+\([^"]\+\)+inet(.*|\1|') \" | awesome-client
Hope it helps
Federico
Last edited by vaquerito (2008-12-11 10:23:29)
Offline
Pages: 1