Wrapping the snippet above in a function and binding it to a hotkey should cycle the currently focused application across your different monitors. 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() Local focusedScreenFrame = focusedWindow:screen():frame() ![]() 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, However some applications have a VIP status and need an exclusive manner to get started.I've answered this in Reddit post here, but in case anyone comes across this question here's the answer: Of course I have an Application launcher, Alfred – a separate post to follow. The color of the light will show your mute status, red will indicate that you’re muted, and green if you are not muted. How?įollowing are some examples, that I am implementing on my Mac. hs.sharing: Share items with the macOS Sharing Services under the control of Hammerspoon. There is an added benefit of a reasonable – much more reasonable, than the built-in System Preferences – system for binding keyboard shortcuts for your automation.Īnother Bonus is that you can have all, all of you automation in one plain text file. There’s no shortage of automation tools available for macOS, but if you want to automate every part of your Mac, then Hammerspoon is one of the most powerful and versatile automation tools out there. Hammerspoon is a powerful automation tool for your Mac with the ability to automate just about anything based on the triggering of an event like connecting to a WiFi network or opening an app. Serialize simple Lua variables across Hammerspoon launches. Plus if all fails, I can run arbitrary external scripts, as mention in my Favorite Apps & Tools introduction post. Pretty simple really: With Hammerspoon, I can combine all of the above and more within just the one tool. Well that part was easy, but why do I need Hammerspoon? There is Applescript, Automator and even the whole power of a proper shell, the BSD General Commands and the sort built-in, right. Using hs.window. What gives Hammerspoon its power is a set of extensions that expose specific pieces of system functionality, to the user. At its core, Hammerspoon is just a bridge between the operating system and a Lua scripting engine. Hello World Fancier Hello World Introduction. What gives Hammerspoon its power is a set of extensions that expose specific pieces of system functionality, to the user. This is a tool for powerful automation of OS X. Run Hammerspoon.app and follow the prompts to enable Accessibility access for the app Click on the Hammerspoon menu bar icon and choose Open Config from the menu Open the Hammerspoon API docs in your browser, to explore the extensions we provide, and the functions they offer Table of Contents. This is a tool for powerful automation of OS X.
0 Comments
Leave a Reply. |