-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocks.sh
More file actions
45 lines (38 loc) · 1.3 KB
/
Copy pathdocks.sh
File metadata and controls
45 lines (38 loc) · 1.3 KB
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
presets_path=/Users/$(whoami)/Library/Preferences/DockPresets
if [ -z "$1" ] || [ "$1" = "--help" ]; then
echo "Available commands:"
echo
echo "s, save {preset-name} || save preset with specified name"
echo "l, load {preset-name} || load preset with specified name"
echo "rm, remove {preset-name} || remove preset with specified name"
echo "ls, list || print list of all saved presets"
echo "open || open presets folder in Finder"
echo "--help || print out available commands"
exit 0
fi
if [ "$1" = "save" ] || [ "$1" = "s" ]; then
cp -f /Users/$(whoami)/Library/Preferences/com.apple.dock.plist $presets_path/$2.plist
echo "Dock preferenes saved."
exit 0
fi
if [ "$1" = "load" ] || [ "$1" = "l" ]; then
sudo cp $presets_path/$2.plist /Users/$(whoami)/Library/Preferences/com.apple.dock.plist
sleep 1
killall Dock
exit 0
fi
if [ "$1" = "ls" ] || [ "$1" = "list" ]; then
echo "List of your presets:"
ls -1 $presets_path | while read fname; do
echo ${fname%%.*}
done
fi
if [ "$1" = "remove" ] || [ "$1" = "rm" ]; then
rm $presets_path/$2.plist
echo $2 removed.
fi
if [ "$1" = "open" ] || [ "$1" = "." ]; then
cd $presets_path
open .
echo "Folder opened in Finder"
fi