/
ellipsis.sh
88 lines (72 loc) · 2.89 KB
/
ellipsis.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
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
##############################################################################
# @file ellipsis.sh
# @date January, 2016
# @author G. Roggemans <g.roggemans@grog.be>
# @copyright Copyright (c) GROG [https://grog.be] 2016, All Rights Reserved
# @license MIT
##############################################################################
# Minimal ellipsis version
ELLIPSIS_VERSION_DEP='1.9.4'
# Package dependencies (informational/not used!)
ELLIPSIS_PKG_DEPS=''
##############################################################################
pkg.install(){
# Create wallpapers directory
mkdir -p "$PKG_PATH/wallpaper"
# Install packages with ansible (if available)
if utils.cmd_exists 'ansible-playbook' &&
utils.prompt 'Install i3 packages? (y/n) :' 'no'; then
(cd ansible; ansible-playbook -K install.yml)
fi
}
##############################################################################
pkg.link() {
# Link package into ~/.i3(blocks)
mkdir -p "$ELLIPSIS_HOME/.config"
fs.link_file "$PKG_PATH" "$ELLIPSIS_HOME/.config/i3"
fs.link_file "$PKG_PATH/i3blocks" "$ELLIPSIS_HOME/.config/i3blocks"
fs.link_file "$PKG_PATH/wallpaper" "$ELLIPSIS_HOME/.config/wallpaper"
fs.link_file "$PKG_PATH/redshift.conf" "$ELLIPSIS_HOME/.config/redshift.conf"
# Auto link active wallpapers
if [ -d ~/Pictures/wallpapers/active ]; then
fs.link_file ~/Pictures/wallpapers/active "$ELLIPSIS_HOME/.config/wallpaper/Pwall_active"
fi
if [ -d ~/pictures/wallpapers/active ]; then
fs.link_file ~/pictures/wallpapers/active "$ELLIPSIS_HOME/.config/wallpaper/pwall_active"
fi
if [ -d ~/Images/wallpapers/active ]; then
fs.link_file ~/Images/wallpapers/active "$ELLIPSIS_HOME/.config/wallpaper/Iwall_active"
fi
if [ -d ~/images/wallpapers/active ]; then
fs.link_file ~/images/wallpapers/active "$ELLIPSIS_HOME/.config/wallpaper/iwall_active"
fi
}
##############################################################################
pkg.pull() {
# Use improved update strategy
git remote update 2>&1 > /dev/null
if git.is_behind; then
pkg.unlink
git.pull
pkg.link
fi
}
##############################################################################
pkg.unlink() {
# Remove config dir
rm "$ELLIPSIS_HOME/.config/i3"
rm "$ELLIPSIS_HOME/.config/i3blocks"
rm "$ELLIPSIS_HOME/.config/wallpaper"
rm "$ELLIPSIS_HOME/.config/redshift.conf"
# Remove all links in the home folder
hooks.unlink
}
##############################################################################
pkg.uninstall() {
# Uninstall packages with ansible (if available)
if utils.cmd_exists 'ansible-playbook' &&
utils.prompt 'Uninstall i3 packages? (y/n) :' 'no'; then
(cd ansible; ansible-playbook -K uninstall.yml)
fi
}
##############################################################################