


#Hammerspoon app mac
My mac has a very noisy fan, this just puts the CPU temperature and fan 0 ) end end dragging_window = nil end ) click_event : start () unclick_event : start () - hs. window : focusedWindow (): screen () local max = screen : frame () if m. window : focusedWindow (): frame () local screen = hs. , function ( e ) if dragging_window = nil then - check mouse is in titlebar local m = hs. Option keys when pressed in conjunction with other keys. Send the escape key when pressed alone, while sending the command, control and
#Hammerspoon app code
The following code JSON should be saved in a file in The first element (pun intended) in this setup is the configuration for Possibilities, for having global or application specific function keys,Įspecially when combined with Hammerspoon. Preferences, Keyboard, Modifier Keys, the option to use Escape key as theĪction to perform when the caps lock key is pressed.Ī whole new level however, by allowing the caps lock key to function as anĮscape key when pressed alone, and also acting as a “hyper” key when Mapping the caps lock key to escape is fairly easy in OS X. Movement, as well as a experiencing the tactile feedback of an actual key, Possible to map the escape key to the caps lock key, allowing for less hand Rather than trying to hit the missing escape key, it is There is something reassuring about pressing a physical escape button.Īn ideal solution to this is to replace the functionality of the caps lock key While the escape “key” would still be present on the touch bar, The most important keys for a vim user, replacing it with On the other hand, the new Macbook Pros have eliminated the escape key, one of Keyboards rarely used, it is one of the largest buttons on a keyboard with Shortcuts can be used to trigger scripts or alter the environment as oneįor many, the caps lock key is one of the most useless keys on modern Specify configuration where events such as mouse clicks and drags, and keyboard Level of customisation to control the working environment. Wrapping the snippet above in a function and binding it to a hotkey should cycle the currently focused application across your different monitors.Hammerspoon is a OS X utility that provides a high Set the focused window's new frame dimensions WindowFrame.w = ((windowFrame.w / focusedScreenFrame.w) * nextScreenFrame.w) WindowFrame.h = ((windowFrame.h / focusedScreenFrame.h) * nextScreenFrame.h) WindowFrame.y = ((((windowFrame.y - focusedScreenFrame.y) / focusedScreenFrame.h) * nextScreenFrame.h) + nextScreenFrame.y) WindowFrame.x = ((((windowFrame.x - focusedScreenFrame.x) / focusedScreenFrame.w) * nextScreenFrame.w) + nextScreenFrame.x) Calculate the coordinates of the window frame in the next screen and retain aspect ratio Local windowFrame = focusedWindow:frame() Local nextScreenFrame = focusedWindow:screen():next():frame() Hammerspoon is made powerful by a set of extensions that expose specific system functionality to the user. It works as an in-between between Lua (a light-weight, high-level scripting engine), and the operating system. Your default code/text editor will open to /.hammerspoon/a. Hammerspoon is an open-source automation tool. Click the Hammerspoon menu icon and select Open Config. Local focusedScreenFrame = focusedWindow:screen():frame() Open System Preferences, go to Security & Privacy and enable Hammerspoon.app under Accessibility. Local focusedWindow = hs.window.focusedWindow() and the next screen's frame dimensions. The Hammerspoon API doesn't provide an explicit function for doing this, so you gotta roll out with a custom implementation to achieve this: - Get the focused window, its window frame dimensions, its screen frame dimensions, I've answered this in Reddit post here, but in case anyone comes across this question here's the answer:
