-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.sh
executable file
·188 lines (149 loc) · 4.96 KB
/
setup.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#!/bin/bash
#
# dotfiles setup script
# KH
#
DOTS_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
echo "Installing dotfiles relative to: $DOTS_HOME..."
# Determine resolution to use
HIRES=""
while [[ "$HIRES" != "n" && "$HIRES" != "y" ]]; do
read -r -p "Configure system for 4k display? [y|N] " HIRES
HIRES="${HIRES,,}"
if [[ "$HIRES" == "" ]]; then
HIRES="n"
fi
done
# Check for configuration directory
if [ -z $XDG_CONFIG_HOME ]; then
XDG_CONFIG_HOME=$HOME/.config
fi
mkdir -p $XDG_CONFIG_HOME
# Create completions cache dir
mkdir -p $HOME/.cache/zinit/completions
# Checks for file or directory and creates a sym link if it doesn't already exist
function ln_s() {
# delete existing symlink if it exists
if [[ -e "$2" && -L "$2" ]]; then
rm $2
fi
echo "[CREATING] \"$2\""
ln -sf $1 $2
}
echo "Setting up dotfiles..."
# Setup zsh
ln_s ${DOTS_HOME}/zshrc ~/.zshrc
ln_s ${DOTS_HOME}/zshenv ~/.zshenv
ln_s ${DOTS_HOME}/shell ~/.shell
# Create needed directories
for x in "compton" "i3" "rofi" "wal"; do
mkdir -p ${XDG_CONFIG_HOME}/${x}
done
# Gtk 3.0
if [ ! -e ${XDG_CONFIG_HOME}/gtk-3.0/ ]; then
mkdir ${XDG_CONFIG_HOME}/gtk-3.0/
fi
ln_s ${DOTS_HOME}/gtk-3.0/settings.ini ${XDG_CONFIG_HOME}/gtk-3.0/settings.ini
ln_s ${DOTS_HOME}/gtk-3.0/gtk.css ${XDG_CONFIG_HOME}/gtk-3.0/gtk.css
# Gtk 4.0
if [ ! -e ${XDG_CONFIG_HOME}/gtk-4.0/ ]; then
mkdir ${XDG_CONFIG_HOME}/gtk-4.0/
fi
ln_s ${DOTS_HOME}/gtk-4.0/settings.ini ${XDG_CONFIG_HOME}/gtk-4.0/settings.ini
ln_s ${DOTS_HOME}/gtk-4.0/gtk.css ${XDG_CONFIG_HOME}/gtk-4.0/gtk.css
# ~/.config/xx
for path in "dunst" "fcitx" "feh" "git" "mimeapps.list" "nvim" "redshift.conf" \
"labnote" "lsd" "polybar" "powerline" "snakemake" \
"picom.conf" "sway" "termcolors" "zathura" "zeit"; do
ln_s ${DOTS_HOME}/${path} ${XDG_CONFIG_HOME}/${path}
done
# ~/.xx
for path in "cookiecutterrc" "ctags" "dir_colors" \
"plotly" "Rprofile" "Renviron" "tmux.conf" \
"vim" "vimrc" "visidatarc" "xinitrc" "Xmodmap" "Xresources" \
"condarc" "xprofile"; do
ln_s ${DOTS_HOME}/${path} ~/.${path}
done
# git
ln_s ${DOTS_HOME}/git/ignore ${HOME}/.gitignore_global
ln_s ${DOTS_HOME}/git/config ${HOME}/.gitconfig
# julia
mkdir -p ${HOME}/.julia/config
ln_s ${DOTS_HOME}/$julia/startup.jl ${HOME}/.julia/config/startup.jl
# jupyter
mkdir -p ${HOME}/.jupyter
ln_s ${DOTS_HOME}/jupyter/jupyter_qtconsole_config.py ${HOME}/.jupyter/jupyter_qtconsole_config.py
# mamba
ln_s ${DOTS_HOME}/condarc ${HOME}/.mambarc
# r
ln_s ${DOTS_HOME}/lintr ${HOME}/.lintr
# 4k configs (i3, rofi, wal )
if [[ "$HIRES" == "y" ]]; then
ln_s ${DOTS_HOME}/i3/config.4k ${XDG_CONFIG_HOME}/i3/config
ln_s ${DOTS_HOME}/rofi/config.4k.rasi ${XDG_CONFIG_HOME}/rofi/config.rasi
ln_s ${DOTS_HOME}/wal/templates.4k ${XDG_CONFIG_HOME}/wal/templates
else
ln_s ${DOTS_HOME}/i3/config ${XDG_CONFIG_HOME}/i3/config
ln_s ${DOTS_HOME}/rofi/config.rasi ${XDG_CONFIG_HOME}/rofi/config.rasi
ln_s ${DOTS_HOME}/wal/templates ${XDG_CONFIG_HOME}/wal/templates
fi
# wal colorscheme
ln_s ${DOTS_HOME}/wal/colorschemes ${XDG_CONFIG_HOME}/wal/colorschemes
# to install pywal alt color algorithms:
# pip install --user colorz haishoku colorthief
# create i3 and sway log dirs
mkdir -p ~/.cache/i3
mkdir -p ~/.cache/sway
# create pomodoro cache
# symlink Xresources to Xdefaults for sway
ln_s ${DOTS_HOME}/Xresources ~/.Xdefaults
# scripts, etc.
ln_s ${DOTS_HOME}/bin ~/
# create vim backup dir
mkdir -p ~/.vim/tmp/backup
# mimetypes
mkdir -p ~/.local/share/mime
ln_s ${DOTS_HOME}/mime ~/.local/share/mime/packages
update-mime-database ~/.local/share/mime
rm ${XDG_CONFIG_HOME}/mimeapps.list
ln_s ${DOTS_HOME}/mimeapps.list ${XDG_CONFIG_HOME}/mimeapps.list
# fontconfig
mkdir -p $XDG_CONFIG_HOME/fontconfig
ln_s ${DOTS_HOME}/fonts.conf $XDG_CONFIG_HOME/fontconfig/fonts.conf
# install tpm
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
#
# external dependencies
#
# arch
echo "Arch packages:"
echo "bat fasd fd fzf gotop-bin lsd moar powerline ripgrep thefuck tk tldr visidata"
echo "polybar nerd-fonts-complete ttf-weather-icons"
while true
do
read -r -p "Install Arch packages? [Y/n] " input
case $input in
[yY][eE][sS]|[yY])
# install yay
echo "Installing yay AUR helper..."
cd /tmp
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
cd -
echo "Finished installing yay..."
# install arch packages
echo "Installing Arch packages..."
yay -S bat dust fasd fd fzf gotop-bin lsd moar visidata powerline ripgrep polybar \
tre-command ttf-nerd-fonts-symbols ttf-hack-nerd ttf-weather-icons
;;
[nN][oO]|[nN])
echo "Skipping Arch package installation..."
break
;;
*)
echo "Invalid input..."
;;
esac
done
echo "Done!"