Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
automatic keyboard layout change on KDE
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Lord Aragorn
n00b
n00b


Joined: 19 Jan 2005
Posts: 46

PostPosted: Fri Aug 30, 2024 1:21 pm    Post subject: automatic keyboard layout change on KDE Reply with quote

I have two computers connected to one set of monitor/keyboard/mouse using a KVM. Recently I changed my keyboard and now the layout of the external is different from the laptops.

I was looking for a way to automatically change the layout when the external keyboard is connected, but with wayland delegating that functionality to KDE 6 in my case, I just can find a way to do it. There is used to be a way to do it in X11, but now it no longer works.

Does anyone know if this is even possible?

Thanks in advance
Back to top
View user's profile Send private message
Lord Aragorn
n00b
n00b


Joined: 19 Jan 2005
Posts: 46

PostPosted: Wed Sep 25, 2024 8:14 pm    Post subject: Reply with quote

ok, quick update, thanks to https://github.com/shalva97/kde-configuration-files?tab=readme-ov-file I figured the commands to do what I want, it will look something like this:


Change Layout
Code:

#!/bin/bash

kwriteconfig6 --file kxkbrc --group Layout --key LayoutList us

kwriteconfig6 --file kxkbrc --group Layout --key VariantList intl

dbus-send --session --type=signal --reply-timeout=100 --dest=org.kde.keyboard /Layouts org.kde.keyboard.reloadConfig


If I run this with my user it works as expected, now the udev rule to execute this(work in progress)

Code:
SUBSYSTEM=="hid", ACTION=="add", RUN+="/usr/local/bin/kblayoutus"
SUBSYSTEM=="hid", ACTION=="remove", RUN+="/usr/local/bin/kblayoutlatam"


apart everything works as expected, but the problem is that from Udev I'm not running from my user and it just doesn't work

will provides updates if I manage to do this.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum