How to add a keyboard layout indicator widget in Awesome WM


At first you must install the SKB. Package for Arch Linux are here.
 
Then add to code in rc.lua it lines:
--keyboard layout indicator

function get_layout()
    local filedescriptor = io.popen("skb a")
    local value = filedescriptor:read()
    filedescriptor:close()
    return value
end

keylayout = widget({type = 'textbox', name="keylayout", align = 'right'})


After it you must append "keylayout" to  topwibox[s].widgets

And add hook to last lines of config:
awful.hooks.timer.register(1,  function() keylayout.text = get_layout() end)
where 1 is an update time of the indicator.




Share/Save/Bookmark

1 comment:

Anonymous said...

This is what I need. Thanks!