Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Keyboard layout widget
- function kbd ()
- local lts = {[0] = "EN", [1] = "RU"}
- local kbdwidget = widget({type = "textbox", name = "kbdwidget"})
- local maketext = function (idx)
- return "<span font_desc=\"Terminus Bold 10\" color=\"" .. beautiful.bg_normal .. "\">"..lts[idx].."</span>"
- end
- kbdwidget.border_color = beautiful.fg_normal
- kbdwidget.bg = beautiful.fg_normal
- kbdwidget.width = 20
- kbdwidget.align = "center"
- kbdwidget.text = maketext(0)
- dbus.request_name("session", "ru.gentoo.kbdd")
- dbus.add_match("session", "interface='ru.gentoo.kbdd',member='layoutChanged'")
- dbus.add_signal("ru.gentoo.kbdd", function(...)
- local data = {...}
- local layout = data[2]
- kbdwidget.text = maketext(layout)
- end)
- return kbdwidget
- end
Advertisement
Add Comment
Please, Sign In to add comment