-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_script.sh
More file actions
executable file
·49 lines (41 loc) · 1.28 KB
/
init_script.sh
File metadata and controls
executable file
·49 lines (41 loc) · 1.28 KB
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
# !/bin/bash
if [ -z "${HOME+x}" ] ; then echo "Var \$HOME must be set." ; exit 1 ; fi
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
create_link () {
[[ -f "$1" ]] && rm "$1"
ln -s "$2" "$1"
echo "$1 -> $2"
}
link_recursively () {
for DIR in `ls "$1"` ; do
FULL_PATH="${1}/$DIR"
NEW_PATH="${2}/$DIR"
if [[ -f "$FULL_PATH" ]] ; then
create_link "$NEW_PATH" "$FULL_PATH"
elif [[ -d "$FULL_PATH" ]] ; then
[[ -d "$NEW_PATH" ]] || mkdir "$NEW_PATH"
link_recursively "$FULL_PATH" "$NEW_PATH"
fi
done
}
# Link all rc files
find "${SCRIPT_DIR}" -maxdepth 1 -type f \
! -name "init_script.sh" \
! -name "LICENSE" \
! -name "README.md" \
! -name "backlight.py" \
| while read FILE; do
create_link "${HOME}/.$( basename $FILE )" "${FILE}"
done
mkdir -p "$HOME/.config"
link_recursively "${SCRIPT_DIR}/config" "${HOME}/.config"
mkdir -p "$HOME/.cgdb"
link_recursively "${SCRIPT_DIR}/cgdb" "${HOME}/.cgdb"
# Add command
mkdir -p "$HOME/.local/bin"
rm -f "$HOME/.local/bin/backlight"
ln -s "$PWD/backlight.py" "$HOME/.local/bin/backlight"
# Enable Hyprland sesrvices
systemctl --user enable --now hyprpaper.service
systemctl --user enable --now hypridle.service
systemctl --user enable --now waybar.service