Skip to content

Commit

Permalink
add parameter check to make notifications optional
Browse files Browse the repository at this point in the history
  • Loading branch information
JoniVR committed May 14, 2018
1 parent c1a4d82 commit 855795b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
16 changes: 10 additions & 6 deletions Intellidock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -32,4 +37,4 @@ Joni Van Roost, [email protected]
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.
Feel free to submit a pull request, open an issue or fork this project. Any help is always appreciated.

0 comments on commit 855795b

Please sign in to comment.