8000 GitHub - himonshuuu/waykey: A waybar module to display keyboard interactions in real time
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

himonshuuu/waykey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

waykey

License: GPL-3.0 GitHub stars GitHub issues

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.

Features

  • 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

Requirements

  • Linux system
  • libinput - For handling input devices
  • json-c - For JSON state management
  • libyaml - For YAML configuration file parsing
  • pthread - For concurrent processing

Installation

AUR Package (Arch-based distributions)

comming soon... :D

Building from Source

Dependencies

# 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

Bulding and installation

git clone https://github.com/himonshuuu/waykey.git
cd waykey
make
sudo make install

Usage

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

Examples

# 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

Reading the Output

  1. Named Pipe Output

    # In one terminal
    sudo waykey
    
    # In another terminal
    cat /tmp/waykey_pipe
  2. State File

    # Monitor the state file
    watch -n 0.1 cat /tmp/waykey_state.json

Integration with Waybar

  1. 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
  1. 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
  1. 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
}
  1. Add styling to Waybar CSS (~/.config/waybar/style.css):
#custom-keypress {
    background-color: #4b4b4b;
    border-radius: 8px;
}

You can checkout my dofiles :P

  1. Start waykey service:
# Enable and start the service
sudo systemctl enable --now waykey.service

# Check service status
sudo systemctl status waykey.service
  1. 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 &"

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

License

This project is licensed under the GPL-3.0 license.

Acknowledgments

This project was inspired by siduck/bubbly. Thanks for the idea!

Configuration

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:

  1. Create the configuration directory:

    mkdir -p ~/.config/waykey
  2. Copy the example configuration file:

    cp config.yml.example ~/.config/waykey/config.yml
  3. Edit the configuration file to match your preferences.

Note: Command-line arguments will override the configuration file settings.

About

A waybar module to display keyboard interactions in real time

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0