KDE 5 loads wrong keyboard layout

Every time I start KDE 5 in FreeBSD 14, the keyboard layout is loaded as US, although I've set FI (=Finnish) as the only keyboard layout to be loaded in System Settings / Input Devices / Keyboard / Layouts.
I can only change the layout in Terminal with setxkbmap fi, or making changes to the layout in system settings and applying the changes.

In Gnome the keyboard layout loads correctly every time, but in XCFE the layout is US, as well, and I have to manually change it.

The keyboard layout loaded OK when I first installed KDE, but stopped working when I made the mistake of running portmaster -a, which updated some packages related to KDE 5 and GTK 5 (?).

So far I've tried reinstalling KDE 5. I've also tried installing KDE 6 from ports, but the KDE 6 installation failed because some packages would not compile without errors and I could not start KDE at all. After that I reinstalled KDE 5 from pkg again,
and now KDE works again, but the keyboard problem remains.

I have also added the line exec setxkbmap fi & to both ~/.xsession and ~/.xinitrc.
In System Settings / Startup and Shutdown / Autostart I have setxkbmap starting with fi as argument and I also have a startup script loaded with the following code.

Code:
#!/bin/sh
setxkbmap fi

I have also created a new user account in case there's something wrong with my profile, but the same problem applies to that one as well.

In /etc/rc.conf I have:
Code:
keymap="fi.kbd"
If I login to non-graphical mode, the keyboard layout is FI, as it should.

I'm all out of ideas, so, if anyone has any ideas what I could try next, I'd apprectiate any suggestions.
 
Do you use "startx" or a "login manager" ?
Note : Inside KDE there is also a keyboard configuration, it's under "Settings => Input Devices => Keyboard => Layout Tab".
 
I use SDDM to login, but while troubleshooting, I've also tried startx. The result is the same with both. I think I also tried GDM at some point, but no success.

And in the System Settings Layouts tab the only choice I have is Finnish keyboard. I specifically removed the US layout because of this. There is no setting, as far as I know of, that still has the US keyboard and yet on every login, the keyboard layout is US. :confused:
 
I have done that and only the Finnish keyboard layout is listed. Despite the Finnish keyboard being the only one listed, the layout, when typed, corresponds to that of a US keyboard until I run setxkbmap fi in the Terminal.

As a workaround I now have an icon for the script that runs the command setxkbmap fi on the desktop, and when I double-click the icon, the layout is changed to FI for the session. However, I'd love to use KDE normally without extra hassle because that's the way KDE should work. I.e. if I set the layout to something, it should be that something and nothing else. :)
 

Attachments

  • system_settings_keyboard.png
    system_settings_keyboard.png
    116.5 KB · Views: 98
I read through that and made the following changes:

Added the following to ~/.login_conf and ~/.profile

Code:
me:\
       :charset=UTF-8:\
       :lang=fi_FI.UTF-8:

Makes no difference, whatsoever.

The important point is this: Gnome - loads the keyboard layout correctly; KDE - does not. It USED TO WORK before I updated packages with portmaster -a, but not after that, even if I have uninstalled and reinstalled KDE 5. Something is broken, but what? Is there a way to rollback updates done with portmaster -a?
 
I think you should not mix binaries and compiled ports. Portmaster is fine sometimes. Poudriere is better, because it creates a jail and compile the packages there, then you install it from your local repository. To rollback the updates...
Code:
pkg upgrade

Also I dont think SDDM use the ~/.xinitrc... I use x11/slim and x11-wm/i3 and Slim uses the ~/.xinitrc... so I put this
Code:
setxkbmap -layout es -model pc105 &
.
 
So I figured that mixing ports and pkg is not a good idea. I also don't get why Portmaster would offer updates to KDE if KDE was installed with pkg. I thought it'd just update applications installed from ports and not touch anything else. I ran the update anyway thinking it would do no harm, but it was clearly a mistake.

I believe SDDM uses ~/.xsession rather than ~./xinitrc. I updated both in case I want to start the desktop environment from console with startx.
 
So I figured that mixing ports and pkg is not a good idea. I also don't get why Portmaster would offer updates to KDE if KDE was installed with pkg.
That's one of the reasons you don't mix them.

portmaster effectively builds binary packages and installs them, so when it sees installed binary packages it will assume it built them so will offer updates.

But as you've said - stick to one or the other as best you can (unfortunately there are some times when you do have to mix them, so it's not a 100% always rule.)
 
I was struggling with it as well and found the following solution (at least for KDE):
In Input devices section of System settings / Layout tab for keyboard "Configure layouts" checkbox is disabled by default.
Once enabled it shows gb English(UK) layout and KDE now recognizes layout ok.
1721509146134.png
 
To solve this problem, I put this command setxkbmap -layout es -model pc105 in /usr/local/share/sddm/scripts/Xsetup, and now it works to me, with my spanish keyboard.
 
Back
Top