

(in Windows I guess I'd put in the system tray)įun little side bar- the little area next to the clock is, and always has been, officially called the "Notification Area". I believe it has the capability to capture events like networks changing. It is typically used through powershell or VBScript. It sounds like WMI (Windows Management Instrumentation) may be the nearest equivalent you are looking for. I wonder if I might've stumbled upon an open source project to undertake ) though it might be bigger than I have time for with my regular coding gig at this time. that looks like it also supplies some of the pieces. u/jantari mentioned AutoHotKey in another response. Slate ( ) was an app that came before it that used Javascript to accomplish the same. Lua just happens to be the scripting language the developers chose. Sure you could do it without hammerspoon, hammerspoon just makes it easier with a consistent, and easily exposed API to everything. So instead of scheduling a task to run each minute to check what the wifi network is, when a wifi event happens the OS API that you're registered to triggers a call to your task. One benefit that hammerspoon brings is it bridges the gap between your scripts/tasks and operating system APIs. Thanks for that helpful reply! I feel like you really got the gist of the question I was asking. I'd be interested to hear how you get on with this though. Whilst I suspect that these challenges exist in hammerspoon too it's been this barrier to entry that's kept me from trying to setup some of these automations that you are aiming to get to.

Each can be navigated but in all probability you'd have to devise a different solution to each specific requirement, some you will be able to trigger neatly on an event, others will need some hackery to get it to operate, others still will need some third party element to get it to function as you need. Other taks that will have similar limitations. I can't think of any native mechanism (and a quick google hasn't helped) that will execute a script/process on connection to a wireless network, so you'd have to fall back on a regular schedule to run the above on a 1 minute schedule, or you would need a do.while loop to run this in the background constantly. The problem you have is how do you schedule that. Thanks to r/powershell for some of the above. Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled $True IF($(netsh wlan show interfaces | Select-String '\sSSID') -ne $HomeNetwork) NET/C#, but (and I know nothing about LUA or Hammerspoon) I suspect it might be a step further into coding than using LUA and it will carry it's own difficulties.įor example checking for wifi SSID and enabling FW if it's not your home network : $HomeNetwork = "MyHomeWifi" Most of what you are asking for can be done natively in Powershell (and probably python/perl and maybe even bash if you are feeling adventurous), and certainly if you dip in to.
