SHARE
TWEET

keyboard_widget_awesome

helenaryuu Dec 12th, 2012 624 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---{{{ Keyboard widget
  2. kbdcfg = {}
  3. kbdcfg.cmd = "setxkbmap"
  4.  
  5. --list your own keyboard layouts here
  6. kbdcfg.layout = { "us","es","gb", "latam" }
  7.  
  8. kbdcfg.current = 1
  9. kbdcfg.widget = widget({ type = "textbox", align = "right" })
  10. kbdcfg.widget.text = " " .. kbdcfg.layout[kbdcfg.current] .. " "
  11. kbdcfg.switch = function ()
  12.     kbdcfg.current = kbdcfg.current % #(kbdcfg.layout) + 1
  13.     local t = " " .. kbdcfg.layout[kbdcfg.current] .. " "
  14.     kbdcfg.widget.text = t
  15.     os.execute( kbdcfg.cmd .. t )
  16. end
  17.  
  18. kbdcfg.widget:buttons(awful.util.table.join(
  19.     awful.button({ }, 1, function () kbdcfg.switch() end)
  20. ))
  21. ---}}}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top