
This way, even if you miss the alert, you’ll always have a record of what files have been added, deleted or modified in your watched folder. The write is an append: if the file doesn’t exist it will create it before writing if it does exist, it will append the latest changes and date to the file. In this updated function, it now also writes a list of the file changes to a (by default) file on the Desktop. The problem with the simple alert I demonstrated last time is that it only hangs around for a second or two (much less than a Folder Action alert, which takes a couple of minutes to time out). For two minutes work, you just added a very useful window switcher to macOS!įor anyone using Hammerspoon and folder ‘watchers’ to alert them to changes to a given folder, I’ve updated the watcher function I wrote about here Hs.hotkey.bind("alt-shift","tab",function()switcher:previous()end)Īdjust values such as shortcut bindings as you please, and that’s it. Hs.hotkey.bind("alt","tab",function()switcher:next()end) bind to hotkeys WARNING: at least one modifier key is required!

Switcher = hs.() - default windowfilter: only visible windows, all Spaces As ever, the Hammerspoon docs are wonderfully clear and easy to follow (take a lesson, Apple!).
#Pathwatcher hammerspoon code#
Instead, I use the code below, which sets up the switcher’s ui as seen in the screenshots here with option tab and option-shift tab for shortcuts, but you can modify the appearance to suit your taste. The default code is a bit ugly for my liking. You can use the default code in hs.window.switcher docs or use mine below. With Hammerspoon up and running, adding the window switcher is just a case of cutting and pasting some code into your config file, saving it then reloading. But if you’re a regular reader of this blog, you’ll already have installed Hammerspoon after reading my earlier posts on it here and here and here.
#Pathwatcher hammerspoon full#
Another advantage here is that the window switcher will include full screen and non-full screen windows in multiple spaces, which command backtick typically does not handle well, something I find particularly frustrating when using Xcode.Īdding a window switcher is easy and doesn’t require any hacking. This is particularly useful if you have a couple of windows open in several applications, and it is much faster and neater than first using command tab and then command backtick to cycle through an app’s windows. The window switcher allows you to jump between different windows, both those of other apps and the same app with a hotkey like option tab, which sits nicely next to command tab in my muscle memory!

application.If you’re a big fan of the command tab Application switcher, you might enjoy adding a window switcher to your list of keyboard hotkeys. If (data = "Wireless Controller " and data = "Sony Computer Entertainment ") then launchOrFocus( "ScanSnap Manager ")Īpp = hs. Callback function for USB device events We have gone from something that is my home WiFi, to something that isn't We have gone from something that isn't my home WiFi, to something that isĮlseif newSSID ~= homeSSID and lastSSID = homeSSID then If newSSID = homeSSID and lastSSID ~= homeSSID then Callback function for WiFi SSID change events print("Writing app icon to Stream Deck for: ".app:bundleID()) Control brightness for all compatible displays, using the keyboard brightness keys Load SpoonInstall, so we can easily load our other Spoons (Node: Capslock bound to cmd+alt+ctrl+shift via Seil and Karabiner) Define some keyboard modifier variables Ensure the IPC command line client is available Capture the hostname, so we can make this config behave differently across my Macs Uncomment the following line to enable tracing Pull in a which isn't in this repo because it contains work related stuff local ZBS = "/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio" Enable this to do live debugging in ZeroBrane Studio
