[HN Gopher] Keyd: Linux Key Remapper
       ___________________________________________________________________
        
       Keyd: Linux Key Remapper
        
       Author : gigatexal
       Score  : 127 points
       Date   : 2023-06-02 05:58 UTC (1 days ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | rektide wrote:
       | This looks like a very competent & fast replacement for
       | interception-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.
        
         | codethief wrote:
         | Long-term user of interception-tools here. Has performance ever
         | been an issue for anyone? For me it hasn't, at least.
        
           | boomskats wrote:
           | I'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.
        
         | gigatexal wrote:
         | Yeah 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.
        
           | rgoulter wrote:
           | > 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.
        
           | rektide wrote:
           | I 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
        
             | gigatexal wrote:
             | Yeah I am doing the same: I took the sample global
             | configuration from the readme. It's been a trip trying to
             | retrain my finger memory.
        
       | gchamonlive wrote:
       | I 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 A, O and C. 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 wrote:
         | My naive expectation would be that you could create a us-int2
         | layout. Is that not the case?
        
           | gchamonlive wrote:
           | I 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!
        
       | sprash wrote:
       | If 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 wrote:
         | +1 to the use of a built-in approach
        
       | turtleyacht wrote:
       | Japanese 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
       | 
       | 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 wrote:
         | I 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.
        
       | goosedragons wrote:
       | Keyd is great. Really easy to use. Kmonad is another option but
       | configuring it is steeper I find.
        
       | notpushkin wrote:
       | Tangential: 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/, but it looks a bit too janky
       | to my taste. Any other ideas?
        
         | SSLy wrote:
         | I 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 wrote:
         | This 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
        
           | teo_zero wrote:
           | I don't get this. You define the layer meta_mac but there's
           | no key that uses it...
        
             | gigatexal wrote:
             | maybe on a mac keyboard this [meta_mac:M] is the key and
             | the stuff below it is how it's configured? I'm not 100%
             | sure.
        
         | davidkellis wrote:
         | I was looking for the same thing. This is what I hacked
         | together to scratch the itch:
         | https://github.com/davidkellis/mackeys
         | 
         | I run PopOS
        
         | koito17 wrote:
         | Also 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.
        
       | eviks wrote:
       | Is there anything that reaches the power of Karabiner Elements +
       | Keyboard Maestro on Linux? (e.g., where application specific
       | remapping is not experimental)
        
         | noctuid wrote:
         | I 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 wrote:
           | Thanks, 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 wrote:
             | Kanata 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
             | 
             | 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.
        
               | eviks wrote:
               | > 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.
               | 
               | No way, that's an almost non-existing class of apps.
               | Which "keyboard-friendly software" supports the
               | differentiation between tap and hold? Hold delays?
               | Simultaneous keypresses? Arbitrary alpha key modifiers
               | (hold T for Toolbar and tap 1,2,3 select different types
               | of brushes in your image app)? Support for custom
               | notifications? Knows left from right? Supports chords,
               | not just combos, including single-key shortcuts?
               | Basically, every app would need to add karabiner/katana
               | as a library and slap app-specific contexts on top of
               | that. Which apps do that???
               | 
               | > Anything else is inevitably a hack.
               | 
               | It's also the only way to make something great. There is
               | no "native" OS/app development platform that matches that
               | power, so it's very rare for an app to implement anything
               | advanced on its own
               | 
               | > for other apps that have non-customizable key shortcuts
               | 
               | But it's not a binary, even apps that offer customizable
               | key shortcuts, mostly offer underpowered versions nowhere
               | close to what a keyboard remapper can offer.
               | 
               | > When I used to use libreoffice regularly, I set up
               | modal keybindings that sent the corresponding chords to
               | libreoffice.
               | 
               | But presumably you wouldn't want to send those shortcuts
               | outside of Libreoffice, right? So you key remapper has to
               | be app-aware
               | 
               | > sketchyvim on mac to essentially use vim in any input
               | field.
               | 
               | This is great and I wish all OS had this basic
               | functionality of allowing users to use their advanced
               | text editing tools anywhere (there is also a more limited
               | browser-only, but cross-platform extension GhostText)
               | 
               | > 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.
               | 
               | Sure, also you can always copy&paste, but that's
               | friction, so not very suitable for smaller edits. Though
               | maybe you can set a keybind that would instantly open a
               | specially configured editor with a very small window size
               | (basically, the size of a text field) without any extra
               | visual stuff like gutter etc.?
               | 
               | > A lot of the examples you list don't seem to need any
               | app-specific or context-aware functionality (e.g. your
               | launcher example)
               | 
               | All of them do, e.g., app launcher requires the contexts
               | of the app state. If the app is in the foreground, it
               | will hide it, if it's in the background, it'll show it,
               | if the app isn't not launched, it'll launch it.
               | 
               | > keyszer
               | 
               | that's only X11
               | 
               | > hawck which is scriptable in lua
               | 
               | thanks for tip, Autohotkey which it aims to replace is
               | great (and lua is better, though also not a great
               | scripting language), so this would be something like
               | Hammerspoon on a Mac. That would still fall short of
               | Keyboard Maestro with its GUI where you can much easier
               | find he available actions and stich them together
               | 
               | > You have some context available but only what is
               | externally available
               | 
               | That's a very common limitation unfortunately
        
           | alwillis wrote:
           | > As someone who uses the keyboard for everything, my
           | experience so far has been that macOS is much weaker at this.
           | 
           | Based on what I've seen, this isn't true. macOS supports an
           | amazing amount of keyboard mapping capability.
           | 
           | There's a serious rabbit hole of macOS keyboard remapping;
           | you've been warned:
           | https://brettterpstra.com/topic/keybindings/
        
             | turtleyacht wrote:
             | Thank-you. Found a list of actual macOS keybindings, a
             | cheat sheet of sorts:
             | 
             | https://brettterpstra.com/projects/keybindings/
        
           | alwillis wrote:
           | You can also just Google "macos hyper key" and you'll see how
           | much is out there; this capability has been in macOS since
           | the beginning.
        
       | hickelpickle wrote:
       | I really like 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 wrote:
         | For [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.
        
       | Gabrys1 wrote:
       | I'm using this successfully: https://github.com/k0kubun/xremap
        
       | sph wrote:
       | See also: keymapper (for Windows and Linux)
       | 
       | https://github.com/houmain/keymapper
        
       | lofaszvanitt wrote:
       | Another tool which has horrible, non intuitive syntax. Whyyyy?
        
         | JdeBP wrote:
         | Which part is the horrible part? The --help and --version
         | options? The printing of diagnostics to standard output? Or the
         | INI file configuration file?
        
       | rodrigodlu wrote:
       | I 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 c aaoe on portuguese, sometimes n 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.
        
         | danieldk wrote:
         | You 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://yaowei.dev/posts/usb-to-usb-converter/
        
           | nine_k wrote:
           | This is nice. The hardest part is laptop keyboards though %)
        
         | hsbauauvhabzb wrote:
         | I moved to a keyboard with customisable firmware, as software
         | painpoints always existed - Remote Desktop and virtual machines
         | were inconsistent with how they worked etc
        
         | gigatexal wrote:
         | On X11 and Chromium and I have no issues with this in the slack
         | web version
        
       | teo_zero wrote:
       | I 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 wrote:
         | Also, 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 wrote:
           | System76 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 wrote:
         | "... 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!
        
           | teo_zero wrote:
           | From the docs:
           | 
           | > For this to work 'setxkbmap -option compose:menu' must be
           | run after keyd has started.
           | 
           | So now I need to run keyd AND setxkbmap, and setup my
           | configuration in /etc/keyd AND ~/.XCompose
        
       | yewenjie wrote:
       | What 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 wrote:
         | Delays 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/jtroo/kanata/issues/128
        
       | madwebness wrote:
       | Would 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 wrote:
         | It has been in the FreeBSD ports collection since August 2021.
        
           | madwebness wrote:
           | Fantastic.
        
       | zoeey123 wrote:
       | I love this app! Big thanks to the dev
        
       | Already__Taken wrote:
       | Is 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 wrote:
         | there's app specific configs you can do. Try that.
        
       | roywashere wrote:
       | This 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
        
       | botanical wrote:
       | Does 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.
        
         | cycomanic wrote:
         | The 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
        
         | [deleted]
        
         | bogdan wrote:
         | It does, been using it for a year or so.
        
           | botanical wrote:
           | Thank you for letting me know! I just started using it and
           | it's working perfectly
        
       | lolive wrote:
       | Not 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)
        
         | noctuid wrote:
         | I'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.
        
         | accoil wrote:
         | Kanata 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
        
       | dottjt wrote:
       | Kind of crazy, I was literally looking for a solution to this
       | about an hour ago, and then this popped up.
        
         | endorphine wrote:
         | Same here
        
           | gigatexal wrote:
           | isn't that why we refresh HN every 30 mins? ;-)
        
       | nikivi wrote:
       | If 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
        
         | eviks wrote:
         | Awesome 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 wrote:
         | On 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.
        
         | sudhirkhanger wrote:
         | Karabiner 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.
        
         | fellowniusmonk wrote:
         | This 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.
        
         | sy7ar wrote:
         | Doesn't that get triggered if you type "after" fast enough?
        
       | tacone wrote:
       | I 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.
        
         | MountainMan1312 wrote:
         | I'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 wrote:
           | Here 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.
        
           | TacticalCoder wrote:
           | I'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.
        
       ___________________________________________________________________
       (page generated 2023-06-03 23:01 UTC)