-
Notifications
You must be signed in to change notification settings - Fork 19
/
setup.sh
executable file
·147 lines (133 loc) · 3.08 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
#!/usr/bin/env bash
# Welcome message
echo "Welcome to the dotfiles installation script!"
echo "Please choose your AUR helper:"
echo "[1] yay"
echo "[2] paru"
# Get user's choice of AUR helper
read -p "Enter your choice: " aur_choice
if [ "$aur_choice" == "1" ]; then
aur_helper="yay"
elif [ "$aur_choice" == "2" ]; then
aur_helper="paru"
else
echo "Invalid choice. Exiting..."
exit 1
fi
# Check if AUR helper exists
if ! command -v "$aur_helper" >/dev/null; then
echo "$aur_helper not found. Please install it first."
exit 1
fi
# Packages to install
packages=(
alacritty
autorandr
bat
beautyline
catppuccin-cursors-mocha
catppuccin-gtk-theme-mocha
cava
dunst
eww-git
fd
feh
fish
fzf
ghc
ghcup-hs-bin
git
glava
haskell-utf8-string
haskell-x11
jgmenu
kitty
lazygit
libnotify
lxappearance
neovim
nodejs
npm
polybar
picom-pijulius-git
playerctl
python-pip
rofi
stack
starship
stow
ttf-fira-code
ttf-font-awesome
ttf-jetbrains-mono-nerd
unclutter
wmctrl
xcape
xdo
xorg-xinit
xorg-xmessage
xorg-xmodmap
xorg-xsetroot
zoxide
)
# Install packages
$aur_helper -Syu ${packages[@]}
# Clone dotfiles and stow
echo "Cloning and stowing dotfiles..."
cd $HOME
git clone https://github.com/NeshHari/XMonad.git
mv XMonad starter_kit_dots
cd starter_kit_dots
rm README.md setup.sh
stow_dirs=()
for dir in *; do
if ! stow $dir; then
stow_dirs+=($dir)
fi
done
# Check if there are any failed directories
if [ ${#stow_dirs[@]} -gt 0 ]; then
echo "The following directories could not be stowed: ${stow_dirs[@]}"
echo "Please manually copy the respective configs."
fi
cd ~/.config/xmonad
rm -r xmonad xmonad-contrib
git clone https://github.com/xmonad/xmonad.git
git clone https://github.com/xmonad/xmonad-contrib.git
if pacman -Qi xmonad-contrib &>/dev/null; then
read -p "xmonad-contrib already exists. Do you want to remove it to continue? (y/n) " remove_xmonad_contrib
if [ "$remove_xmonad_contrib" == "y" ]; then
sudo pacman -Rns xmonad-contrib
fi
fi
if pacman -Qi xmonad &>/dev/null; then
read -p "xmonad binary already exists. Do you want to remove it to continue? (y/n) " remove_xmonad
if [ "$remove_xmonad" == "y" ]; then
sudo pacman -Rns xmonad
fi
fi
if [ "$remove_xmonad" == "n" ] || [ "$remove_xmonad_contrib" == "n" ]; then
echo "xmonad and xmonad-contrib must be removed before installing via stack. Exiting..."
exit 1
fi
if ! stack init; then
read -p "stack init failed. Do you want to try 'stack init --force'? (y/n) " force_init
if [ "$force_init" == "y" ]; then
stack init --force
fi
fi
stack install
if ! [ -x "$(command -v xmonad)" ]; then
echo "xmonad binary not found"
read -p "Do you want to symlink (s) xmonad to /usr/bin or add it to PATH (p) in .bashrc? (s/p) " link_choice
if [ "$link_choice" == "s" ]; then
sudo ln -s ~/.local/bin/xmonad /usr/bin
elif [ "$link_choice" == "p" ]; then
echo 'export PATH="$HOME/.local/bin:$PATH"' >>~/.bashrc
source ~/.bashrc
else
echo "Invalid choice. xmonad binary will not be added to PATH. Please do it manually."
fi
fi
xmonad --recompile
xmonad --restart
echo "Installation complete! Enjoy your new dotfiles :)"