https://github.com/acro5piano/wayremap Skip to content Sign up * Why GitHub? + Features + Mobile + Actions + Codespaces + Packages + Security + Code review + Issues + Integrations + GitHub Sponsors + Customer stories * Team * Enterprise * Explore + Explore GitHub + Learn and contribute + Topics + Collections + Trending + Learning Lab + Open source guides + Connect with others + The ReadME Project + Events + Community forum + GitHub Education + GitHub Stars program * Marketplace * Pricing + Plans + Compare plans + Contact Sales + Education [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} acro5piano / wayremap Public * Notifications * Star 14 * Fork 0 * Dynamic key remapper for Wayland Window System, especially for Sway MIT License 14 stars 0 forks Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show Loading {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default Loading View all tags 1 branch 0 tags Code Loading Latest commit @acro5piano acro5piano add key to demo bindings ... b8821a5 Dec 9, 2021 add key to demo bindings b8821a5 Git stats * 23 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows add CI Dec 9, 2021 wayremap get sway path automatically Dec 9, 2021 .gitignore add gitignore Dec 9, 2021 LICENSE init Dec 9, 2021 README.md add status badge Dec 9, 2021 poetry.lock add CI Dec 9, 2021 pyproject.toml add CI Dec 9, 2021 test-module.py add key to demo bindings Dec 9, 2021 View code wayremap Motivation Install Run Known bugs Roadmap README.md test wayremap Dynamic keyboard remapper for Wayland. It works on both X Window Manager and Wayland, but focused on Wayland as it intercepts evdev input and require root permission. Motivation Sway and Wayland is awesome. It brings lots of benefit to Linux desktop environment. When I was using X desktop envionment, there is an awesome tool called xremap which remap keys based on current focused application. https://github.com/k0kubun/xremap I was looking for something similar to xremap for Wayland, but not found, so I decided to create on my own. Install sudo pip install wayremap Run For Wayland security model, we have to do execute key remapping as root. Simply write your own service and run it as python script: # /opt/wayremap.py from wayremap.config import WayremapConfig, Binding from wayremap.main import run import uinput as k wayremap_config = WayremapConfig( applications=[ 'Chromium', 'Brave-browser', 'Leafpad', 'firefoxdeveloperedition', ], bindings=[ # Emacs-like key binding Binding('ctrl.alt.a', [[k.KEY_LEFTCTRL, k.KEY_HOME]]), Binding('ctrl.alt.e', [[k.KEY_LEFTCTRL, k.KEY_END]]), Binding('ctrl.alt.h', [[k.KEY_LEFTCTRL, k.KEY_BACKSPACE]]), Binding('ctrl.f', [[k.KEY_RIGHT]]), Binding('ctrl.b', [[k.KEY_LEFT]]), Binding('ctrl.p', [[k.KEY_UP]]), Binding('ctrl.n', [[k.KEY_DOWN]]), Binding('ctrl.k', [[k.KEY_LEFTSHIFT, k.KEY_END], [k.KEY_LEFTCTRL, k.KEY_X]]), Binding('ctrl.a', [[k.KEY_HOME]]), Binding('ctrl.e', [[k.KEY_END]]), Binding('ctrl.y', [[k.KEY_LEFTCTRL, k.KEY_V]]), Binding('alt.f', [[k.KEY_LEFTCTRL, k.KEY_RIGHT]]), Binding('alt.b', [[k.KEY_LEFTCTRL, k.KEY_LEFT]]), Binding('alt.d', [[k.KEY_LEFTCTRL, k.KEY_DELETE]]), Binding('ctrl.h', [[k.KEY_BACKSPACE]]), Binding('ctrl.s', [[k.KEY_LEFTCTRL, k.KEY_F]]), # OSX-like key binding Binding('alt.a', [[k.KEY_LEFTCTRL, k.KEY_A]]), Binding('alt.c', [[k.KEY_LEFTCTRL, k.KEY_C]]), Binding('alt.v', [[k.KEY_LEFTCTRL, k.KEY_V]]), Binding('alt.x', [[k.KEY_LEFTCTRL, k.KEY_X]]), # Slack helm! Binding('alt.x', [[k.KEY_LEFTCTRL, k.KEY_K]]), ]) run(wayremap_config, '/dev/input/event4') And then sudo modprobe uinput sudo python /opt/wayremap.py Note that '/dev/input/event4' varies among system. Known bugs * 3 is pressed when changing focused window * Key repeating become slow while switching focused windowd Roadmap * Packaging for Arch Linux, Debian, Fedora, etc. * Enable to load per-application config. * Re-write in Rust for better performance. About Dynamic key remapper for Wayland Window System, especially for Sway Resources Readme License MIT License Releases No releases published Packages 0 No packages published Languages * Python 100.0% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.