-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdwm.sh
146 lines (119 loc) · 3.81 KB
/
dwm.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
#!/bin/bash
set -e
update_system() {
echo "Updating system..."
sudo pacman -Syu --noconfirm
}
install_packages() {
echo "Installing base packages..."
sudo pacman -S --noconfirm --needed \
base-devel libconfig dbus libev libx11 libxcb libxext libgl libegl libepoxy \
meson ninja pcre2 pixman uthash xcb-util-image xcb-util-renderutil xorgproto \
cmake libxft libimlib2 libxinerama libxcb-res xorg-xev xorg-xbacklight \
alsa-utils ttf-dejavu ttf-font-awesome ttf-jetbrains-mono
}
install_extra_packages() {
sudo pacman -S feh firefox python-pywal --noconfirm --needed
}
install_nerd_font() {
echo "Installing Nerd Fonts..."
sudo pacman -S --noconfirm --needed nerd-fonts
echo "Rebuilding font cache..."
fc-cache -fv || {
echo "Failed to rebuild font cache"
return 1
}
}
clone_dwm() {
echo "Creating directories for DWM, dmenu, and st..."
mkdir -p "$HOME/.config/suckless/dwm" \
"$HOME/.config/suckless/dmenu" \
"$HOME/.config/suckless/st"
echo "Cloning DWM repository..."
if [ ! -d "$HOME/.config/suckless/dwm/.git" ]; then
git clone https://github.com/umrian/dwm "$HOME/.config/suckless/dwm/"
else
echo "DWM repository already exists. Skipping clone."
fi
echo "Cloning dmenu repository..."
if [ ! -d "$HOME/.config/suckless/dmenu/.git" ]; then
git clone https://github.com/umrian/dmenu "$HOME/.config/suckless/dmenu/"
else
echo "dmenu repository already exists. Skipping clone."
fi
echo "Cloning st repository..."
if [ ! -d "$HOME/.config/suckless/st/.git" ]; then
git clone https://github.com/umrian/st "$HOME/.config/suckless/st/"
else
echo "st repository already exists. Skipping clone."
fi
cd "$HOME/.config/suckless/dwm/" || {
echo "Failed to change directory to DWM. Exiting..."
exit 1
}
}
build_dwm() {
echo "Building and installing DWM..."
#echo "Building and installing DWM, dmenu, and st..."
for app in dwm; do
#for app in dwm dmenu st; do
app_dir="$HOME/.config/suckless/$app"
if [ -d "$app_dir" ]; then
echo "Building and installing $app..."
cd "$app_dir" || {
echo "Failed to change directory to $app. Skipping..."
continue
}
make && sudo make install || {
echo "Failed to build/install $app. Skipping..."
continue
}
else
echo "Directory for $app not found. Skipping..."
fi
done
echo "Adding DWM to .xinitrc..."
if [ ! -f "$HOME/.xinitrc" ]; then
echo "exec dwm" > "$HOME/.xinitrc"
else
echo "~/.xinitrc already exists. Please add 'exec dwm' manually."
fi
}
install_picom() {
echo "Setting up Picom..."
mkdir -p ~/build
if [ ! -d ~/build/picom ]; then
if ! git clone https://github.com/FT-Labs/picom.git ~/build/picom; then
echo "Failed to clone the Picom repository"
return 1
fi
else
echo "Picom repository already exists. Skipping clone."
fi
cd ~/build/picom || {
echo "Failed to change directory to Picom. Exiting..."
return 1
}
echo "Building Picom..."
if ! meson setup --buildtype=release build; then
echo "Meson setup failed"
return 1
fi
if ! ninja -C build; then
echo "Ninja build failed"
return 1
fi
echo "Installing Picom..."
if ! sudo ninja -C build install; then
echo "Failed to install Picom"
return 1
fi
echo "Picom installed successfully!"
}
update_system
install_packages
install_nerd_font
install_picom
#clone_dwm
build_dwm
echo "Done! You can now start DWM with the 'startx' command."