Showmethekey
Show keys you typed on screen.
Install / Use
/learn @AlynxZhou/ShowmethekeyREADME
Show Me The Key
Show keys you typed on screen.
A SUSE Hack Week 20 Project: Show Me The Key: A screenkey alternative that works under Wayland via libinput.
Feature
screenkey is a popular project for streamers or tutorial recorders because it can visualization your typing on screen, but it does not work with Wayland because it uses X11-only functions to get keyboard event.
Show Me The Key reads key events via libinput directly, and then show them on screen, so it does not depend on X11 or special Wayland Compositors and will work all across them.
Install
Distribution Package (Recommended)
AOSC OS
Just run following command to install from official repository:
# apt install showmethekey
Arch Linux
Just run following command to install from official repository:
# pacman -S showmethekey
openSUSE
Install from OBS
Packages can be found in my OBS project.
# zypper ar https://download.opensuse.org/repositories/home:/AZhou/openSUSE_Tumbleweed/home:AZhou.repo
# zypper in showmethekey showmethekey-lang
Leap users please replace URL for Tumbleweed with URL for your Leap version.
Fedora
Install from COPR
To install the package on Fedora Workstation, run the following commands:
sudo dnf copr enable pesader/showmethekey
sudo dnf install showmethekey
If you are running an Atomic Desktop (Fedora Silverblue, Fedora Kinoite, Fedora Sericea, etc), run:
export RELEASE=40 # or whichever release of Fedora you are running
sudo curl -o /etc/yum.repos.d/showmethekey.repo https://copr.fedorainfracloud.org/coprs/pesader/showmethekey/repo/fedora-$RELEASE/pesader-showmethekey-fedora-$RELEASE.repo
rpm-ostree install showmethekey
Other Distributions
Please help package showmethekey to your distribution!
Build From Source
Dependencies
- libevdev
- udev (or systemd)
- libinput
- glib2 (the dev package may also be needed)
- gtk4
- libadwaita
- json-glib
- cairo
- pango
- libxkbcommon
- polkit
- meson
- ninja
- gcc
Build
$ git clone https://github.com/AlynxZhou/showmethekey.git
$ cd showmethekey
$ mkdir build && cd build && meson setup --prefix=/usr . .. && meson compile && meson install
$ showmethekey-gtk
Usage
Toggle the switch to show the floating keys window, and drag it to anywhere you want, because Wayland does not allow a client to set its position. You may pin it at the top of other windows if you desktop allows that, then you could disable the clickable switch, and the window will become click-through.
You may need to input admin password if there is a polkit authentication agent's dialog, because we need superuser permission to read keyboard events (this program does not handle your password). Users in wheel group can skip password authentication.
For detailed usage, please run usage dialog from app menu.
Special Notice for Wayland Session Users
There is no official Wayland protocol allowing toplevel clients to set their own position and layer, only users can change those things. But don't worry, users are always allowed to do those things by themselves if their compositors support it.
For example if you are using GNOME Shell (Wayland), you can right click the "Clickable Area" on title bar to show a window manager menu and check "Always on Top" and "Always on Visible Workspace" in it.
If you are using KDE Plasma (Wayland), you can right click "Floating Window - Show Me The Key" on task bar, check "Move to Desktop" -> "All Desktops" and "More Actions" -> "Keep Above Others".
For Sway users, you can add following configurations into ~/.config/sway/config to enable floating and sticky (thanks to haxibami's blog post:
for_window [app_id="showmethekey-gtk" title="Floating Window - Show Me The Key"] {
floating enable
sticky enable
}
For Hyprland, you can use window rules to achieve the same effect. The config should be at ~/.config/hypr/hyprland.conf or an extension of it.
Example config:
# To get more information about a window’s class, title, XWayland status or its size, you can use `hyprctl clients`. (From Hyprland Wiki)
windowrulev2 = float,class:^(one.alynx.showmethekey)$
windowrulev2 = float,class:^(showmethekey-gtk)$ # make window floating
windowrulev2 = pin,class:^(showmethekey-gtk)$ # pin window
If You are Tired of the App (Settings) Window
You could always close the app (settings) window after keys window is shown. To show keys window by default, run showmethekey-gtk with -k option. To hide app window by default, run showmethekey-gtk with -A option. If you already use some compositor rules to make keys window always on top and at position you want, you may want to make keys window click-through by default, then you could use -C option.
When keys win is shown, you could always toggle clickable by quickly pressing Ctrl twice (or pressing both Ctrl), and toggle paused by quickly pressing Alt twice (or pressing both Alt).
Project Structure
CLI
This part exists because of Wayland's security policy, which means you cannot run a GUI program with sudo (see https://wiki.archlinux.org/index.php/Running_GUI_applications_as_root#Wayland). It's suggested to split your program into a GUI frontend and a CLI backend that do privileged operations, and this is the backend, a custom re-write of https://gitlab.freedesktop.org/libinput/libinput/-/blob/master/tools/libinput-debug-events.c, based on libinput, libudev and libevdev.
It generates JSON in lines like {"event_name": "KEYBOARD_KEY", "event_type": 300, "time_stamp": 39869802, "key_name": "KEY_C", "key_code": 46, "state_name": "PRESSED", "state_code": 1}.
GTK
A GUI frontend based on GTK, will run CLI backend as root via pkexec, and show a transparent floating window to display events.
FAQ
Why your program needs root permission? screenkey never asks for it!
If you debug with libinput, you'll find it needs root permission, too. Because this program support both Wayland and X11, it does not get input events via display protocol, actually it's reading directly from evdev interface under /dev. And if you want to interact with files under /dev, you need root permission. screenkey does not needs root permission because it's heavily X11-based, it gets input events from X server instead of /dev, which already done it. And because of this it will never support Wayland.
I am using Sway/Wayfire/[not DEs], and I always get AUTHENTICATION FAILED in terminal!
This is a pkexec bug that it's tty authentication does not work, see https://gitlab.freedesktop.org/polkit/polkit/-/issues/17. Most DEs have their own authentication agents, but if you are not using them, pkexec will try to make itself an agent, and you get this bug.
A possible workaround is https://github.com/AlynxZhou/showmethekey/issues/2#issuecomment-1019439959, actually you can use any agents, not only the gnome one.
I have remapped <tt>Caps Lock</tt> to <tt>Control</tt>, but this program shows <tt>Caps_Lock U</tt> instead of <tt>^u</tt>!
Keys which are remapped via the Desktop Environment/X11 tools (for example, setxkb, GNOME Tweaks, KDE settings, or other high-level tools) are not visible to Show Me The Key. A workaround is to remap keys using udev rules. This has the added benefit of working identically in the Linux console (TTY), Wayland, and X11 alike. See https://wiki.archlinux.org/title/Map_scancodes_to_keycodes#Using_udev.
Translate
If you changed translatable strings, don't forget to run meson compile showmethekey-update-po in build directory and then edit po files, and please check if there are fuzzy tag in comment, you should remove them and make translation exact, otherwise it will not work.
If you added new source files with translatable strings, don't forget to add it to showmethekey-gtk/po/POTFILES.in before running meson compile showmethekey-update-po. File paths in POTFILES.in should be relative to project directory.
If you want to add languages, first add a country code in showmethekey-gtk/po/LINGUAS, then run meson compile showmethekey-update-po, you will get a new .po file with your added country code. If this language needs UTF-8 encoding, don't use words like zh_CN.UTF-8 in showmethekey-gtk/po/LINGUAS or file name, because RPM's find_lang script may ignore them sometimes, and you should change to charset=UTF-8 manually in the header.
Name
As I want some clear name that hints its usage, but screenkey is already taken and I think visualkey sounds like Visual Studio and it's horrible. My friend @LGiki suggests Show Me The Key which sounds like "Show me the code" from Linus Torvalds. At first I think it's a little bit long, but now it is acceptable so it's called showmethekey or Show Me The Key.
The Chinese translate of this program name should be 让我看键, and it's only used for app window title, debug output, package name, desktop entry name and floating window title should not be translated. (The floating window title is important because some compositors relies on it to write window rules so you should never translate it!!!)
Icon
Program icon made by <a href="https://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flatic
Related Skills
node-connect
352.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
