My most common use of a is to launch an application, so I have a table of applications that I can define a "hyper key" for, and optionally some local bindings that I bind inside that application to use globally. hyper : bind (, 'r', nil, function () hs. Press `HYPER+r`, get the Hammerspoon console. Because your "hyper key" is not a cluster of modifier keys, you can actually use it in conjunction with any normal modifiers. One big advantage to using Hammerspoon as a "man-in-the-middle" is using modifiers with your hyper key. Brett Terpstra first wrote about this in "A Useful Caps Lock Key" in 2012. In this as in all things, I am not the first. Instead of having every single application listening to all the keystrokes, I can control it one place. I use a single often-unused key (in my case, F19) to trigger a hs.hotkey.modal in Hammerspoon. In my case, Hammerspoon becomes a single "router" to all the automation and UI customization on my Mac. Using a single keycode as your "hyper" key, and handling the translation at the automation layer is much more expressive. Because of this a lot of hyper key setups are limited to "leader key" style interactions. Using the "hyper chord" as the entire "hyper key", you can't add any more modifiers, because it is already all the modifiers. While it works well, it has its limitations. You can absolutely do this in Hammerspoon if you want. The user would then use some kind of automation software like Alfred or Keyboard Maestro to listen for the "hyper chord" and fire different automations. Traditionally, a Hyper key is implemented by sending to the Operating System "hyper chord" of ⌘⌥⇧⌃ by modifying the keyboard firmware or using Karabiner-elements.app. The code isn't that complex so this post will be focused on the advantages of this approach. I'm using hs.hotkey.modal to capture an F19 keystroke, and only sending the "hyper chord" of ⌘⌥⇧⌃ if absolutely required. At the moment, my hyper implementation is contained in a lua module called a, with some dependencies on Karabiner-Elements.app. I talked in the last post about my history with the concept, how I learned from Steve Losh's post on the topic and borrowed from Brett Terpstra… and I've expanded the idea a bit. Thus far, in practice, I use 2 slot chains, with the right/left arrows controlling horizontal proportions, and the up/down arrows controlling vertical proportions but also bridging across my 2 displays which are arranged vertically.ĭivvy, Moom, Spectacle, and a bunch of in-built Hammerspoon packages are seem pretty good but didn’t quite do what I was looking for.This all started with Hyper. The code figures out which slot your window is in (or closest to), finds the next or previous slot in the slot chain and then moves and resizes the window to fit the target slot.Īs I hit Command-Control-Option Right/Left, the window moves through the slots: Here is the actual slot and connection definitions - This goes in your a local leftRightArrowSlotChain =, "Right", function () k2win.moveFocusedWindowToNextSlot ( leftRightArrowSlotChain, 1 ) end ) My approach was then to define slot chains, and then bind two hotkeys (a “next slot” and “previous” slot hotkey to move the focused window through the slot chain. Each slot has a next and previous neighbor slot. A slot chain is a linked set of slots.Any window from any app can “fit” into a slot. A slot is a rectangular region on a particular physical display.Hammerspoon has a straightforward set of window control functions you can access through Lua. It additionally has a separate hotkey for moving windows between displays - I wanted a single set that could move across displays naturally.I didn’t want symmetry between the up/down keys and right/left keys, as I use vertical space and horizontal space very differently.There’s a huge variety of Mac window management tools out there already 1, and Spectacle was probably the closest off the shelf, but: Low cognitive load to shift a window across physical displays - ideally the same set of hotkeys can spatially move windows across displays. No pre-defined app layouts as I tend to mix and match quite often. Small number of keystrokes to a desired layout outcome. But now most of my day is now spent in front of two monitors. “Every productivity improvement I make attempts to expand until I write a window management script” - meĬOVID accelerated this In the Physical Days pre-March 2020, I used a laptop in the office - no external displays of any kind. Those programs which cannot so expand are replaced by ones which can.” - jwz “Every program attempts to expand until it can read mail. One of my favorite programming quotes is:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |