diff --git a/Intellidock.sh b/Intellidock.sh index 25f2eff..affa141 100755 --- a/Intellidock.sh +++ b/Intellidock.sh @@ -54,16 +54,20 @@ then if [ $check_dock == "Yes" ] then echo "Clammshellmode: Yes, autohide: off." - osascript -e "tell application \"System Events\" to set the autohide of the dock preferences to false" - osascript -e 'display notification "Device in closed-lid mode, Dock autohide: off." with title "Intellidock"' - + if [ "$1" == "-n" ] + then + osascript -e "tell application \"System Events\" to set the autohide of the dock preferences to false" + osascript -e 'display notification "Device in closed-lid mode, Dock autohide: off." with title "Intellidock"' + fi # If not in clamshell mode, enable autohide dock else echo "Clamshellmode: No, autohide: on." - osascript -e "tell application \"System Events\" to set the autohide of the dock preferences to true" - osascript -e 'display notification "Device lid opened, Dock autohide: on." with title "Intellidock"' + if [ "$1" == "-n" ] + then + osascript -e "tell application \"System Events\" to set the autohide of the dock preferences to true" + osascript -e 'display notification "Device lid opened, Dock autohide: on." with title "Intellidock"' + fi fi - fi done diff --git a/README.md b/README.md index efc77ac..17e69a8 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,11 @@ I built this because I have a 13-inch Macbook Pro, when I'm not docked, I don't 4. Run the script in the background `nohup ./Intellidock.sh > /dev/null 2>&1&` 5. Optionally set the script to run at startup (see [this link](https://stackoverflow.com/questions/6442364/running-script-upon-login-mac)). +To receive a notification every time the state changes, run Intellidock with the `-n` parameter. +``` +nohup ./Intellidock.sh -n > /dev/null 2>&1& +```` + ## Extra Something I've always hated about auto-hide on the dock is that there is a delay. @@ -32,4 +37,4 @@ Joni Van Roost, joni.VR@hotmail.com Intellidock is available under the MIT license. See the [LICENSE](https://github.com/JoniVR/IntelliDock/blob/master/LICENSE) file for more info. ## More -Feel free to submit a pull request, open an issue or fork this project. Any help is always appreciated. \ No newline at end of file +Feel free to submit a pull request, open an issue or fork this project. Any help is always appreciated.