-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions
100 lines (74 loc) · 2.01 KB
/
functions
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
source $DOTFILES/.tmux/powerline/lib/tmux_adapter.sh
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
disable_dashboard() {
defaults write com.apple.dashboard mcx-disabled -boolean YES && killall Dock
}
enable_dashboard() {
defaults write com.apple.dashboard mcx-disabled -boolean NO && killall Dock
}
clean_launchpad() {
sqlite3 "/Users/jubianchi/Library/Application\ Support/Dock/A14DFEE6-5E34-4A57-A875-1A270780567C.db" "DELETE from apps; DELETE from groups WHERE title <> ''; DELETE from items WHERE rowid>2;" && killall Dock
}
function dotfiles_update() {
$DOTFILES/install.sh $*
source ~/.zshrc
}
function dotfiles_link() {
FILE=$DOTFILES/$1
DEFAULT_LINK=$HOME/$1
LINK=${2:-$DEFAULT_LINK}
if [ "$1" = ".gitconfig" ]
then
echo "You should not link $FILE."
echo "Instead, use include in your .gitconfig:"
echo
echo "[include]"
echo " path = $DOTFILES/.gitconfig"
return 1
fi
if [[ "$1" = ".jubianchirc" || "$1" = "aliases" || "$1" = "exports" || "$1" = "functions" || "$1" = "hooks" || "$1" = "keys" || "$1" = "tools" ]]
then
echo "You should not link $FILE."
echo "Instead, source it in your .zshrc:"
echo
echo "source $DOTFILES/$1"
return 1
fi
if [[ "$1" = ".git" || "$1" = ".gitmodules" || "$1" = "README.md" || "$1" = "install.sh" || "$1" = ".dir_colors" ]]
then
echo "File $FILE is not linkable"
return 2
fi
if [ ! -f $FILE ]
then
echo "File $FILE does not exist"
return 2
fi
if [ -L $LINK ]
then
echo "File $LINK already linked"
return 2
fi
if [ -f $LINK ]
then
echo "File $LINK already exists"
return 2
fi
ln -s $FILE $LINK
}
capture() {
local FILE
FILE=$(mktemp -t capture).png
screencapture -t png $* $FILE
open -a Preview $FILE
echo $FILE
}
leave_me_alone() {
launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist && \
sudo killall -9 NotificationCenter
}
ping_me() {
launchctl load -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
}