I am not using any Desktop Environment (GNOME, KDE...)

I am using i3wm and I mapped the alt-shift key to toggle fr,ara keyboard layouts

I want to view (from terminal) the current layout to use it in a bash script to print FR or AR in my i3blocks status bar later

both these commands do not change the output when I change the keyboard layout:

$localectl status
      System Locale: LANG=en_US.UTF-8
          VC Keymap: fr
         X11 Layout: fr,us
          X11 Model: pc104
        X11 Variant: ,dvorak
        X11 Options: grp:alt_shift_toggle

$setxkbmap -query              
rules:      evdev
model:      pc104
layout:     fr,ar
variant:    ,,
options:    grp:alt_shift_toggle

use xkblayout-state

$ xkblayout-state print "Current layout: %s(%e)"
Current layout: us(us)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.