We use some essential cookies to make our website work.

We use optional cookies, as detailed in our cookie policy, to remember your settings and understand how you use our website.

3 posts • Page 1 of 1
avarvit
Posts: 31
Joined: Sun Dec 24, 2023 5:05 am

wf-panel-pi keyboard layout display and switching widget - now for both labwc and wayfire

Tue Aug 26, 2025 5:41 am

I use my Rpi 5 (and in the past, RPi 4 and 400) for general desktop work. Being Greek, I have to work in two languages. With the advent of Wayland as a successor of X11, the good old "kbdd" functionality of tracking, displaying and modifying the keyboard layout (language) via a taskbar widget is gone for good, and is not easy to re-instate, because Wayland has been designed purposely to "leave this task to compositors". Among compositor ecosystems, I have found this functionality to be available in sway, however RPiOS comes with wayfire and labwc instead; and anyway, I believe it is a bit too much to ask a user to switch away to a completely new compositor ecosystem just because this detail is missing. Thus, starting back in 2023, decided to build this myself and add it to wf-panel-pi (see also my then-post: viewtopic.php?t=367873). Here is what it looks like when you hover and when you click on it:

Image Image

Two components are required to make the thing work: one is the widget itself, and another one is some add-on functionality in the compositor, where the add-on and the widget communicate over e.g., sockets, files or DBus. In this older thread viewtopic.php?t=367873, I had posted links to a wf-panel-pi version and a wayfire plugin that provide the display and switching functionality. The times they are-a-changing, and since then, two (good!) things have happened: wayfire has given way to labwc as the preferred compositor for RPiOS, and wf-panel-pi has also obtained a dev package, thus allowing plugins to be developed and built independently of the main wf-panel-pi's code tree.

Adapting to these changes, I have now provided my "wf-panel-pi-kbdlayout" code as a standalone wf-panel-pi plugin, and, in addition to my older "wayfire-kbdd-plugin", I have now provided a "wlroots-kbdd" wrapping library to make labwc able of reporting keyboard layout (language) changes that the user performs via the keyboard switch combo (e.g., left-alt-shift) to the kbdlayout widget, and switching the current layout after DBus messages it receives from the kbdlayout widget. (Note that, since labwc does not currently support plugins, wrapping a library was the only hack I could find to make this work. Please do not tell me it is not elegant, it is ugly, etc. I know.)

Any multi-language users who want to try this are welcome to compile and try the code. Note that in this version, no official RPiOS package binaries are affected, and all my code is in the form of add-ons (wayfire plugin, wf-panel-pi widget, labwc add-on library), allowing the main system components (wf-panel-pi, wayfire and labwc) to be updated as usual. Compiling my code will require some elementary skills of working with source, like installing git, dependency libraries, meson, ninja, cloning the repos, running meson, etc., as well as some minor configuration file changes. I am giving some instructions in the README files of my repos, though a complete tutorial is not in my scope for this contribution. I would love to receive feedback (and code improvement suggestions) from any users who want to try my code. Thanks!

avarvit
Posts: 31
Joined: Sun Dec 24, 2023 5:05 am

Re: wf-panel-pi keyboard layout display and switching widget - now for both labwc and wayfire

Tue Sep 30, 2025 3:51 am

I posted this on Aug 26, more than a month ago. Since then, it has received about 500 views, so some people have seen it. A few of them have cloned the github projects - interestingly, both the wayfire plugin and the labwc preload library projects - and I assume have tried to run the plugin.

I would like to kindly ask all of you who gave it a try to post a reply here with a few words as to whether this worked for you, if you faced any issues while building or running, if the thing worked as you expected it, if you need more explanations or guidance, and whatever else you would think would be useful for the community. If that failed for whatever reason, it is rather my fault - I could e.g., fix something that is broken, enhance documentation, etc. to make it easier for you to build and run without issues. If it worked, it would be great to hear!

Thanks to all of you.

usa
Posts: 8
Joined: Tue Aug 13, 2024 2:11 pm

Re: wf-panel-pi keyboard layout display and switching widget - now for both labwc and wayfire

Sun Nov 09, 2025 9:56 am

Code: Select all

pi@raspberrypi:~ $ cd /tmp
pi@raspberrypi:/tmp $ git clone https://github.com/avarvit/wf-panel-pi-kbdlayout
Cloning into 'wf-panel-pi-kbdlayout'...
remote: Enumerating objects: 19, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 19 (delta 1), reused 16 (delta 1), pack-reused 0 (from 0)
Receiving objects: 100% (19/19), 11.56 KiB | 493.00 KiB/s, done.
Resolving deltas: 100% (1/1), done.
pi@raspberrypi:/tmp $ cd wf-panel-pi-kbdlayout/
pi@raspberrypi:/tmp/wf-panel-pi-kbdlayout $ sudo apt install libglibmm-2.4-dev libgtkmm-3.0-dev libxkbcommon-dev wf-panel-pi-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libglibmm-2.4-dev is already the newest version (2.66.5-2).
libgtkmm-3.0-dev is already the newest version (3.24.7-1).
libxkbcommon-dev is already the newest version (1.5.0-1).
wf-panel-pi-dev is already the newest version (0.102).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@raspberrypi:/tmp/wf-panel-pi-kbdlayout $ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
pi@raspberrypi:/tmp/wf-panel-pi-kbdlayout $ uname -m
aarch64
pi@raspberrypi:/tmp/wf-panel-pi-kbdlayout $ meson setup builddir --prefix=/usr --libdir=/usr/lib/aarch64-linux-gnu
The Meson build system
Version: 1.5.1
Source dir: /tmp/wf-panel-pi-kbdlayout
Build dir: /tmp/wf-panel-pi-kbdlayout/builddir
Build type: native build
Project name: wf-panel-pi-kbdlayout
Project version: 0.8.0
C++ compiler for the host machine: c++ (gcc 12.2.0 "c++ (Debian 12.2.0-14+deb12u1) 12.2.0")
C++ linker for the host machine: c++ ld.bfd 2.40
Host machine cpu family: aarch64
Host machine cpu: aarch64
Found pkg-config: YES (/usr/bin/pkg-config) 1.8.1
Run-time dependency gtkmm-3.0 found: YES 3.24.7
Run-time dependency xkbcommon found: YES 1.5.0
Run-time dependency glibmm-2.4 found: YES 2.66.5
Run-time dependency giomm-2.4 found: YES 2.66.5
Run-time dependency wf-panel-pi found: YES 0.8.0
Build targets in project: 1
wf-panel-pi-kbdlayout 0.8.0
 User defined options
 libdir: /usr/lib/aarch64-linux-gnu
 prefix: /usr
Found ninja-1.11.1 at /usr/bin/ninja
pi@raspberrypi:/tmp/wf-panel-pi-kbdlayout $ meson compile -C builddir
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /usr/bin/ninja -C /tmp/wf-panel-pi-kbdlayout/builddir
ninja: Entering directory `/tmp/wf-panel-pi-kbdlayout/builddir'
[1/2] Compiling C++ object src/widgets...yout/libkbdlayout.so.p/kbdlayout.cpp.o
FAILED: src/widgets/kbdlayout/libkbdlayout.so.p/kbdlayout.cpp.o 
c++ -Isrc/widgets/kbdlayout/libkbdlayout.so.p -Isrc/widgets/kbdlayout -I../src/widgets/kbdlayout -I/usr/include/gtkmm-3.0 -I/usr/lib/aarch64-linux-gnu/gtkmm-3.0/include -I/usr/include/giomm-2.4 -I/usr/lib/aarch64-linux-gnu/giomm-2.4/include -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glibmm-2.4 -I/usr/lib/aarch64-linux-gnu/glibmm-2.4/include -I/usr/include/sigc++-2.0 -I/usr/lib/aarch64-linux-gnu/sigc++-2.0/include -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/aarch64-linux-gnu -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/aarch64-linux-gnu/dbus-1.0/include -I/usr/include/cairomm-1.0 -I/usr/lib/aarch64-linux-gnu/cairomm-1.0/include -I/usr/include/pangomm-1.4 -I/usr/lib/aarch64-linux-gnu/pangomm-1.4/include -I/usr/include/atkmm-1.6 -I/usr/lib/aarch64-linux-gnu/atkmm-1.6/include -I/usr/include/gtk-3.0/unix-print -I/usr/include/gdkmm-3.0 -I/usr/lib/aarch64-linux-gnu/gdkmm-3.0/include -I/usr/include/wf-panel-pi -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=c++17 -O0 -g -Wno-pedantic -Wno-unused-parameter -Wno-parentheses -D_GNU_SOURCE '-DMETADATA_DIR="/usr/share/wf-panel-pi/metadata"' '-DPACKAGE_DATA_DIR="/usr/share/wf-panel-pi"' '-DGETTEXT_PACKAGE="wf-panel-pi-kbdlayout"' '-DPACKAGE_LOCALE_DIR="/usr/share/locale"' -fPIC -pthread '-DPLUGIN_NAME="kbdlayout"' -MD -MQ src/widgets/kbdlayout/libkbdlayout.so.p/kbdlayout.cpp.o -MF src/widgets/kbdlayout/libkbdlayout.so.p/kbdlayout.cpp.o.d -o src/widgets/kbdlayout/libkbdlayout.so.p/kbdlayout.cpp.o -c ../src/widgets/kbdlayout/kbdlayout.cpp
In file included from /usr/include/wf-panel-pi/config/compound-option.hpp:3,
 from /usr/include/wf-panel-pi/config/option-wrapper.hpp:5,
 from /usr/include/wf-panel-pi/wf-option-wrap.hpp:3,
 from /usr/include/wf-panel-pi/widget.hpp:6,
 from ../src/widgets/kbdlayout/kbdlayout.hpp:4,
 from ../src/widgets/kbdlayout/kbdlayout.cpp:3:
/usr/include/wf-panel-pi/config/types.hpp:4:10: fatal error: glm/vec4.hpp: No such file or directory
 4 | #include <glm/vec4.hpp>
 | ^~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
pi@raspberrypi:/tmp/wf-panel-pi-kbdlayout $ 

3 posts • Page 1 of 1

Return to "Raspberry Pi OS"

AltStyle によって変換されたページ (->オリジナル) /