You are not logged in.

#1 2016-01-25 14:28:42

Est
Member
Registered: 2015-08-16
Posts: 28

Keyboard layout change indicator-notification

Hello forum,

WM - Openbox
Panel - Lemonbar

I have (and often change) 3 keyboard layouts. I would like to see a notification on my screen when layout is changed, e.g. "Switched to English/US". I tried to do it via notify-send, but I failed.


Openbox autostart file:

#keyboard
setxkbmap -layout us,ru,ge -variant -option grp:alt_shift_toggle,terminate:ctrl_alt_bksp &

layout.sh

#!/bin/bash

lang=$(setxkbmap -query | grep layout | sed 's/layout.* //g')

if [[ $lang == "ru" ]]
then
    setxkbmap us
    notify-send 'Current Keyboard Layout:' 'US (English)'
elif [[ $lang == "us" ]]
then
    setxkbmap ru
    notify-send 'Current Keyboard Layout:' 'RU (Russian)'
elif [[ $lang == "ge" ]]
then
    setxkbmap us
    notify-send 'Current Keyboard Layout:' 'GE (Geprgian)'

Thank you.

Offline

#2 2016-01-25 14:55:37

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Keyboard layout change indicator-notification

Est wrote:

but I failed.

What do "I failed" mean? What is the issue?

When is the "layout.sh" file used?

Offline

#3 2016-02-16 19:18:22

Est
Member
Registered: 2015-08-16
Posts: 28

Re: Keyboard layout change indicator-notification

drcouzelis wrote:
Est wrote:

but I failed.

What do "I failed" mean? What is the issue?

When is the "layout.sh" file used?

When I'm switching keyboard (Alt + Shift).

Offline

Board footer

Powered by FluxBB