From 7ffcc9ad8bc082c9809849d6d64f22e9ba09629f Mon Sep 17 00:00:00 2001 From: Ein Verne Date: Mon, 7 Sep 2020 09:11:29 +0800 Subject: [PATCH] Hammerspoon: fix DNS auto switch rule --- hammerspoon/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua index b0ceced..4321313 100644 --- a/hammerspoon/init.lua +++ b/hammerspoon/init.lua @@ -157,10 +157,10 @@ hs.network.reachability.forAddress(homeDNS):setCallback(function(self, flags) -- note that because having an internet connection at all will show the remote network -- as "reachable", we instead look at whether or not our specific address is "local" instead local networkConf = hs.network.configuration.open() - if (flags & hs.network.reachability.flags.reachable) > 0 and currentLocation ~= homeLocationUUID then + if (flags & hs.network.reachability.flags.reachable) > 0 and currentLocation == homeLocationUUID then hs.alert.show("switch to Home network location") networkConf:setLocation("Home") - elseif (flags & hs.network.reachability.flags.reachable) == 0 and currentLocation == homeLocationUUID then + elseif (flags & hs.network.reachability.flags.reachable) == 0 and currentLocation ~= homeLocationUUID then hs.alert.show("switch back to Automatic network location") networkConf:setLocation("Automatic") end