[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwin
Subject:    Re: Get current language input layout
From:       Martin =?ISO-8859-1?Q?Fl=F6ser?= <mgraesslin () kde ! org>
Date:       2021-09-19 19:04:05
Message-ID: 2055138.ObGHiDVXtg () martin-yoga
[Download RAW message or body]

Am Sonntag, 19. September 2021, 13:30:28 CEST schrieb SR_team:
> Hi, I can simply get current language input layout on X11 from XKB. It's
> work on all WM/DE, and it works on Wayland session via XWayland. But I want
> to get language input layout on Wayland natively, without XWayland. My
> target DE is KDE/Plasma. Can I get this information from KWin? May be in
> KWin exists universal interface for X11/Wayland sessions to get current
> language layout?

You need to use the keymap event of the wl_keyboard interface. This provides a 
file descriptor to the current xkb keymap. The current layout is notified 
through the modifiers event. All of this is exposed through 
KWayland::Client::Keyboard.

> Also, I tryied detect current platform and active window from KWindowSystem
> in my console app, but this always return is 0. Maybe it works only for
> window apps, but I want to write a daemon to switch led color on my
> keyboard, when language input layout is changed.

This is difficult as active window is not really exposed. You can use the Plasma 
Windowsystem API in KWayland, but it is security restricted. A possible 
approach (if you want to have it Plasma specific) is using a KWin script and 
send the information to a DBus service your deamon exposes. That certainly 
sounds like a cool project.

Cheers
Martin



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic