LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 02-03-2022, 04:59 AM   #1
bencze
LQ Newbie
 
Registered: Aug 2021
Posts: 3

Rep: Reputation: Disabled
Changing keyboard layout


Hi,

I am trying to set up my machine with 2 keyboard layouts - one with standard US to be able to type things in terminal and still find /, and the other in my native language for mails and chat.

I use a Manjaro up to date, kernel 5.15.16-1. I tried kde and gnome and now using i3wm. Since I did my best to remove all kde and gnome related packages from my machine I don't believe I have graphical tools to do this which is fine.

With trial and error I found a setxkbmap command which works manually (during this I finally sort of understood what dead keys means ). It is added to my i3 config to load on login but this doesn't work, if I copy paste the command from the config in a terminal it starts working.
What I also have is a config file under /etc/X11/xorg.conf.d that I named 00-keyboard.conf that contains the same settings as the setxkbmap. At this point I'm not sure how I made that file, maybe it was auto generated by some kde tools when I initially installed the system. I tried to make it have the same layouts that I'm trying to use with setxkbmap. This also doesn't seem to have much effect (maybe this one has different keywords for the layouts and setting keybind, or just doesn't get executed as it's related to some different service I don't have, not sure).

My main problems:
1. I'm not sure how I should best set these things. It's not healthy if I go and randomly add configs everywhere and not know if and how they may conflict each other. So I'd appreciate a little bit of clarification how setxkbmap, and the locale, localectl, locale-gen commands relate to each other if they do at all, or how would one go best to set something like that, ideally learn 1 way that works with all distros.

2. Locale settings and inherited configs - looking in configs I was confused to see a third country mentioned in the configs which is where I live and was probably for things like display date format, currency and the like. I assume on initial install there were some config files written by the installer or graphical config and I'm not sure if these are in effect or not anymore (what utilities or services may use what files). I know of 2 different places where these input languages are set now, maybe there's more I don't even know of

3. not sure why the setxkbmap command doesn't seem to run from i3 config but running the same from a terminal suddenly i can change language. I'd like to understand a bit how this works but at the end of the day I'd like to make it work.
 
Old 02-04-2022, 04:58 AM   #2
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242

Rep: Reputation: Disabled
I'm almost wondering if you're over-complicating this, so can you answer a few questions?

1.) What is your native language? (i.e. the one you want to use for mails and chat)

2.) During installation, did you specify that language as your desired default keyboard?

3.) It sounds like you started with kde, then added gnome, and then added i3wm without ever reinstalling Manjaro. Is that true? (in theory, having multiple desktop environments installed is possible to do, and you can select which desktop you want at log-in. In practice, it's quirky enough that you would need a really good reason to do so in my opinion.) Removing one one of these is also possible in theory, but seldom works fully in practice.

4.) Have you ever heard of an IME (Input Method Editor)? (Maybe not relevant depending on your answers to the questions above, but may be a good solution).

5.) Your reference to a "third country" leads me to suspect that the usual language for that country (the one you're living in) is neither English nor the language you want to use for your mails and chat. Is that the case? And, yes, your suspicion that language and locale are quite different things serving different purposes is correct.

6.) have you been using separate backup programs for Operating System/Distribution stuff (e.g. TimeShift or similar) and User files?

7.) Just to understand your frame of reference a little better - are you coming from the Windows world or the Mac world? If you could comment on what prompted you to jump into Linux (a good decision in any case), that also might help focus any answers anyone here can provide so they make more sense.

The whole X system for producing a character from a key press is widely, but very poorly, documented and not for the fainthearted. If you are new to Linux I'm surprised you haven't already given up. Hang on. What you want to do can probably be done if we can pin down exactly what that is.

Regards ...
 
Old 02-04-2022, 07:54 AM   #3
bencze
LQ Newbie
 
Registered: Aug 2021
Posts: 3

Original Poster
Rep: Reputation: Disabled
It gets complicated when you troubleshoot something for days and there's so many things you already tried and not sure what is relevant info.
I appreciate your thorough attention!

Weirdly something happened and it started working and I did some more troubleshooting and figured it out. I will give brief answers for historical detail but the solution is at the end.
1. I was setting Hungarian (qwerty variant instead of default qwertz)
2. Pretty sure it was us English as I select that as default and add others later. I started with zx spectrum / c64 in 91 and also on PCs it was years until I started using other languages. Nowadays I consider it appropriate to other people to use the specific language's character set but I don't need it for a working computer.
3. Yes I started kde, didn't like some UI inconsistencies, removed it best I could, added gnome, was ok-ish, discovered i3, added it, removed gnome slowly best I could (replacing gdm with lightdm, lightdm greeter, adding picom struggling with screen tearing/nvidia, process took couple of weeks). There probably are various artifacts belonging to kde / gnome. I will likely do a reinstall when I consider the config 'final'-ish and am not lazy.
4. Never heard of IME.
5. I live in Germany and selected it as location during install which tends to want to set various things to German which I don't speak. I'm sure I tried my best to specify I don't want it as language even during install. I'm not sure how I added hungarian, if it requires 'adding' (as in install or configure something to make it available), don't remember.
6. Backups are something I need to explore in future, if not else for configs, but never tried anything yet in Linux.
7. I come from Windows but I work in IT (started as sysadmin in small environment after college, don't really do hands on since a long time). I used a bit of Slackware and Suse in 95-2000 and later tried Ubuntu, I have a Nas I don't use much that used to run Centos and when they switched to systemd I went Slack on it. I'm not new to Linux but never used it as daily driver / main pc and it requires a TON of troubleshooting (which is why my few tries always ended up going back to Windows after a week or two). I do feel a newbie there's so much I don't understand.

Solution:
I had gxkb package added because I searched the web for a solution to display which layout is active. The gxkb tray icon didn't have any options on right click (just about and quit) so I thought it's just for display.
For some reason which I still don't know, loading of gxkb disappeared from my i3 config (I'm not a vim wizard, maybe pressed dd at some point and hadn't noticed, it feels I edited these files a million times) and suddenly things started working. Looking into it more (man page) despite the fact it doesn't contain much detail about switching at all, it does mention gxkb is a switcher as well. Researching a bit I discovered I had a largely empty gxkb.conf in my .config and it must have been conflicting with the previous settings.

I reproduced it by disabling gxkb, reboot, layout switching keybind works, start gxkb, doesn't work anymore. Execute setxkbmap command, works again.

I think now I can set my layouts by setxkbmap command in i3 config (exec --no-startup-id <command>) if I execute that after I loaded gxkb.
Alternatively I discovered somewhere that I can place a config file in /etc/X11/xorg.conf.d/ and that could also work, in that case I would need to figure out a way to display it without interfering. The file does say I should not edit it manually but I did and it seems to work. (probably should research localectl to learn to use it correctly)
Or I could look into gxkb.conf which makes sense if I use the tray applet but on the other hand doesn't seem very standard way of setting it (too package specific and the method learnt may not work on other distros).
 
Old 02-04-2022, 09:10 AM   #4
CVAlkan
Member
 
Registered: Nov 2012
Location: Northwest suburbs of Chicago
Distribution: Ubuntu & Mint LTS, Manjaro Rolling; Android
Posts: 242

Rep: Reputation: Disabled
Ah - your situation is "unusual," and no OS is really comfortable with that, but if everything is working the way you want, I suppose that's fine. I'd be a little concerned about reproducing it when you eventually upgrade (e.g. if Commodore makes an unexpected resurgence in 2026 and you want to return to your roots).

Just a few comments - others may have some as well:

For backups, I tend to use TimeShift and create a snapshot before any significant change (e.g. new kernel or any change such as when you added a new desktop UI) - this class of backup utility is not so much for YOUR data, but to restore the OS to a working state if some new "feature" or experiment makes it hinky. I am currently using Lucky Backup to back up MY OWN files (and I deliberately exclude everything not in my own user directories); there are a ton of this class of backup utility, but the point is: you can always download a whole new Linux installation. You alone are responsible for your own stuff... This separation of YOUR data from the OS data is particularly important if you fiddle with different distros and desktops.

An IME just might be of interest to you. This is a utility that permits you to switch to a different writing system on the fly using a hot key you can define for yourself: I am able to switch fairly seamlessly among a variety of writing systems such as Thai (สวอสดีชาวโก), Attic Greek (Ψαιρετε κοσμε), Hindi (नमस्ते दुनिया), and several others with a single keystroke (all of those phrases by the way say "Hello, World," the programmers' first words in any new language). This is not language support of course, since spelling dictionaries and such need to be loaded for serious writing in another language, and you must have fonts containing the requisite glyphs and, of course, you must also know which keys produce each letter, but those are all easily addressed. Depending on which IME you use (and that depends in my opinion on which particular combination of writing systems you have in mind), there will be an icon or flag in the system tray letting you know what mode/layout you are currently using. And, finally, did you know most Chinese do their typing using a "standard" Latin keyboard, e.g. 你好世界 is typed more or less like you would pronounce "Hello World" in Mandarin: "nihao shijie." The "big two" IMEs currently are iBus and FCITX, though there are a variety of others with different features, so your choice might not be the same as mine. I have yet to encounter any Linux distribution (or Windows version) that didn't have one or more IMEs available for installation.

Even for Hungarian (which I don't speak or read), or for any layout that just rearranges Latin keys (QUERTZ, AZERTY, Dvorak, etc.), remapping individual keys is far too tedious and error prone to do using the method you described (in my opinion of course); IMEs are made for exactly this use. Again, though, you need to know which keys produce which characters - very often the only difference between a keyboard in Thailand, one in the U.S. and one in Korea is that the non-English ones have additional glyphs printed on the key tops (the Latin character set is, as you mentioned, required for most work in the terminal). In the IME I'm using (iBus), I checked and see there are two different Hungarian layouts available, though I don't know enough to tell you what the differences might be, so you might want to at least read up on the subject. If you only use two different layouts, there are a number of places to obtain key tops with dual character sets, though you need to know your key types, whether they're see-through etc. etc.

I'm glad to hear things are working the way you want; one last thing I'll mention is that an always good source of information on Linux (other than this forum of course) is the Arch Linux collection of web pages (start with https://wiki.archlinux.org/). It seems to me that I've found more Linux answers there than on all other distros' forums combined.

Have a great day ...
 
Old 02-04-2022, 10:46 AM   #5
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Salix
Posts: 6,150

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
As is so often the case, my reaction is "If I wanted to go there, I wouldn't start from here"! You want to do something that most users don't and with with a minimalist environment that concentrates on providing the basic essentials. In my Xfce, setting and switching keyboard layouts is simple. If you really want i3, this might help: https://askubuntu.com/questions/8265...with-i3#826578
 
Old 02-04-2022, 02:42 PM   #6
bencze
LQ Newbie
 
Registered: Aug 2021
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for the input to both, and for the encouragement.
I always assumed it's a basic need to write in 2 or more languages for a lot of people. I'm just used to switch when US English layout makes more sense, like for terminal or other cases when you use a lot of special characters.
I did not even consider spelling yet, it was secondary to simply being able to write, will look into it but I'm not used to depend on it.

Maybe using i3 as a non native English speaker is uncommon / unintended, but kde, gnome, and even xfce seemed not very snappy or fluid, and awkward in handling menus, docks and windows, in comparison to MS Windows (not measurement just subjective feel, something bothered me). I think people using i3 want to use their computer for the same things as anyone else, it's just how you interact with it is different. With 2 monitors it just makes sense to how I use my pc.

I also assumed that layouts and their changing is something close to OS basics and not depending on one or another desktop environment, as these languages seem to be part of the OS, after all for the OS it doesn't matter what character is printed on the keycap when you press a key. Any language I ever used so far (few European languages) worked fine on a 101+ key standard keyboard so it's not hardware related. (not sure if that was misunderstood - I don't need to build my own key map, I'm happy using what seems to be standard layouts since decades)

I will read up on ibus, the name is familiar.

I will also look at incorporating layout display in my i3 status bar instead of tray applet (I use a bash script based i3 status bar I found on github), that's a good point, but i3 also supports tray icons so that seemed comfortable to start with.

Checking backup methods is also on the list if I find a setup that is more or less finished and stable, for now I change too much.

It's slow for me to make i3 working with everything, as I need to figure out and add the components myself: took a few weeks so far to realize I need display manager, greeter, compositor, notification daemon, wallpapers, customize i3bar, configure openvpn so i can enable/disable with a click, how can I manage sound, find applications i like such as alacritty, notepadqqq, or ncmpcpp / ncspot, mc. It's my longest 'switch to Linux desktop' attempt so far. Hoping by the time I get tired I will have everything I need and will like it enough to stay.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting the correct keyboard layout corresponding to my laptop's physical layout nidra Linux - Newbie 2 08-28-2017 08:14 AM
Switching keyboard layout - Mandriva2006 - K.D.E. Windows Layout! itz2000 Mandriva 3 08-13-2006 06:43 PM
crash when changing language(keyboard layout) atkbd.c cuk Mandriva 0 06-20-2004 04:16 AM
Changing my keyboard layout (language) globally by command (shell) Santorres Linux - Newbie 1 05-17-2004 02:04 PM
Changing keyboard layout? Eits0 Linux - General 2 08-13-2002 06:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 09:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration