Hacking Your Keyboard
blog.kaush.co
blog.kaush.co
If folks are interested in getting deeper into keyboard hacking I highly recommend looking into a board that supports [QMK](https://qmk.fm/), which is a very hackable set firmware that works across a bunch of boards.
But QMK is definitely awesome cause no need of installing software. Just plug your keyboard anywhere and you’re off to the races.
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 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!
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)
Keyboard Maestro is truly one of the best productivity software for the Mac.
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...
https://cravencode.com/post/essentials/enable-tap-to-click-i...
I have a mix of 10 plus terminals, chrome, sublime text, slack and wireshark spread across multiple workspaces in various combinations and it’s brilliant. Some applications work better non-tiled, floating on top of the tiles and this can be configured. I have done that with wireshark.
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 :)
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)
I used Randy Rants SharpKeys to remap CapsLock to Esc, but I don't think the double mapping is supported.
Do the same for enter, so that Ctrl-L is not too painful
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.
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.
--
Heh, I had to do a similar thing with AHK when I vacuumed a key off my laptop.
Of course, if you're not a coder, emacs will never replace your Excel / Photoshop / AutoCAD etc. custom macros.
That said, as emacs user, I see vim users switching to emacs/evil by the day.
The road has been bumpy so far, but I’m slowly getting used to Emacs’ idiosyncrasies. The journey has been worth it.
I gave it a couple hours and ran into a bunch of issues just by using spacemacs master and enabling a few layers.
For example, semantic seems to be pretty broken and unmaintained, and only googling around is how you find out. Yet other layers' documentation kinda (not so) subtly nudge you towards installing broken crap like this, without telling you that it's broken. https://www.reddit.com/r/emacs/comments/5yxxrl/what_is_that_...
Enabling version-control layer breaks a bunch of magit functionality, including basics such as commit. Don't enable that broken layer, I guess? Funny, apparently fixed in develop and still broken in master 9 months later.. https://github.com/syl20bnr/spacemacs/issues/12056
git blame is broken: https://github.com/magit/magit/issues/3883
Does anyone actually use this stuff?!
And I still haven't found a way out of silly autoindentation so I'm forced to waste time trying to configure features that I did not want in the first place :(
Stuff like ^N and ^P aren't quite working like in vim either..
This kind of stuff is pretty much exactly what pushed me away from emacs the second time I tried to use it for real. A tangled mess of a bazillion packages that interfere with each other and come in various degrees of unmaintained, broken, or obviously broken is not a good foundation for building good software.
I think the bigger problem with spacemacs is that they have a vision too big, and emacs just does not offer tools and culture to support it. So they are constantly working against the hill.
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.
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.
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.
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!
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.
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-layou...
Edit:
Ha! I just found a 75% keyboard on Amazon: https://www.amazon.com/dp/B07M9PGMT9/
Another one: https://www.amazon.com/dp/B07JGQP89G/
What does this ones do?
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
GMMK offers a fullsize, TKL and 60% : https://www.pcgamingrace.com/products/gmmk-full-brown-switch
HTH and Happy New Year!
Rebuild pix here: https://photos.app.goo.gl/33qzHsgjVStY75F58
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.
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/Co...
More helpful and practical documentation: http://xahlee.info/kbd/osx_keybinding.html
Benefits over remapping: you can open a random vim terminal and it still works.
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?
Here is a real keyboard hacker: https://spritesmods.com/?art=rapidisnake