That works well with the above for essentially typing in a subcommand. Rather than immediately ending the modal, I can set it so that after 100ms (for example) without hitting a key that does something, it stops listening. Or w,e,d to move to top+right third instead of half.ĭebouncing for chords. btw I hope you dont hate the new build system, xcconfig use, etc. Perhaps (to keep things on my left hand), I could use a Chord with wasd for moving windows around? And because it’s within a chord, I can actually hit more than one key. Already done Thanks for reminding me of this, I should have added them when I ran into this. I already have my terminal on ⌥-a and Dropbox Dash (formerly Command E) on ⌥-s. Since I have Caps Lock bound to Option (⌥), this fits. So instead of ⌘⌃+c, s for screenshots, I could have ⌥+g, c, s for Go Capture S screenshot. Well, one thing I want to try is multiple levels of Chords. From the Hammerspoon configuration you can also execute external commands, run AppleScript or JavaScript code using the OSA scripting framework, establish network connections and even run network servers you can capture and generate keyboard events, detect network changes, USB or audio devices being plugged in or out, changes in screen or keybo. So instead of having to register each of them, I just have to import them and use the one init_keys function to reload them all. run any registered functions for name, f in pairs(key_chords) do print( ' Running key function: '. Last but not least, I have another chord for running programs specifically with additional parameters (so Spotlight or Dash wouldn’t pick them up): And it works great! Albeit not for taking screenshots of itself. What that does do though is let me send a non-chord keyboard shortcut to Capture: Basically, what we’re doing is capturing the chord ( ⌘⌃+c, s for example) and then immediately turning around and firing off another keyboard shortcut ( ⌘⌃⇧+1)… that–doesn’t help at all to save those ~78k… but that’s a lot anyways. Hs.eventtap.keyStroke( '⌘⌃⇧', '4') - mute captureMode:exit()ĬaptureMode:bind( '', 'SPACE', function() Yeah, hammerspoon doesnt really deal with spaces yet. 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.CaptureMode = hs.( '⌘⌃', 'c') but a) I dont see a way to get the window out of a drawing, and b) I dont see a way to move a window to specific desktop. 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 |