https://github.com/wadaboa/bash-scripts
Scripts used to automate some daily tasks on my macOS system
https://github.com/wadaboa/bash-scripts
automate bash bash-script dock macos
Last synced: 10 months ago
JSON representation
Scripts used to automate some daily tasks on my macOS system
- Host: GitHub
- URL: https://github.com/wadaboa/bash-scripts
- Owner: Wadaboa
- License: mit
- Created: 2019-04-22T12:39:31.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-22T18:38:19.000Z (over 6 years ago)
- Last Synced: 2025-01-20T10:23:11.870Z (11 months ago)
- Topics: automate, bash, bash-script, dock, macos
- Language: Shell
- Homepage:
- Size: 14.3 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bash scripts
## Installation
Below is an example on how to install the `dockerize` script:
1. Make a local clone of this repository in `~/scripts`
2. Copy `com.jobs.dockerize.plist` inside `/Library/LaunchAgents`
3. Open a terminal window and run `launchctl load /Library/LaunchAgents/com.jobs.dockerize.plist`
4. Open `System Preferences → Security & Privacy` and navigate to the `Privacy` tab
5. Click the “Lock” icon and enter your system password to unlock the panel settings
6. Click on `Full Disk Access` and add the `dockerize` executable to the list
7. Click on `Accessibility` and add the `dockerize` executable to the list
**NOTE**: These scripts are written to work with personal settings (For example, I take for granted that my home folder is located in `/Users/Jobs`).
## Scripts
### dockerize
Script used to automate some tasks relative to docking/undocking the system to/from home/work.\
This script is a daemon, invoked when a specific USB device is connected/disconnected (In this case, this device is the external keyboard **Keyboard -- QuickFire XT**).\
So, whenever the **plugging event** happens, the script does the followings:
- If there's my external keyboard connected, changes keyboard layout from US to IT and enables bluetooth
- If there's an active ethernet connection, shuts down wifi
- If there are two connected external monitors, sets a dual wallpaper
And whenever the **unplugging event** happens, the script does the followings:
- If there isn't my external keyboard connected, changes keyboard layout from IT to US and disables bluetooth
- If there isn't an active ethernet connection, turns on wifi
- If there aren't two connected external monitors, sets a single wallpaper
The wallpapers are defined in the `assets` folder. The single monitor wallpaper is named `one.jpg`, while the dual monitor wallpapers are named `two_left.jpg` and `two_right.jpg`.
#### Dependencies
The script depends on the following libs:
- **xkbswitch** (https://github.com/myshov/xkbswitch-macosx)
- **blueutil** (https://github.com/toy/blueutil)
### internet
Script used to check if there's an actual active internet connection. This script is a daemon, invoked every 2 seconds.\
So, whenever the current internet connection goes down, a notification appears saying **Internet connection - Offline**.\
At that point, when the internet connection comes back up, a notification appears saying **Internet connection - Online**.\
It's as easy as that.
**NOTE**: This script works by pinging **google.com**. So, if Google's servers are down, you might receive a wrong notification.