![]() 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. Using the same applications table as hyper, we add a new key/value pair for preferred_display.This all started with Hyper. Once again, we return to my config variable in a. Inspired by Seth Messer's config, I wrote a simplified a system. If I have two screens, I want work right in front of me, and distraction/calendaring applications off to the side. If I'm on one screen, I want everything full screened, and I switch between them using hyper shortcuts. Autolayout on docking or undocking the laptopĪfter using my basic keys for moving windows around, I realized the main use case for me was setting up my windows on my two monitors after docking my laptop. It's a very small thing, but it brings me a lot of joy. I use this more than I thought I would, it turned out that most of my window moving was simply to bring two things close together for comparison or reference. Hold ⎇ for 70/30." ) : searchSubText ( true ) : choices ( windows ) : show () movewindows : exit () while it's not terribly complex, it's a good example of the powerful tools Hammerspoon gives you to build your own automations.įirst we set up the modal and bind it to our old friend Hyper.Ĭhooser : placeholderText ( "Choose window for 50/50 split. I then hit `v` to enter my split window chooser, then I choose the window I want alongside my "work" window and everything is ready to go! Hitting HYPER+m allows me to enter my window movement modal. Realizing just how common this particular use case is, and inspired by how easy it is to split a screen in vim using fzf.vim, I wrote a function to make my life easier. Switch to my reference, enter move mode, move it to the right.Switch to my work, enter move mode, move it to the left.Flip back and forth (efficiently using a!) a few times before realizing that I need them both at the same time.Go find that material, open it up full screen.Realize I need some reference material. ![]() Sometimes it's Dash.app, some other reference material, or a ticket. There is one use case where I'll commonly have two windows open… one to work on, the other for reference. I work on a laptop monitor a lot, and even at my nice setup at my desk I try to keep my main monitor on a single app. While much of a is very simple, there are two automations that I'm proud of. In my configuration, a isn't very complex or interesting, and a lot of it was written originally by Tom Miller. I used to think multitasking was a super power of mine, now I think it's my kryptonite. While ten years ago I would have leapt for the tiling options 1 (I still would like to give i3wm a go one of these days!) I have been making an effort to only have one application in view at any given time. There is a lot of awesome Hammerspoon code to help you with that, from clones of popular Mac applications like Spectacle to complex tiling systems. One of the main things people do with Hammerspoon is wrangle their window layouts.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |