Automatically set your Mac screen saver in base of your network connection
This script allows you to dynamically set different your Mac (OS X) screen savers for different network connections.
This program may be useful on laptops used both at home and work. For instance, at home you want to use a screen saver showing personal picture, while you may use a more professional screen saver at work. In another scenario, your home network is not fast enough to support live streaming screen savers (such as JohnCoates/Aerial), while your work network is (this is the default considered scenario).
-
Clone the repository:
git clone https://github.com/auino/osx-screensaver-profile.git
-
Configure the script, by opening it and setting configuration data as preferred (see Configuration section for more information)
-
Optionally, you can test the correct working of the script, by opening the Terminal app and running the following command:
sh osx-screensaver-profile.sh
-
Put the script on your crontab, by opening the Terminal app and running the following command:
crontab -e
-
Now you have to append the following line (press
i
button to insert data):0 * * * * sh /directory_path/osx-screensaver-profile.sh
where
/directory_path/
identifies the path of the directory containing the script, while0
specifies the program has to be called every hour. -
Hit
:q
to close, saving the file -
Enjoy!
Following information are required:
-
HOME_IP
andWORK_IP
identify the computer IP address when connected at home or workIP addresses are needed in order to distinguish between the two scenarios. It is possible to specify a portion of the IP address, such as
192.168.
, representing the address range192.168.0.0/16
. To identify the current IP address, use theifconfig
command or use OS X settings. -
HOME_NAME
andWORK_NAME
identify the screen saver name adopted for the considered scenarioIt is possible to retrieve a list of names of available screen savers by running the following command:
sh osx-screensaver-profile.sh -n
-
HOME_PATH
andWORK_PATH
identify the screen saver path adopted for the considered scenarioIt is possible to retrieve a list of paths of available screen savers by running the following command:
sh osx-screensaver-profile.sh -p
-
HOME_TYPE
andWORK_TYPE
identify the adopted screen saver type.
The program also provides current configuration through the following command:
sh osx-screensaver-profile.sh -c
This option may be useful to properly copy settings of already configured screen savers.
You can find me on Twitter as @auino.