You might want to do something crazy like have iTunes automatically start playing when your Mac detects you are in Paris. You might want to display an alert when your battery drops below a certain percentage. You might want to run a series of commands when your wifi interface connects to your home network. You might want to bind a keyboard shortcut to a series of window operations, or an applescript. Typically you would write a configuration file in Lua that connects events to actions. If you want to explore the options Hammerspoon offers, check out the Getting Started Guide and the full API documentation as well as the already pre-made plugins called Spoons. You can write Lua code that interacts with macOS APIs for applications, windows, mouse pointers, filesystem objects, audio devices, batteries, screens, low-level keyboard/mouse events, clipboards, location services, wifi, and more. 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. Stops the screen watcher's fn from getting called until started againĮxtensions/screen/libscreen_watcher.This is a tool for powerful automation of macOS. Starts the screen watcher, making it so fn is called each time the screen arrangement changesĮxtensions/screen/libscreen_watcher.m line 137 Plugging in or unplugging a monitor can cause both a screen layout callback and an active screen change callback.Įxtensions/screen/libscreen_watcher.m line 109.This documentation will be updated if this status changes. Because this watcher works by listening for posted messages, should Apple remove this notification, your callback function will no longer receive messages about this change - it won't crash or change behavior in any other way. While this message has been around at least since OS X 10.9, because it is undocumented, we cannot be positive that Apple won't remove it in a future OS X update. Detecting a change in the active display relies on watching for the NSWorkspaceActiveDisplayDidChangeNotification message which is not documented by Apple.An active screen change indicates that the focused or main screen has changed when the user has "Displays have separate spaces" checked in the Mission Control Preferences Panel (the focused display is the display which has the active window and active menubar).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |