All Projects → eprev → Locationchanger

eprev / Locationchanger

Change OS X’s network location based on the name of Wi-Fi network

Programming Languages

shell
77523 projects

Labels

Projects that are alternatives of or similar to Locationchanger

Desktop Google Keep Osx
A Super Simple Desktop Client for Mac OSX Built in Javascript and MacGap
Stars: ✭ 159 (-47.35%)
Mutual labels:  mac-osx
gh-notifier
Desktop notifier for all your "social" GitHub notifications
Stars: ✭ 21 (-93.05%)
Mutual labels:  mac-osx
Yosemite-gtk-theme
Mac OSX Yosemite like theme for GTK 3, GTK 2 and Gnome-Shell etc.
Stars: ✭ 74 (-75.5%)
Mutual labels:  mac-osx
Animatedgif
A screensaver for Mac OSX / macOS that plays animated GIFs and APNGs
Stars: ✭ 174 (-42.38%)
Mutual labels:  mac-osx
macdeployqtfix
To bundle a Qt application on Mac OSX, there is macdeployqt. To finish the job there is macdeployqtfix! ✅
Stars: ✭ 61 (-79.8%)
Mutual labels:  mac-osx
obs-backgroundremoval
An OBS plugin for removing background in portrait images (video), making it easy to replace the background when screen recording.
Stars: ✭ 1,304 (+331.79%)
Mutual labels:  mac-osx
Syncthing Bar
A statusbar for syncthing on Mac OS X
Stars: ✭ 133 (-55.96%)
Mutual labels:  mac-osx
S25client
Return To The Roots (Settlers II(R) Clone)
Stars: ✭ 288 (-4.64%)
Mutual labels:  mac-osx
HEIF
Mac OS X: Convert any image to HEIF/HEIC format
Stars: ✭ 58 (-80.79%)
Mutual labels:  mac-osx
emacs-anywhere
📝 Open emacs from anywhere
Stars: ✭ 50 (-83.44%)
Mutual labels:  mac-osx
Pomodoro
Pomodoro time managment tool build with electron 🍅
Stars: ✭ 204 (-32.45%)
Mutual labels:  mac-osx
Systemtray
Cross-platform SystemTray support for Swing/AWT, GtkStatusIcon, and AppIndicator on Java 8+
Stars: ✭ 253 (-16.23%)
Mutual labels:  mac-osx
dev-machine
Ansible setup for maintaining a development environment
Stars: ✭ 30 (-90.07%)
Mutual labels:  mac-osx
Macos Dev Basic
Mac osx 开发基础视频项目工程
Stars: ✭ 171 (-43.38%)
Mutual labels:  mac-osx
MagickWand
Swift wrapper for ImageMagick (MagickWand) for Linux and MacOS
Stars: ✭ 38 (-87.42%)
Mutual labels:  mac-osx
Stitch
Python Remote Administration Tool (RAT)
Stars: ✭ 2,018 (+568.21%)
Mutual labels:  mac-osx
awesome-script
常用的 shell 脚本,包括 centos, Ubuntu, Mac osx, 以及 Docker, Python 等常用软件的安装, 配置, 开发环境搭建的脚本.
Stars: ✭ 50 (-83.44%)
Mutual labels:  mac-osx
Macappshell
Creates a Mac OSX .app folder (complete with icons) ready for your binary file. Perfect for Golang, Rust, C++, etc..
Stars: ✭ 290 (-3.97%)
Mutual labels:  mac-osx
delivery
GRPC GUI client for GRPCurl
Stars: ✭ 58 (-80.79%)
Mutual labels:  mac-osx
Google-Docs-Desktop-OSX
A Super Simple Google Docs Desktop Client for Mac OSX Built in Javascript and MacGap
Stars: ✭ 35 (-88.41%)
Mutual labels:  mac-osx

Location Changer

It automatically changes OS X’s network location based on the name of Wi-Fi network and runs arbitrary scrips when it happens.

Installation & Update

curl -L https://github.com/eprev/locationchanger/raw/master/locationchanger.sh | bash

It will ask you for a root password to install locationchanger to the /usr/local/bin directory.

Basic usage

You have to name network locations after Wi-Fi networks. Let’s say, you need to have a specific network preferences for “Corp Wi-Fi” wireless network, then you have to create a location “Corp Wi-Fi”. Now, the network location will change to “Corp Wi-Fi” automatically, if you connect to that wireless network. And if you connect to the Wi-Fi network that you don’t have a location for, then the location will change to the default one (“Automatic”).

If you want to run a script every time you connect to a specific Wi-Fi network, then put those scripts in ~/.locations and name them after Wi-Fi networks (making sure you set corresponding network locations). For instance, you have a script that changes security preferences when you connect to the “Corp Wi-Fi” network:

#!/usr/bin/env bash
exec 2>&1

# Require password immediately after sleep or screen saver begins
osascript -e 'tell application "System Events" to set require password to wake of security preferences to true'

Then name this script as ~/.locations/Corp Wi-Fi. And you might want to create ~/.locations/Automatic that will reset those changes:

#!/usr/bin/env bash
exec 2>&1

# Don’t require password immediately after sleep or screen saver begins
osascript -e 'tell application "System Events" to set require password to wake of security preferences to false'

Aliasing

If you want to share one network location between different wireless networks (for instance, you have a wireless router which broadcasts on 2.4 and 5GHz bands simultaneously), then you can create a configuration file ~/.locations/locations.conf (plain text file with simple key-value pairs, no spaces in between):

Wi-Fi_5GHz=Wi-Fi

Where the keys are the wireless network names and the values are the desired location names.

Troubleshooting

It writes quite extensive information to the log file every time the wireless network changes:

tail -f ~/Library/Logs/LocationChanger.log

Sample output:

Connected to 'Wi-Fi_5GHz'
Will switch the location to 'Wi-Fi' (configuration file)
Changing the location to 'Wi-Fi'
Running '~/.locations/Wi-Fi'
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].