-
-
Notifications
You must be signed in to change notification settings - Fork 733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: keyboard layout #66
Comments
Create a custom module with something like this in a script and run it in the exec: ? |
@harishkrupo it doesn't work. It always shows |
okay, will need to check. How do you pick a different layout? |
@harishkrupo If you're using Sway: https://github.com/swaywm/sway/wiki#input-configuration |
I have opened a PR for this issue: #85 |
if somebody needs it:
this polls it every second, but ideally it should work as in pulseaudio module, to update whenever layout updates. |
@rvi64 Thanks! There is an ongoing work to create a new protocol to get this information. See here |
here's a version without jq, only unix utils, shows EN by default, and first two upper case letters otherwise
|
here's a another version with only unix utils, shows proper language two letters shortcut .config/waybar/modules/layout.sh
.config/waybar/config
EDIT: add support for other man formats. Sadly |
You assume that man page is compressed with gzip. Also, don't you think, parsing man isn't the right way to do this? The right way is parsing /usr/share/X11/xkb/rules/evdev.xml I guess. |
@eternal-sorrow .config/waybar/modules/layout.sh
.config/waybar/config
|
Here's my python version. You'll need the latest git version of acrisci/i3ipc-python installed. #!/usr/bin/env -S python3 -u
import time
import i3ipc
KBD_NAME = "1:1:AT_Translated_Set_2_keyboard"
sway = i3ipc.Connection()
while True:
inputs = sway.get_inputs()
keyboard = [i for i in inputs if i['identifier'] == KBD_NAME][0]
layout = keyboard['xkb_active_layout_name']
print(layout[:2].lower())
time.sleep(1) |
We can get updates from |
Not work for me.
|
@exdeniz This version is very outdated. It uses polling and old i3ipc API. Use that one #85 (comment) or one of others from that thread. |
@Hexawolf I created pull request with waybar module which shows keyboard layout. Yes it still use |
I just built a little bit on the previous answers and uses the following to show flags for layouts in waybar.
waybar_sway_keyboard_layout
|
#659 should solve this. |
I've a custom python script to get the layout using i3ipc library (python-i3ipc). it subscribes to input changes to get notified when the layout changes without the need to poll in a loop.
make sure you make
|
if I read correctly, #659 also interact just to input change |
@krtko1 yes it does subscribe to input change events |
I rewrote a jq version in sed and embedded it into the single 'exec' object, so it doesn't need any external script execuion:
|
FWIW those running Waybar in Sway can just use |
Great, I just added it and it seems to work. Do you think it would be possible to add also the variant together with the layout name? |
Any updates here? |
Two enhancements to sway/language could be added:
|
@hirmanpour |
That would be great ! As a side note regarding the first option, according to ArchWiki one can get the current layout with this command:
But that depends on For a plug-in general solution, one would need, unless a kbd_identifier is manually specified by the end user, to automatically extract the |
@hirmanpour I might just be in the 1% of users who got unlucky here, but here is the output of
on my laptop:
|
@hirmanpour |
@bnjw5jhyxn Oh god ! Lucky one percenter ;-) Could it be that I might also be the proud owner of 7 keyboards, without knowing it ??? |
@Anakael Many thanks ! |
Does this only work for Sway? |
@gbrlsnchs |
|
Renaming the module name will break compatibility. |
I really like the default sway/language module, but would it be possible to display it conditionally if there is more than one layout configured? otherwise it is wasting that precious space 🌴 |
Hm. |
could you try install libxkbcommon? |
Would be really nice to have the module showing current keyboard layout. Or maybe a help to write the custom module script with this capability.
The text was updated successfully, but these errors were encountered: