8 ms·
Keyd: Linux Key Remapper
- rektide 3y agoThis looks like a very competent & fast replacement for interception-tools (https://gitlab.com/interception/linux/tools https://gitlab.com/interception/linux/tools). Nice. Having multiple layers is very interesting to me. Being able to quickly swap config is also compelling.
- gigatexal 3y agoYeah I’m really looking forward to playing with this. Going to map caps lock to escape for vim. But the sky is the limit: with all the layer stuff.
- rektide 3y agoI was using caps-lock for control for a while. But dual mode, where caps lock is escape if pressed alone, control if pressed in combination with anything is soooo good. Huge upgrade, highly recommend. An interesting base example of stateful key presses
- rgoulter 3y ago> the sky is the limit: with all the layer stuff. Some techniques I've liked / made use of (although I support may vary depending on the tool you use): - Using tap-hold to put Shift/Ctrl/Gui/Alt on home row underneath fdsa (and on the right-hand side, too). - "Caps Word", where CapsLock functionality is enabled until a non-[A-Za-z0-9_] letter is input. - Having a 'combo'/'chord' where pressing 'cv' or 'm,' would take me to the previous/next virtual desktop.
- codethief 3y agoLong-term user of interception-tools here. Has performance ever been an issue for anyone? For me it hasn't, at least.
- boomskats 3y agoI'm having a great time with interception-tools. I'm finding it more stable / consistent than xcape (which I had been using for a few years prior), to the extent that I've moved some of my QMK functionality to interception-tools so that I can have better consistency between laptop and external keyboard.
- codethief 3y agoExactly, I, too, used to use xcape and am very happy with interception-tools.
- dottjt 3y agoKind of crazy, I was literally looking for a solution to this about an hour ago, and then this popped up.
- endorphine 3y agoSame here
- gigatexal 3y agoisn't that why we refresh HN every 30 mins? ;-)
- nikivi 3y agoIf you're on mac, Karabiner is the best tool for remapping. I use it to remap normal keys to hyper keys. So pressing on `a` key together with `f` will do control + f and things like this. https://wiki.nikiv.dev/macOS/apps/karabiner https://wiki.nikiv.dev/macOS/apps/karabiner
- fellowniusmonk 3y agoThis is amazing, I can't believe I haven't seen this before, mapping caps_lock to right command and using rcmd for app switching is amazing, previously I just had caps set to esc and used left_command + esc as a global toggle for terminal. I tried remapping a normal letter key's (a) long press to a command+a but it seems to actually trigger the letter "a" before triggering the modifier.
- eviks 3y agoAwesome app, though unfortunately it doesn't support proper alpha-to-hyper modifiers that wouldn't interfere with typing (tweaking various delays help, but still not equivalent), and lacks some in-app context like whether you're in a text field within an app
- dtgriscom 3y agoOn my Macbook Pro, the only thing I use Karabiner for is to map my right Option key to a true "Enter" key (as opposed to the "Return") key. I'm sure I'm under-utilizing it, but it works great for that.
- sy7ar 3y agoDoesn't that get triggered if you type "after" fast enough?
- sudhirkhanger 3y agoKarabiner is amazing and unfortunately I haven't found an equivalent on Linux. I use Karabiner for the following usecase. * Mapped both caps lock and return key when they are clicked with another key to act as Ctrl. When they are clicked alone without combination then they work as ususal.
- notpushkin 3y agoTangential: I'm currently looking for a way to map Mac-style shortcuts on Linux (e. g. Meta + C/V for copy / paste). The only thing I know is https://kinto.sh/ https://kinto.sh/, but it looks a bit too janky to my taste. Any other ideas?
- koito17 3y agoAlso tangential: I'm looking for this kind of solution too. I always rejected xmodmap on the basis of it being specific to X11 and not necessarily "working everywhere". I personally want to be able to use S-c and S-v to copy-paste everywhere, but have a solution that works across all programs: terminal, Emacs, Firefox, etc.
- SSLy 3y agoI have looked into this a year ago, with the goal of having some key - named control or not- always perform the emacs-lite operations we know from readline. But it seems like it's very tedious, as most of GUI toolkits expect the windows-like behaviour and are not reconfigurable
- knazarov 3y agoThis is how I do it in keyd by remapping Meta+C/V to C+Ins/Shift+Ins (keyd.conf): [ids] * [main] capslock=overload(control, esc) [meta_mac:M] c=C-insert v=S-insert
- davidkellis 3y ago
- Gabrys1 3y agoI'm using this successfully: https://github.com/k0kubun/xremap https://github.com/k0kubun/xremap
- roywashere 3y agoThis is actually really nice. I don’t like the solutions which only work on X or worse, only in Gnome. I have a programmable keyboard and like that solution best, wherever I plug in my keyboard the keys are mapped just the way I like it! But for your laptop keyboard on your Linux laptop this seems like a great solution
- lolive 3y agoNot yet investigated keyd. I still use good old .Xmodmap tricks on Linux, and AutoHotKey on Windows. Plus some VIA macros directly on my programmable keyboard. And I [plan to] investigate kanata (https://github.com/jtroo/kanata https://github.com/jtroo/kanata)
- accoil 3y agoKanata is good. I use it to have some consistent keyboard configuration between Linux and Windows. One nice feature it has over AutoHotKey[^1] is that it can use Interception (a keyboard filter driver) to handle keys earlier, which lets it work in more situations (e.g across RDP sessions). Interception itself though does have a bug where if you keep adding/removing devices it will stop working until you restart. 1: I've seen an Interception module for AHK, but it's not built in like Kanata's
- noctuid 3y agoI've tried about ten billion different tools on linux and can confirm that kanata is better than everything else mentioned in this thread and a lot more. It's not the right tool for global hotkeys, so it's not going to completely replace something like AHK or wkhd, but it's basically the closest thing to QMK functionality for a laptop or non-programmable keyboard.
- sprash 3y agoIf you are looking for static system wide key remapping on the console without additional dependencies, extra software or running daemons the program "loadkeys" should be working on any Linux system. Configuration on startup is dependent on the distribution.
- gigatexal 3y ago+1 to the use of a built-in approach
- goosedragons 3y agoKeyd is great. Really easy to use. Kmonad is another option but configuring it is steeper I find.
- yewenjie 3y agoWhat is the values of delays that work for you? For example, my capslock key acts as both escape and control - but I am yet to find the delays that will let me smoothly roll over to other keys from escape.
- noctuid 3y agoDelays are a terrible solution. Looking at key overlap percentage, for example, works much better. There are a lot of other ways to make dual-use/tap-hold functionality more reliability, but lots of programs actually implement overlap checks. The kaleidoscope keyboard firmware, for example, lets you configure a minimum overlap threshold for a key to start acting as its secondary role (e.g. only have space act as a modifier when it is pressed first and is held for 70% of the time the second key is pressed). In your case, I'm not sure why you would need to roll over to other keys from escape. My shift key doubles as escape, and I don't use any delay or checks at all since I don't rapidly type escape then other keys. In any case, you could try configuring your capslock key to only act as control if it being held fully overlaps with the next keypress. Not sure about keyd, but kmonad and kanata both support this (I'd highly recommend kanata). That may require changing how you type depending on the modifier, which is why more fine-grained overlap threshold checks can be useful. Relevant github issues: https://github.com/kmonad/kmonad/issues/351 https://github.com/kmonad/kmonad/issues/351 https://github.com/jtroo/kanata/issues/128 https://github.com/jtroo/kanata/issues/128
- Already__Taken 3y agoIs this gonna help my chromebook alt-key when using vscode in linux? Because there's no special key the alt is used as alt+backspace = delete and a few other things. It makes alt-up/down and alt+shift copy up down not work.
- gigatexal 3y agothere's app specific configs you can do. Try that.
- botanical 3y agoDoes this work on wayland? I used to have Caps mapped as Escape when pressed alone but as Ctrl when in combination with another key. On wayland, there's no easy way on sway or gnome (which is what I used on Ubuntu). There is `caps2esc` and `interception_tools`. But I had some problems with it interfering with startup sometimes on sway. But on Ubuntu gnome, I haven't tried it again.
- deleted 3y ago[deleted]
- cycomanic 3y agoThe first paragraph: > Linux lacks a good key remapping solution. In order to achieve satisfactory results a medley of tools need to be employed (e.g xcape, xmodmap) with the end result often being tethered to a specified environment (X11). keyd attempts to solve this problem by providing a flexible system wide daemon which remaps keys using kernel level input primitives (evdev, uinput). So yes it seems to work on both x and wayland
- bogdan 3y agoIt does, been using it for a year or so.
- botanical 3y agoThank you for letting me know! I just started using it and it's working perfectly
- sph 3y agoSee also: keymapper (for Windows and Linux) https://github.com/houmain/keymapper https://github.com/houmain/keymapper
- eviks 3y agoIs there anything that reaches the power of Karabiner Elements + Keyboard Maestro on Linux? (e.g., where application specific remapping is not experimental)
- noctuid 3y agoI never looked at karabiner's full functionality, but kanata is the closest thing to a linux version of QMK. It can kind of be used for hotkeys, but that's really not its purpose. Better to use a separate hotkey daemon. Keyboard Maestro would be replaced by one or more completely different tools. There are programs that allow application-specific mapping. I've never seen the point of it, so I can't comment if any of them are any good. What are you looking to do? As someone who uses the keyboard for everything, my experience so far has been that macOS is much weaker at this.
- eviks 3y agoThanks, I'm aware of kanata, though haven't properly investigated it yet, the one area where it can beat Kara+ is if it implemented non-delayed based home row mods (though that's still an open issue; don't remember whether QMK supports it perfectly or also with delays, but a software solution to this would be much appreciated for all the laptops). The low-level remapping and higher level app-specific and context-aware functionality is the Holy Grail that's still unachievable in any system, unfortunately, so that's why I specifically asked about the combo > What are you looking to do There are way too many interactions for me to list, it's anything from disabling all shortcuts when you play a game to quitting Insert text editor mode when you hold I, to making chord-based command menus with visual cues in apps that don't support anything like that, to inserting special symbols with helpful popups that only popup if you stumble and forget which key is next, to showing a palette with apps to launch with single keys without having to remember all those keys You simply can't achieve it only via QMK-low-level approach
- noctuid 3y agoKanata supports early tap-hold dispatch based on key overlap, which is all I need. There's an open issue for more advanced conditions: https://github.com/jtroo/kanata/issues/128 https://github.com/jtroo/kanata/issues/128 The maintainer has been very responsive in my experience and would probably add more advanced conditions if someone wanted them. > There are way too many interactions for me to list Sounds like mostly hackarounds for non-keyboard-friendly software. I generally prefer to use keyboard-friendly software (of which there is no shortage on linux) and just make application-specific keybindings directly in each application. Anything else is inevitably a hack. Window management, browsing, anything related to text or programming, etc. all have good keyboard-friendly options. I have to use some stuff like excel and teams for work, but I'll just use the mouse more in those cases. I don't spend a significant amount of time dealing with applications like that though, and e.g. for Teams I'd try set up a matrix bridge or just use warpd before trying anything else. Teams no longer supports linux, but for other apps that have non-customizable key shortcuts, it's definitely possible hack around that and create your own in linux. E.g. When I used to use libreoffice regularly, I set up modal keybindings that sent the corresponding chords to libreoffice. As long as I can use my editor to type anything non-trivial, I'm good. For example, you have generic software like sketchyvim on mac to essentially use vim in any input field. I don't think there's a linux equivalent that lets you essentially embed an editor like vim inside any input field, but you can use a generic keybinding to open one and then have the text sent back when you're done. A lot of the examples you list don't seem to need any app-specific or context-aware functionality (e.g. your launcher example). I don't have enough of an idea of what you actually want to know if what's available on linux would support your use cases, but in addition to the numerous basic hotkey daemons there are programs like keyszer that support application-specific keybindings ootb or hawck which is scriptable in lua and supports conditional keybindings (allowing you to script per-application keybindings). You have some context available but only what is externally available, i.e. unless the program provides some way to interact with it like a cli utility or ipc socket, all you're going to be able to do is send input to it.
- gchamonlive 3y agoI write often in English and Portuguese but I have a US keyboard. What I do is I map A, O and C with Altgr to Ã, Õ and Ç. I modified manually the keyboard configuration for us-intl layout, which works but time and again the file gets overwritten during system updates. The fix is simple, just copy the backed up file and set the layout using setxkbmap, but it is quite annoying. I'll try this out!
- maxerickson 3y agoMy naive expectation would be that you could create a us-int2 layout. Is that not the case?
- gchamonlive 3y agoI could try it out, haven't really thougt I could derive layouts without modifying the original files, but when I come to think of it this is so basic I'm surprised it didn't occur to me... I will check it out!
- rodrigodlu 3y agoI saw some comments/issues on poor experience with international keyboards, specially wayland+chromium stuff (so virtually all electron apps). Anyone mind sharing how to avoid such pitfalls? Or going straight to kanata? I usually use us-intl or us international with alt-gr dead keys for characters like ç áãóê on portuguese, sometimes ñ for spanish. My notebook keyboard is pt-br abnt, but usually I'm on either a keychron k3 pro or a mx keys with US ansi layout. btw I really liked the idea of using normal keyboards (logitech mx keys, notebook keyboards) like a qmk one. Also having only one extra layer on keychron is preventing me to do more.
- hsbauauvhabzb 3y agoI moved to a keyboard with customisable firmware, as software painpoints always existed - Remote Desktop and virtual machines were inconsistent with how they worked etc
- microtonal 3y agoYou could also make/get a converter that turns pretty much any USB keyboard into a QMK keyboard: https://geekhack.org/index.php?topic=69169.0 https://geekhack.org/index.php?topic=69169.0 https://yaowei.dev/posts/usb-to-usb-converter/ https://yaowei.dev/posts/usb-to-usb-converter/
- nine_k 3y agoThis is nice. The hardest part is laptop keyboards though %)
- gigatexal 3y agoOn X11 and Chromium and I have no issues with this in the slack web version
- hickelpickle 3y agoI really like https://github.com/jbensmann/mouseless https://github.com/jbensmann/mouseless as it will also let you remap keys to control the mouse. I went down a rabbit hole of key remapping, and can't remember exactly why I settled on it, but posting as an alternative for others to look at. I thrive off caplock as a toggle for remapped keys. I turn my sdf-234 into a numpad and jkl; for arrows and some other text navigation binds so I never need to veer far from the home row. caps-/ for ~ I can't live without.
- lolive 3y agoFor [single mouse click] I use warpd on Linux almost exclusively. I hope an equivalent [with the same configurability] will be available on Windows one day.
- lofaszvanitt 3y agoAnother tool which has horrible, non intuitive syntax. Whyyyy?
- JdeBP 3y agoWhich part is the horrible part? The --help and --version options? The printing of diagnostics to standard output? Or the INI file configuration file?
- madwebness 3y agoWould this somehow work on FreeBSD/OpenBSD? I'm definitely about to start remapping keys, but I haven't researched the tooling there. So far, I assume the underlying lower level mechanisms are the same (at least for X). Does anybody know whether this would compile and work on FreeBSD & OpenBSD?
- JdeBP 3y agoIt has been in the FreeBSD ports collection since August 2021.
- madwebness 3y agoFantastic.
- tacone 3y agoI am using Xmodmap at the moment and I find it frustrating since it doesn't work in all the apps. Loadkeys doesn't also work everywhere. For some reason some key combination gets intercepted by the apps. Ian very hopeful keyd will work. I am currently remapping keys to have VIM style arrow keys in the middle of the keyboard. That works everywhere but if you add Ctrl and Shift to the mix you it doesn't work everywhere anymore.
- BillyTheMage 3y agoI'm having similar adventures in Emacs/EXWM with trying to implement Super + IJKL movement. It works fine until you start adding other modifiers into the mix, especially Shift.
- TacticalCoder 3y agoI'm using "Hyper + ijkl" in X11 and it works in every app, not just Emacs. Basically I made a custom .xkb file which does send the actual arrow keys code when "Hyper + ijkl" is pressed. It works in drop down menus, in terminal, anywhere. It's like pressing the arrow keys. And it works fine with shift, for as far as any app are concerned they're only seeing "shift + arrow key(s)". It would work with Super too. I'll find some part of the .xkb file and paste them here in a few moments.
- TacticalCoder 3y agoHere are the relevant parts of my .xkb file. Note that the "osfUp" code is code I found elsewhere (don't remember where). Just repeat it for Left, Right and Down. I first added this new "THREE_HYPER" using three levels (you can add more levels if you fancy that): type "THREE_HYPER" { modifiers= Shift+Hyper; map[Shift]= Level2; map[Hyper]= Level3; map[Shift+Hyper]= Level3; level_name[Level1]= "Base"; level_name[Level2]= "Shift"; level_name[Level3]= "Hyper3"; }; Then the "interpret" does the magic: interpret osfUp { repeat= True; action = RedirectKey(keycode=<UP>, clearmodifiers=Hyper); }; And for each key, assign the arrow key redirection you want (showing only "i" for up here): key <AD08> { type= "THREE_MESH_HYPER", symbols[Group1]= [ i, I, osfUp ] }; I'd say that it's not a job for xmodmap but for .xkb. Also I don't use xmodmap at all: I set everything, including all the modifiers, from my .xkb file. My xmodmap output for Hyper (which I set, from .xkb, as mod5): ... $ xmodmap | grep mod5 mod5 Hyper_L (0xcf) You'll want to read on .xkb but this should get you started.
- zoeey123 3y agoI love this app! Big thanks to the dev
- teo_zero 3y agoI think this would be valuable if it replaced ALL other tweaks and hacks. According to the docs, it still requires other tools/configurations e.g. to make compose work.
- nine_k 3y agoAlso, on all keyboards, not just custom ones :) This, and KMonad, finally allow me to have e.g. modifier keys on the home row right on my stock laptop keyboard. (Maybe someday Framework laptops will support ergonomic keyboards. Thinkpads never will, I suppose.)
- klibertp 3y agoSystem76 keyboard-configurator - a Rust frontend to the keyboard firmware, for laptops at least - is very nice. It doesn't do that much, but it allows you to remap every single key to any other. Fn, Caps Lock, AltGr, Menu everything![1] Since you can make any special key not be special, you can then use xbindkeys or keyd to create more complex configurations without worrying about the keyboard sending unsupported, or sending no key codes at all. [1] Almost. Many XF86... codes (eg. XF86TouchpadToggle) are not supported, although I suspect hacking the firmware or keyboard-configurator to add them wouldn't be that hard.
- gigatexal 3y ago"... make compose work" what do you mean by that? What was interesting is that this brings QMYK(?) functionality of different modes to "dumb" keyboards. I think that's really dope!
- turtleyacht 3y agoJapanese Industrial Standard (JIS) mac OS keyboards have an extra hyper key on the right side of the spacebar. Comparison pics below: https://appleshinja.com/us-jis-hikaku https://appleshinja.com/us-jis-hikaku It also looks like there's an extra key next to the ?-mark key. I would love to master Ctrl & Alt (plus maybe the "Windows" key) across Linux, mac OS, and Windows, and load the rest with arcane macros. Just that the Unicomp 101 refuses to break, so I don't have a Windows key either.
- TacticalCoder 3y agoI use a Japanese keyboard for that very reason (even though I don't speak japanese). I don't think that, technically, it's an "hyper key". These are the henkan and muhenkan keys, to switch input methods (kanas / romanji / etc.). But that's precisely how I use these keys: I remap the one at the left of the (always very narrow on japanese keyboard) spacebar to "Hyper". Note that the USB HID doesn't have the concept of the Hyper key (so I remap it from X11 / xkb). Now... Some may wonder: why buy a japanese keyboard and not some fancy ergonomic / DIY keyboard? Several reasons. Japanese is kinda a big country and japanese keyboards are here to stay, so my trick shall keep working until long after I'm dead. Japanese laptops: japanese keyboard on the laptop, I now effectively can have a laptop with a "Hyper" key. And then the main one: the DIY keyboard community can apparently only do variations of Cherry switches or similar switches. My switch of choice is Topre. I didn't find any DIY keyboard with Topre switches. So I use a japanese keyboard, with Topre switches. And I remap it and there's nothing "japanese" about it anymore.
- slimneo 3y agoI'm using on X11 https://github.com/sezanzeb/input-remapper https://github.com/sezanzeb/input-remapper (currently 2.4k stars) "Supports X11, Wayland, combinations, programmable macros, joysticks, wheels, triggers, keys, mouse-movements and more." My use cases are: - System wide VIM like key mapping - Access umlauts from my US-keyboard layout - Key remapping It's also working great to remap the 10+ buttons of a razer naga mouse
- bjoli 3y agoI use this (because I'm lazy) to remap caps lock to ctrl if pressed with another key. If not it is backspace. I also switched position for Q and escape (q is very rare in Swedish)