You are not logged in.
Hi there,
I use the following config to enable keyboard layout toggle:
~ cat /etc/X11/xorg.conf.d/00-keyboard.conf
# Read and parsed by systemd-localed. It's probably wise not to edit this file
# manually too freely.
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "us,de"
Option "XkbModel" "pc104"
Option "XkbVariant" ""
Option "XkbOptions" "grp:sclk_toggle"
EndSectionThe only thing I miss is a libnotify (OSD) notification when pressing the respective key to toggle between layouts.
Do you have an idea how to call a libnotify command on keyboard trigger?
Thanks ahead!
Last edited by orschiro (2014-07-23 08:34:32)
Offline
I'm not sure it can be done.
I think people usually incorporate statusbar (xmobar, dzen, ...) which polls keyboard layout on bar refresh and display current value.
You can switch layout by writing a script and hook to you window manager, which is obvious solution but it's not the one handled by XKB itself.
I went with writing a simple script, also because I have a couple of XKB options which for some reason gets reset everytime I re-attach keyboard (also on wakeup from suspend).
Also I've found it not ideal to hook it to libnotify, well depends on what daemon you use to actually display it... I've found it's not playing well since usually things like change of layout, change of volume, I want to see immediately.
Usually libnotify daemons will wait to clear output area before outputting new input, so e.g., repeatedly switching layout would not "react" immediately.
I separated these. Libnotify (for genuine notifications e.g., mail got synced etc.) handled by twmn. And for OSD, I use libaosd (actually libaosd-xinerama-git... myself patched libaosd with some additional features).
Last edited by mkoskar (2014-07-22 11:18:42)
Offline
@mkoskar
Thanks for sharing your approach. I followed it and created a wrapper script that I mapped to the same key in Openbox.
#!/bin/bash
## Dependencies
# xkb-switch
# libnotify
# Switch to next keyboard layout
xkb-switch -n
LAYOUT=$(xkb-switch)
notify-send -i warning "Keyboard Layout" "Keyboard layout switched to ${LAYOUT}" --icon=input-keyboardBy the way, I don't have any issues with libnotify (no delays).
Offline
By the way, I don't have any issues with libnotify (no delays).
What daemon you use? Probably something what has stacking notification could work OK, I was looking for something what take space of a single line. Probably for switching of a layout, it's OK, but e.g., when increasing audio volume where I press (+) multiple times scrolling wouldn't make sense,... and at the same time I could scroll-off important notifications, like that backup failed etc., I haven't found libnotify notification daemon yet which would work well for both of these use-cases for me. Maybe running multiple with different config? Sound over-complicated.
Offline