Skip to content

Instantly share code, notes, and snippets.

@fasterthanlime
Created March 26, 2016 12:03
Show Gist options
  • Save fasterthanlime/3a7251a72b28a7ff14d0 to your computer and use it in GitHub Desktop.
Save fasterthanlime/3a7251a72b28a7ff14d0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
layouts = %w(us ch(fr))
current = `setxkbmap -query`.split("\n")[-1].split(':')[-1].strip
next_layout = layouts[(layouts.index(current) + 1) % layouts.size]
`setxkbmap '#{next_layout}'`
`notify-send '#{next_layout}'`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment