8 ms·
Hacking Your Keyboard
- cerberusss 7y agoIf you like Karabiner-Elements, please support the developer: https://pqrs.org/osx/karabiner/pricing.html https://pqrs.org/osx/karabiner/pricing.html Takayama Fumihiko has been keeping the kernel extension up to date for many, many years now. Apple is putting up road limits here and there, to provide security, and he jumps through all of their hoops. Every year I upgrade to the latest version of macOS, Karabiner-Elements is ready for the new OS. And every time I donate.
- davefp 7y agoGood read! If folks are interested in getting deeper into keyboard hacking I highly recommend looking into a board that supports [QMK](https://qmk.fm/ https://qmk.fm/), which is a very hackable set firmware that works across a bunch of boards.
- sorcercode 7y agoappreciate it. I actually started out with QMK on my Tada68 to emulate a lot of this. I’ve found karabiner is a tad bit easier for cross keyboard compatibility (not to mention I bricked my Tada atleast twice attempting it ). But QMK is definitely awesome cause no need of installing software. Just plug your keyboard anywhere and you’re off to the races.
- markstos 7y agoI've switched to QMK-powered keyboards and plan to stick with them. My big feature was being able to program shortcuts that I like for Chrome OS that Chrome OS doesn't allow customizing natively. Using the layer system I have "Chrome" layer and "Gnome" layer so I can use the same shortcuts on both Linux and Chrome OS. I just toggle on the right compatibility layer once at the beginning of the session.
- Klathmon 7y agoI've recently gone off the deep end with QMK customization. I found a project [1] which allows you to send data from a host program to the keyboard controller. In [1]'s case it's used to power a secondary display on the keyboard with information like system stats and weather and stuff. But I've been experimenting with using it for more integration with the host system. Imagine instead of having to toggle the layer yourself, you could have a small script running on the host system which could tell your keyboard the currently focused application, and your keyboard could switch layers automatically. In my situation, I want a spare ortholinear keyboard to be used as a macro pad of sorts, but rather than just pressing a key combination I want to be able to run full commands (I have a button that opens HN in a new browser tab, one that opens a new terminal to my home directory, one that will open whatever I currently have highlighted in https://devdocs.io https://devdocs.io in a new tab, that kind of stuff). I've also been working with trying to tie in things like the host machine's volume level to display on the keyboard display, and I tend to switch my keyboard between a windows and mac system, so I want to see if I can get it to auto-detect the OS and switch various keys around so I have a consistent experience without having to toggle anything myself. There's so many options you can do when you open up true 2-way communication with a keyboard! [1] https://github.com/BlankSourceCode/qmk-hid-display https://github.com/BlankSourceCode/qmk-hid-display
- narze 7y agoI second this, use both QMK on my customized 40%-ish keyboards and Karabiner on Macbooks, with similar configuration
- bargle0 7y agoQMK is awesome. I built an Arduino box running QMK to sit between my old model M and the computer to give me a lot of flexibility.
- kelchm 7y agoQMK is great — I’ve been using a ‘SpaceFN’ layout on all my 60% keyboards for a few years now and love it.
- platz 7y agoThis isn't keyboard hacking so much as desktop environment hacking
- vinceguidry 7y agoIf you get deep enough into it, the path of least resistance slowly becomes using Emacs for everything. Macros at the keyboard level still have their uses, for all the things Emacs can't do. As emacs becomes more popular, expect that list to get smaller. Of course, if you're not a coder, emacs will never replace your Excel / Photoshop / AutoCAD etc. custom macros.
- bitwize 7y agoEmacs had its chance. It lost to Vim, and then VSCode ate what remained of its lunch.
- vinceguidry 7y agoThe sound of my eyes rolling ever harder at tech faddism.
- cerberusss 7y agoIf eye movement makes an audible sound, you might want to get those checked out :)
- Scarbutt 7y agoVScode ate everyone's launch, even Jetbrains must be cursing Microsoft every day. That said, as emacs user, I see vim users switching to emacs/evil by the day.
- chiefsucker 7y agoI switched recently from Vim to Evil after more than two decades, mainly because I prefer proportional fonts these days, and also because of Magit (I’m really annoyed by “free” Git GUIs going the subscription route after building up a big enough user base). The road has been bumpy so far, but I’m slowly getting used to Emacs’ idiosyncrasies. The journey has been worth it.
- clarry 7y ago
- knubie 7y agoI use karabiner to map capslock to control when held down, and to escape when just pressed. It's really handy for vim.
- sorcercode 7y agoI like mapping my right cmd key to ctrl, and doing the same thing as you for caps lock but tapping yields an escape.
- datashow 7y agoMay not be relevant to the article, but the 80% keyboard is what I want (I never use the numpad, but I use home/end/page up/page down a lot), but I can't find many choices on the market.
- Kwantuum 7y ago65% might work for you. I have a tada68, and it has arrow keys, page up/down and delete. Has the added benefit of getting rid of the function key row (but you can still use them using the fn key), the home and end keys are also pretty easy to access with the fn modifier.
- datashow 7y agoThank you. However, I do need Home/End keys, because I use Home/End, shift+Home/End, ctrl+Home/End, ctrl+shift+Home/End frequently. I also like low-profile keys (effortless key pressing) like the ones on a laptop keyboard. I found the 75% on this page could also be a good choice: https://blog.wooting.nl/the-ultimate-guide-to-keyboard-layouts-and-form-factors/ https://blog.wooting.nl/the-ultimate-guide-to-keyboard-layou... Edit: Ha! I just found a 75% keyboard on Amazon: https://www.amazon.com/dp/B07M9PGMT9/ https://www.amazon.com/dp/B07M9PGMT9/ Another one: https://www.amazon.com/dp/B07JGQP89G/ https://www.amazon.com/dp/B07JGQP89G/
- sorcercode 7y agoThis reminds me: I need to port my yuio keys to home/pg down/pg up/end + caps lock.
- Scarbutt 7y agoshift+Home/End, ctrl+Home/End, ctrl+shift+Home/End What does this ones do?
- datashow 7y agoThose are shortcuts on Windows shift+Home/End: select from current cursor to the beginning / end of the line ctrl+Home/End: jump to the beginning / end of the document ctrl+shift+Home/End: select from current cursor to the beginning / end of the document
- TeMPOraL 7y agoDon't know how it compares feature-wise to Karabiner/Goku, but on Windows, you can use AutoHotkey[0] to do all kinds of global input remapping, macros, etc. Someone even wrote a clone of DWM (tiling window manager) in AutoHotkey![1]. Personally, I use it mostly to remap CTRL to Caps Lock, but once I wrote a global GUI popup for inserting reaction emojis into conversations on my work machine. AHK is really easy to work with. -- [0] - https://www.autohotkey.com/ https://www.autohotkey.com/ [1] - https://github.com/fuhsjr00/bug.n https://github.com/fuhsjr00/bug.n
- sorcercode 7y agoNeat! A few folks have asked how I would emulate Keyboard Maestro on Windows. I used Autokey back in the days of my Windows usage. I’ll more confidently recommend it now
- rzzzt 7y agoOn Windows 10, Win + . should bring up a global emoji toolbar that also supports searching by name.
- TeMPOraL 7y agoDidn't know that, thanks! .
- Scoundreller 7y ago> I use it mostly to remap CTRL to Caps Lock Heh, I had to do a similar thing with AHK when I vacuumed a key off my laptop.
- dubyajaysmith 7y agoI've really enjoyed my Anne Pro 2. It has software for Linux so you get tons of customizations out of the box graphically.
- geniium 7y agoBy reading this article I discovered the Anne Pro 2. Seems very similar to the Pok3r keyboard.
- darkteflon 7y agoThe article sent me down a 60% rabbit hole for the past hour or so. Almost bought a Pok3r v2.
- geniium 7y agoPersonnaly I use Hammerspoon as my main desktop environment hacking and added a few shortcuts with Karabiner. By using the two of them, you can use any keyboard (native macbook pro or external) and manipulate your windows, setup pomodoro timer or launch/activate your favorite programs. Feels great!
- cerberusss 7y agoYup, me too. I've configured Hammerspoon with a bunch of functions that put my windows at 25%, 33%, 50%, 66% or 75% to the left or right. I couldn't find a window manager that can do both quarters and thirds, and now I'm in love with Hammerspoon.
- sorcercode 7y agoSweet! I’ve heard of Hammerspoon but Keyboard Maestro has been my poison for sometime. Offers every bit of programming functionality with a super easy UI.
- kortex 7y agoKarabiner is great, but my daily driver is an Ergodox EZ, and it's truly the best. I can edit nearly everything in the web configurator gui, but if I wanted to get crazy, the gui can export the QMK source code and I could compile myself. The thing that my workflow really needs now is a way to organize/focus specific windows (e.g. a particular IDE window or browser). like I want to be able to assign (on the fly) hotkeys like Alt-1 Alt-2 etc to specific windows. This is Ubuntu 18 though if such a thing is easier on Mac I could make that my main dev environment (I'm thinking of switching soon anyways once I port my workflow)
- sorcercode 7y agoSo in combination with Keyboard Maestro (the other piece of software I mention in my post) you can pretty easily wire something like what you ask, on the Mac. Keyboard Maestro is truly one of the best productivity software for the Mac.
- pedrovhb 7y agoFor all the pains it introduces because everything Just Stops Working™, I find the i3 window manager to be fantastic for my windowing workflow. Once you have decided what goes into each workspace and have a bit of muscle memory for the tiling, switching is instant and organizing is trivial. Never drag a window again! These blog posts helped a lot in configuring some basic stuff (that IMO really should be available out of the box; I get that i3 is supposed to be light and customizable but it feels really user-hostile on a new install): https://feeding.cloud.geek.nz/posts/creating-a-modern-tiling-desktop-environment-using-i3/ https://feeding.cloud.geek.nz/posts/creating-a-modern-tiling... https://cravencode.com/post/essentials/enable-tap-to-click-in-i3wm/ https://cravencode.com/post/essentials/enable-tap-to-click-i...
- kortex 7y agoYeah I've seen i3 and it looks cool but does it work with regular graphical X window applications? It seems like it's mostly text based though I have seen images in panes.
- zeronone 7y agoI usually buy laptops with Japanese keyboard, which gives you three extra keys and use Karabiner to repurpose them.
- aptidude187 7y agoAbsolutely love the idea, will do the same thing in the future! Since I started remapping many keys with Karabiner, I became annoyed that the spacebar is so huge and wished that they had added more keys instead. The Japanese keyboard looks fantastic for my purposes. Thank you very much!
- unnouinceput 7y agoOr you know, buy a gaming keyboard that has a ton of extra macro keys and besides those, the dedicated software can do way more then just the article says. Personally I love my gaming Razor keyboard/mouse, it allows me to do a lot more stuff then what's in article about Karabiner.
- sorcercode 7y agoWhat are some examples of these macros ? I’d love to hear more ideas and tricks.
- unnouinceput 7y agoFor me, with 10 macro keys on my keyboard and 4 on my mouse and combined with Razor profile on their software it means that depending on what I do I can: 1- On online RPG games like GuildWars1/2 I can press one macro key and a full chain of several keystrokes simulating skills with intended delays between them is send to the game. I don't even have all 14 macro keys programmed, most is 10 when I play monk (healer class). 2- For programming, depending on what I am in (Code view / Visual / SQL builder etc) I do use all 14 keys and combined with different profiles, I can type most used declaring prototypes / build a test form / write most common SQL queries - to the extent that I can press a few keys and the equivalent of several dozens of key presses are poured in, which allows me to be truly proficient. Of course, all these are based on my experience and they piled up in years, but the end idea is the same - get a cross-platform IDE and you can create just as easy in Raspberry Pi as in Windows your applications.
- xvector 7y agoBut now don’t you need to run Razer’s proprietary software? Things like QMK are open-source
- unnouinceput 7y agoPerhaps, but Razer software is free and on top of that I'm lazy and accustomed with it already. I know it's a sin for HN crowd, so forgive me father :).
- rzwitserloot 7y agoThis article begins by explaining that karabiner (software for macs) lets you remap caps lock to escape. Which is true. But very misleading: That is a feature the OS itself supports, out of the box: System Preferences, Keyboard, Modifier Keys... – and voila, here you can pick 'escape' in the dropdown next to 'caps lock key'. And speaking of that option, go do that right now. Even if you don't have a touchbar :)
- sorcercode 7y agoMisleading is a tad bit extreme :). FWIW: I did mention it in a first draft but removed it cause it seemed like fluff. > You can do this pretty easily with Karabiner but it barely scratches the surface of Karabiner’s true power. Karabiner is far far more powerful than just basic key mappings. Also the linked blog post at the bottom mentions the exact point you make (viz if all you need is a caps lock to escape mapping, use the built in features on the Mac)
- otterpro 7y agoThat's not completely true. Karabiner does something MacOS cannot do, which is a momentary switch functionality. For example, I use it so that tapping capslock will activate ESC but holding it down with another key will activate CTRL instead. It's such as cool feature that I can no longer use a keyboard without this functionality. I can also do this using Hammerspoon, although I prefer doing it via keyboard that supports it (ie QMK firmware-based keyboard) so that I can use it on Windows / Linux as well.
- darkteflon 7y agoWhat MacOS can’t do natively, though - at least, last I checked - is allow caps lock to function as escape when tapped but ctrl when held. Karabiner does this and it’s seriously convenient.
- ahakki 7y agoIs there a way to achieve this on Windows? This sounds very convenient. I used Randy Rants SharpKeys to remap CapsLock to Esc, but I don't think the double mapping is supported.
- m0skit0 7y agoVimium extension for browsers allows Vi-like movement and mouse-free navigation. Things you learn from sysadmins ;)
- chiefsucker 7y agoOr Vimari, the Safari port. https://github.com/televator-apps/vimari https://github.com/televator-apps/vimari
- MiddleEndian 7y agoI always remap Caps Lock to Compose (built in functionality in Linux, WinCompose for Windows). But what I want more than anything is to be able to modify the laptop keyboard firmware on my Surface Book 2 so that FnLock can never be turned off. Does anyone have any tips for this?
- benibela 7y agoThat is more a case of gui configuration Here is a real keyboard hacker: https://spritesmods.com/?art=rapidisnake https://spritesmods.com/?art=rapidisnake
- mcswell 7y agoIIUC, most people here are talking about hacking the keyboard itself. Another option is to hack the mapping of key presses to emitted codes, at the OS level. Windows allows you to do this using the SetWindowsHookEx() process. I set this up to do my mapping back in the days of Win3.1, and it's worked more or less unchanged since then. My mapping resembles the one described in the article, e.g. ^K --> <up arrow>. (And ^U maps to a series of 8 up arrows, for faster movement.) But I have two states, one in which a ^K simply moves the cursor one line up, and one in which it selects while doing that (and the same for the other keys that do <left>, <right>, <down>, <pgup> etc.). I toggle between the two states using ^Q (and ^C, ^X and a few other keys go to the non-selecting state from the selecting state). The last time I looked, other keyboard mapping techniques I've seen don't have this 2-state possibility, or even in some cases to output a sequence of codes. One advantage of doing the mapping this way is that it's hardware-independent: I can use it not only on my home desktop, but also on laptops, my office computer, etc., anywhere I can run a tiny .exe + .dll.
- fnoof 7y agoFYI, the basic features mentioned are available in plain macOS. Remap caps lock to control in system preferences. Then ctrl-p: up, ctrl-n: down, ctrl-b: left, ctrl-f: right ctrl-d for forwards delete, also ctrl-a/e for home/end, ctrl-u/k for delete line forwards/backwards Works in almost all text entry boxes with no config or other software.
- filchermcurr 7y agoThanks for mentioning this! A lot of people don't know that macOS has a lot of Emacs keybindings as defaults. You can even customize it by putting a DefaultKeyBinding.dict file in ~/Library/KeyBindings/. The defaults are in `/System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict` to use as a reference, but you can also find lots of examples around GitHub and various blogs. Documentation seems to be a bit sparse (maybe I'm just terrible at searching), but this should get anybody who is interested going: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/EventOverview/TextDefaultsBindings/TextDefaultsBindings.html https://developer.apple.com/library/archive/documentation/Co... More helpful and practical documentation: http://xahlee.info/kbd/osx_keybinding.html http://xahlee.info/kbd/osx_keybinding.html
- bbmario 7y agoI wonder how much latency that adds up.
- cerberusss 7y agoI don't know about the latency that's intentionally inserted. But I'm using Karabiner for the past years, and I haven't noticed any. It probably helps that it's implemented as a kernel module.
- godelski 7y agoVim users, why are you all remapping your escape key? <C-[> is already a map. I know it is two buttons, but they are with different hands and you don't have to stretch or lift your palms to reach them. Benefits over remapping: you can open a random vim terminal and it still works.
- kalyantm 7y agojj for the win