-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdrawercli.alrc.plugin.sh
54 lines (43 loc) · 1.64 KB
/
drawercli.alrc.plugin.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
#! bash alrc-termux.module
set +o noclobber
plugin_shortname=$(echo "${BASH_SOURCE[0]}" | awk '{gsub(/.*[/]|[.].*/, "", $0)} 1' )
alrc_plugin_enabled+=($plugin_shortname)
readarray -t alrc_plugin_enabled <<< $(printf "%s\n" "${alrc_plugin_enabled[@]}" | sort -u)
main() {
local ps=${plugin_shortname}
if ! grep -q 'source /data/data/com.termux/files/home/.drawercli_aliases' ~/.bashrc; then
cat >> ~/.bashrc <<EOF
# Load drawercli alias generated by drawercli plugin alrc
source /data/data/com.termux/files/home/.drawercli_aliases
EOF
fi
if ! grep -q 'source /data/data/com.termux/files/home/storage/shared/termuxlauncher/.apps-launcher' ~/.bashrc; then
cat >> ~/.bashrc <<EOF
# Init termuxlauncher generated by drawercli plugin alrc
source /data/data/com.termux/files/home/storage/shared/termuxlauncher/.apps-launcher
EOF
fi
if [ ! -f ~/.drawercli_aliases ]; then
cat <<- "EOF" > ~/.drawercli_aliases
# Generate by plugin drawercli.alrc.plugin.sh
# require termuxlauncher app
alias wallpaper='ranpper-termux ~/storage/downloads && drawercli -w'
alias apps='drawercli'
alias app_favorites='drawercli -u'
alias app_recomendations='drawercli -S'
alias app_refesh='drawercli -r'
alias app_wallpaper='drawercli -w'
EOF
fi
ln -s $(type -p drawercli) ~/.shortcuts/drawercli 2>/dev/null;
install ~/.shortcuts/drawercli ~/.shortcuts/drawercli.app 2>/dev/null;
echo -e "alrc-termux: Plugin ${ps} successfully loadded!"
echo -e "+1 \"${ps}.app\" file added at ~/.shortcuts"
}
if check_dependency drawercli 2>/dev/null; then
main
else
echo -e "please install it from https://github.com/luisadha/drawercli "
fi
unset -f main
unset plugin_shortname