Closed alighazi closed 2 years ago
LARBS makes some keyboard changes with the remaps script
after some searching I found that the following command does what I want
localectl --no-convert set-x11-keymap us,se,ir pc105 ,, grp:alt_shift_togglec
however I still don't know how to to add to to the status bar next to the clock
Posting this here because Artix does not have localectl, and hopefully this helps someone
setxkbmap -layout us,rs -option grp:alt_shift_toggle
change the rs
to your language, and ofc make sure you have the locale of that language
tl;dr: uncomment some locale lines, and run the above 1 line at startup (or live to see it working)
This and the above reply answer the issue, it should be closed imo.
btw luke, if you read this, on your super+F1, on bottom where you have FAQ, it would be helpful to include how to change a language (since a lot of users are bilingual)
Edit: For startup, the above line can be dumped on ~/.local/bin/remaps
and it just works.
So you could by default installation place it there and comment it, and have a commented line saying # Uncomment this and change 'rs' to your own language.
And on the FAQ bottom to redirect to that file, and also say how to uncomment your language in the locale file ggwp.
Another question is how to view the active keyboard layout? It would be pretty nice to see active layout on statusbar.
for that you need to create a dmenu block. the source code is in the home folder and should be fairly easy to develop that. I unfortunately gave up on larbs and switched to fedora. I didn't have the time and patience to learn all the tricks needed to navigate in a vim based world.
Another question is how to view the active keyboard layout? It would be pretty nice to see active layout on statusbar. @forgoty
for that you need to create a dmenu block. the source code is in the home folder and should be fairly easy to develop that. I unfortunately gave up on larbs and switched to fedora. I didn't have the time and patience to learn all the tricks needed to navigate in a vim based world.
after some searching I found that the following command does what I want
localectl --no-convert set-x11-keymap us,se,ir pc105 ,, grp:alt_shift_togglec
however I still don't know how to to add to to the status bar next to the clock @alighazi
$ vim ~/local/src/dwmblocks/config.h
uncomment the sb-kbselect
Another question is how to view the active keyboard layout? It would be pretty nice to see active layout on statusbar. @forgoty
for that you need to create a dmenu block. the source code is in the home folder and should be fairly easy to develop that. I unfortunately gave up on larbs and switched to fedora. I didn't have the time and patience to learn all the tricks needed to navigate in a vim based world.
after some searching I found that the following command does what I want
localectl --no-convert set-x11-keymap us,se,ir pc105 ,, grp:alt_shift_togglec
however I still don't know how to to add to to the status bar next to the clock @alighazi
$ vim ~/local/src/dwmblocks/config.h
uncomment thesb-kbselect
hahaha so easy it was! unfurtunately I already moved on from larbs. where were you all along??
Fedora sux ... LARBS ftw ... ! thanks for the suggestion @TheYellowArchitect I also need a rs keyboard brate :D but the rs keyboard is cyrilic, i want it to have the us,rs, and rs latin as well, how would i do that?
using setxkbmap -layout us,rs,rs -variant latin -option grp:alt_shift_toggle gives me "Error loading new keyboard description" while typing in setxkbmap rs -variant latin actually works, so how do i use it in the remaps script effectively?
Another question is how to view the active keyboard layout? It would be pretty nice to see active layout on statusbar. @forgoty
for that you need to create a dmenu block. the source code is in the home folder and should be fairly easy to develop that. I unfortunately gave up on larbs and switched to fedora. I didn't have the time and patience to learn all the tricks needed to navigate in a vim based world.
after some searching I found that the following command does what I want
localectl --no-convert set-x11-keymap us,se,ir pc105 ,, grp:alt_shift_togglec
however I still don't know how to to add to to the status bar next to the clock @alighazi
$ vim ~/local/src/dwmblocks/config.h
uncomment thesb-kbselect
this does not solve it with @TheYellowArchitect's suggestion, when you use alt+shift to switch to the 2nd layout, it doesn't update the dwmblock
That's a problem I've been facing as well for about a year 😂 I finally sat down and fixed it on my setup. Let me explain how.
First we start with the sb-kbselect
script. This script is fine as a statusbar script, it's clickable, it does what it should but it has some quirks.
One of them is the issue that I never ever want to use my mouse to change my keyboard layout. I want to cycle through the 3 layouts I always use. Dare I say it.... just like on Windows! And when I cycle through these layouts I want this status bar script to pick that up. Here's how I did that:
I first created a script in my .local/bin folder, called it cycle-keyboard
and made it executable. Here's the script:
#!/bin/sh
myLayouts="us de hr"
currentLayout="$(sb-kbselect)"
nextLayout="$(echo "$myLayouts" | awk -v currentLayout="$currentLayout" '{for(i=1;i<=NF;i++)if($i==currentLayout)print $(i+1)}')"
# If the next layout is missing, we're at the end of the list
# and should start over
[ -z $nextLayout ] && nextLayout=$(echo "$myLayouts" | cut -d ' ' -f1)
setxkbmap "$nextLayout"
pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}"
Notice the last line. It'll send the kill signal 30 to dwmblocks. If your ~/.local/src/dwmblocks/config.h
file looks like mine, your sb-kbselect
script should be configured for that signal as its update signal.
The variable myLayouts
is used to define a list of keyboard layouts to cycle through. That's it. If you run this script, it'll cycle through this list and if you have your sb-kbselect
script uncommented in your dwmblocks config, your new layout will show up in your status bar.
In order to bind this to a key combo, I edited the dwm source at ~/.local/src/dwm/config.h
and added this line to the keys array:
{ MODKEY|ControlMask, XK_space, spawn, SHCMD("cycle-keyboard") },
On my setup, I added this on line 249, bellow the shortcut that toggles floating windows. This will bind super + ctrl + space
to the keyboard cycle script.
Enjoy!
I couldn't find it in the readme. should I install a helper program or tweak the config files?
the command setxkbmap does the trick however is there a way to add it to the top toolbar and also assign a shortcut to quickly switch between a number of keyboard layouts like other Oses?