rimar / wifi-location-changer Goto Github PK
View Code? Open in Web Editor NEWautomatically change location when mac os x changes wifi connection
automatically change location when mac os x changes wifi connection
Relaying a problem report from this Stack Overflow thread:
The Awk script presumes that $2
contains the entire SSID; this will not be true if the SSID contains whitespace.
Currently, users are expected to change the source code to add configuration about their locations and wifi names. This means merging when source updates happen.
Instead, introduce a feature for configuration to be stored in a text file that is external to project source (identified in a .gitignore entry).
When I ran the installer using macos big sur 11.6.4, on bash 5.1.16, I got:
$ ./install.sh
Password:
Unload failed: 5: Input/output error
Does this failure message means there was nothing to unload? The install
script does not fail fast. Investigating that message led to info that launchctl load
is deprecated as explained elsewhere.
When changing something in the network settings and location changer is running the changes get rolled back to the previous values.
As a workaroung it is possible to do
launchctl unload ~/Library/LaunchAgents/LocationChanger.plist
make the change
launchctl load ~/Library/LaunchAgents/LocationChanger.plist
A proper fix should be checking in the script that what changed is the SSID and only then doing scselect. Probably requires writing last SSID to file.
not sure why yet, but it seems to be broken on 10.9 . will send a pull request if i find the cause.
Thanks for publishing this nice little utility. I was thinking it would be a useful new feature to be able to detect the hostname and MAC address of the current router, and use this this to switch location. SSID is good enough in many cases, of course, but naturally not all.
After starting the instalation with the 'install' script and after input of the password I got the following error:
/Users//Library/LaunchAgents/LocationChanger.plist: Could not find specified service
What can be the cause? I am using OSX High Sierra 10.13.4.
This article implies that the upcoming Ventura release of macOS will remove "network locations" as a UI feature of MacOS. I'm not sure what bearing that might have on the wifi-location-changer
tool, but it could be significant.
Recently, I came across a tool that seems to offer "wifi change listening" functionality without reference to network location.
Fixed
I changed my plist file WatchPaths to the individual file preferences.plist in /Library/Preferences/SystemConfiguration which gets changed every time I change wifi network or change Location, thus triggering the script only as necessary. Using the whole folder caused the script to run every 10 seconds on my machine. Check the console logs on your machine to see how often the script is being called. Look for error message "Throttling respawn: will restart in n seconds"
Hi,
At the moment, when I click on notif, it opens Script Editor. Would be nice if it does nothing on closes the notif.
Thx.
Set as automatic all wifi networks not "known" and not specified in the locationchanger
If you connect to a WiFi that has for example a manual IP setting and then try to connect to a WiFi that you don't have any settings for, wifi-location-changer wouldn't change the previous settings which is totally expected but may not be what you expect.
I wish I could create a default location name and when there is no configurations available for a WiFi, wifi-location-changer would use that default settings.
Good morning!
Just reaching out to see if there's any plan to fully support macOS Monterey potentially on the horizon? I'd love to be able to use this tool actively on Monterey.
Thanks!
Picked up from this Stack Overflow thread:
Probably add
mkdir -p /usr/local/bin
to the beginning of install.sh
.
I would like to use a location "Home" when I'm at home, but location "Automatic" when I'm anywhere else.
It wasn't clear from the README file, but I gather "Automatic" is already the default location if none of the listed SSIDs match the one that is currently connected to. Still, it would be nice to allow setting a default location. So maybe allow:
MyDefaultLocation *
to explicitly mean use location "MyDefaultLocation" for any WiFiSSID that is not explicitly listed. Thank you for a very nice and very needed utility!
It has been working well before upgrading to MacOS big sur. After the upgrade, the WIFI change cannot be detected.
If I manually run the command /usr/local/bin/locationchanger
, the location can be switched correctly. This positive script can work normally. I think it just can't detect the change of wifi.
I guess it is caused by one of the following two reasons:
$HOME/Library/LaunchAgents/LocationChanger.plist
is invalid;<key>WatchPaths</key>
<array>
<string>/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist</string>
</array>
/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
is indeed not changed.Apple M1 Pro
macOS Sonoma 14.4 Beta
conf in sonoma
cat /usr/local/bin/locationchanger.conf
# This is a sample file for creating text file "locationchanger.conf" which associates location names with wifi names.
#
# Below, enter two pieces of text: location and wifi, separated by space(s)
# If the wifi name contains space(s), make sure to put quotes around that wifi name; location may NOT have any spaces or odd characters.
# Any line with a pound sign in front will be ignored as a comment. Blank lines are also ignored.
#
#
# LOCATION WIFI
#
# For example:
# Home myHomeWifiSSID
# Work "my Work Wifi"
TPARTS-GFW "TPARTS-GFW"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.