A powerful Linux keyboard monitoring tool that captures and processes keyboard input events in real-time. waykey provides detailed keyboard state information through both a named pipe and a JSON state file, making it perfect for keyboard state visualization, gaming overlays, or custom keyboard monitoring applications.
- Real-time keyboard state monitoring
- Multiple output methods:
- Named pipe for live event streaming
- JSON state file for current keyboard state
- Automatic keyboard device detection
- Support for custom device selection
- Thread-safe state management
- Clean signal handling for graceful shutdown
- Configuration file support via ~/.config/waykey/config.yml
- Linux system
- libinput - For handling input devices
- json-c - For JSON state management
- libyaml - For YAML configuration file parsing
- pthread - For concurrent processing
comming soon... :D
# Arch/Manjaro
sudo pacman -S libinput json-c base-devel
# Debian/Ubuntu
sudo apt-get install libinput-dev libjson-c-dev build-essential
# Fedora/RHEL
sudo dnf install libinput-devel json-c-devel gcc make
git clone https://github.com/himonshuuu/waykey.git
cd waykey
make
sudo make install
waykey [OPTIONS]
Options:
-d, --device PATH Input device path (optional)
-p, --pipe PATH Named pipe location (default: /tmp/waykey_pipe)
-s, --state PATH State file location (default: /tmp/waykey_state.json)
-l, --list List available keyboard devices and exit
-h, --help Show help message
# Auto-detect keyboard and start monitoring
sudo waykey
# Monitor specific keyboard device
sudo waykey --device /dev/input/event3
# Use custom paths for pipe and state file
sudo waykey --pipe /tmp/custom_pipe --state /tmp/custom_state.json
# List available keyboard devices
sudo waykey --list
-
Named Pipe Output
# In one terminal sudo waykey # In another terminal cat /tmp/waykey_pipe
-
State File
# Monitor the state file watch -n 0.1 cat /tmp/waykey_state.json
- Install the waybar-waykey script (if building from source):
# Download the script
curl -s "https://raw.githubusercontent.com/himonshuuu/waykey/main/extra/waybar.py" -o waybar.py
# Install it
sudo install -Dm755 waybar.py /usr/bin/waybar-waykey
# Clean up
rm waybar.py
- Install the systemd service file (if building from source):
# Dowmload fhe service file
curl -s "https://raw.githubusercontent.com/himonshuuu/waykey/main/extra/waykey.service" -o waykey.service
# install it (root required)
sudo install -Dm644 waykey.service "/usr/lib/systemd/system/waykey.service"
# Cleanup
rm waykey.service
- Add to Waybar config (
~/.config/waybar/config
or~/.config/waybar/config.jsonc
):
"custom/keypress": {
"exec": "waybar-waykey",
"return-type": "json",
"interval": 0,
"format": "{}",
"tooltip": false
}
- Add styling to Waybar CSS (
~/.config/waybar/style.css
):
#custom-keypress {
background-color: #4b4b4b;
border-radius: 8px;
}
You can checkout my dofiles :P
- Start waykey service:
# Enable and start the service
sudo systemctl enable --now waykey.service
# Check service status
sudo systemctl status waykey.service
- Restart Waybar to apply changes:
# If running Waybar directly
killall waybar && waybar &
# Or with your compositor's configuration
# (e.g., using Hyprland's dispatcher)
hyprctl dispatch exec "killall waybar && waybar &"
Contributions are welcome! Feel free to open issues or submit pull requests.
This project is licensed under the GPL-3.0 license.
This project was inspired by siduck/bubbly. Thanks for the idea!
waykey can be configured using a YAML configuration file located at ~/.config/waykey/config.yml
. The configuration file supports the following options:
# Input device path (optional, will auto-detect if not specified)
device_path: /dev/input/event3
# Named pipe path (default: /tmp/waykey_pipe)
pipe_path: /tmp/waykey_pipe
# State file path (default: /tmp/waykey_state.json)
state_path: /tmp/waykey_state.json
To get started with configuration:
-
Create the configuration directory:
mkdir -p ~/.config/waykey
-
Copy the example configuration file:
cp config.yml.example ~/.config/waykey/config.yml
-
Edit the configuration file to match your preferences.
Note: Command-line arguments will override the configuration file settings.