2

Is there a way to show a (notify-osd) notification every time the keyboard layout is changed?

I have a laptop with a screen with not enough resolution to have tons/10+ indicators, and space for the title bar of windows, and I want to eliminate the keyboard indicator required when you have multiple keyboards.

I'm using Unity on 13.04.

2
  • It's possible to show notifications. I also had in mind changing the launcher color, because notifications are easy to miss. Would you still be interested in such solution ? – Sergiy Kolodyazhnyy May 17 '16 at 18:23
  • @Serg Unfortunately, I have moved on from Ubuntu to Arch, and the tiny 4:3 laptop has been relegated to dumb terminal duty (it does admirably). I also completely abandoned using different keyboard layouts because it's annoying, and switched to just using a compose key. – Yet Another User May 21 '16 at 1:35
1

I wrote a script called notify-kbd-layout.sh and symlinked it to /usr/bin: sudo ln -s ./notify-kbd-layout.sh /usr/bin/notify-kbd-layout

Obligatory source code:

if [ "$(xset -q | grep -A 0 'LED' | cut -c59-67)" = '00000000' ] 
  then
  notify-send 'Current Keyboard Layout:' 'US (English)'
fi
if [ "$(xset -q | grep -A 0 'LED' | cut -c59-67)" = '00001000' ]
  then
  notify-send 'Current Keyboard Layout:' 'CMS (French)'
fi

Then, I went into Settings>Keyboard>Shortcuts>Custom, and added a shortcut for ALT+Shift to run notify-kbd-layout.

2
  • 1
    Could you please explain the different commands? I have 3 different layouts and xset -q | grep -A 0 'LED' | cut -c59-67) always return the same number., 00000000. To be honest, it gave me a different value (`'00000002') only the first time I executed it, still don't know why. – tigerjack89 May 17 '16 at 18:25
  • @tigerjack89 I have no idea how it works anymore. Try explainshell.com – Yet Another User May 21 '16 at 1:33
0

You do not say if you use unity or something else. I use cairo-dock, and I stick not so often used icons in a sub-dock to save space. Cairo-dock also has extensions such as has a notification-area and notification-area-old which capture several indicators (dropbox, WiFi, keyboard) in one icon. Clicking on the icon gives the usual results. I don't use this because with the current theme the composite icon is half transparent and not very visible.

2

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.