-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdock-timer.sh
56 lines (50 loc) · 1.34 KB
/
dock-timer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Script to speed up the revealing animation of the docker
# in osx 10.7 and above.
usage() {
cat <<EOM
usage: sh $(basename $0) [--fast] [-f] [--reset] [-r]
[--delay delay] [-d delay] [--speed speed] [-s speed] [-h] [--help]
EOM
exit 0
}
# Sets the speed and delay of the dock
# $1 : delay
# $2 : speed
set_speed() {
if [ -n $1 ]; then
defaults write com.apple.dock autohide-delay -float "$1"
fi
if [ -n $2 ]; then
defaults write com.apple.dock autohide-time-modifier -float "$2"
fi
killall Dock
}
if [ "$#" -eq 0 ]; then usage
fi
if [ "$1" = "--fast" ] || [ "$1" = "-f" ]; then
defaults write com.apple.dock autohide-delay -int 0
defaults write com.apple.dock autohide-time-modifier -float 0.6
killall Dock
elif [ "$1" = "--reset" ] || [ "$1" = "-r" ]; then
defaults delete com.apple.dock autohide-delay
defaults delete com.apple.dock autohide-time-modifier
killall Dock
elif [ "$1" = "--help" ] || [ "$1" = "-h" ]; then usage
else
current_parameter=""
delay=""
speed=""
for var in "$@"; do
if [ "$var" = "--delay" ] || [ "$var" = "-d" ]; then
current_parameter="delay"
elif [ "$var" = "--speed" ] || [ "$var" = "-s" ]; then
current_parameter="speed"
elif [ "$current_parameter" = "delay" ]; then
delay=$var
elif [ "$current_parameter" = "speed" ]; then
speed=$var
fi
done
set_speed "$delay" "$speed"
fi