Last active
December 13, 2015 10:14
-
-
Save riccardosven/a357daf787168cb1fbd2 to your computer and use it in GitHub Desktop.
Lua function to change keyboard layout.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function () | |
-- Rotate keyboards table, | |
-- requires a global variable called keyboards with the layouts listed, | |
-- e.g. keyboards = {'dvorak','us','us dvorak-intl'} | |
table.insert(keyboards,table.remove(keyboards,1)) | |
-- Extract first layout | |
local new_layout = keyboards[1] | |
-- Set keymap to chosen layout | |
awful.util.spawn("setxkbmap "..new_layout) | |
-- Optional notification of new layout | |
naughty.notify({preset = naughty.config.presets.normal, | |
font = "monospace 10", | |
screen = mouse.screen, | |
text = "KB: "..new_layout, | |
timeout = 1}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment