Personal dotfiles
1#!/bin/bash
2
3cd $(dirname $0)
4
5# Some reason Linux `ln` and Mac `ln` don't support the same flags...
6if [ "$(uname)" == 'Darwin' ]; then
7 lndir="ln -sfh"
8else
9 lndir="ln -sfT"
10fi
11
12# Set up bin directory, which must be set up first
13$lndir "$(pwd)/bin" "$HOME/.bin"
14export PATH="$PATH:$HOME/.bin"
15export SKIN=${SKIN:-onedark}
16export FONT_SIZE=${FONT_SIZE:-14}
17
18# If another executable is passed, we call it now.
19# This is intended to be one of the install/for-* scripts.
20if [ -x "$1" ]; then
21 $1
22fi
23
24# Expand templates with theme variables
25. "themes/$SKIN"
26variables=$(cat "themes/$SKIN" | grep '^export' | sed 's/^export \([^=]*\).*/$\1/ ; P ; s/theme_/theme_rgb_/')
27for file in $(find . -name '*.template' -type f); do
28 cd "$(dirname "$file")"
29 export GPG_KEY_ID=$(git config user.signingkey)
30 envsubst "$variables \$PWD \$FONT_SIZE \$GPG_KEY_ID" < "$(basename "$file")" > "$(basename "${file%.template}")"
31 cd - >/dev/null
32done
33
34# Make executable any templated scripts that need to be executable
35chmod +x ./tmux/scripts/tmux-status-left
36
37# Then link configs for all of the installed programs
38dot_config () {
39 $lndir "$(pwd)/$1" "$HOME/.config/$1"
40}
41
42$lndir ./base ./syncat/style/active
43test -d "./syncat/style/$SKIN" && ln -sf "./$SKIN/colours.syncat" "./syncat/style/colours.syncat"
44check broot && dot_config broot
45check fish && dot_config fish
46check flashfocus && dot_config flashfocus
47check hunter && dot_config hunter
48check joshuto && dot_config joshuto
49check kak && dot_config kak
50check kitty && dot_config kitty
51check mako && dot_config mako
52check nvim && dot_config nvim
53check ranger && dot_config ranger
54check rofi && dot_config rofi
55check wofi && dot_config wofi
56check sway && dot_config sway
57check swaylock && dot_config swaylock
58check swayidle && dot_config swayidle
59check hx && dot_config helix
60check tig && dot_config tig
61check zellij && dot_config zellij
62check topgrade && dot_config topgrade
63check wezterm && dot_config wezterm
64check rio && dot_config rio
65check tv && dot_config television
66check yazi && dot_config yazi
67# check hyprland && dot_config hypr # I never ended up setting this one up
68
69if [ "$(uname)" == 'Darwin' ]; then
70 check syncat && $lndir "$(pwd)/syncat" "$HOME/Library/Preferences/com.cameldridge.syncat"
71else
72 check syncat && dot_config syncat
73fi
74
75check waybar && dot_config waybar
76check alacritty && dot_config alacritty
77check tmux && ln -sf "$(pwd)/tmux/.tmux.conf" "$HOME/.tmux.conf"
78$lndir "$(pwd)/terminfo" "$HOME/.terminfo"
79
80ln -sf "$(pwd)/git/.gitconfig" "$HOME/.gitconfig"
81ln -sf "$(pwd)/bash/.bashrc" "$HOME/.bashrc"
82$lndir "$(pwd)/fonts" "$HOME/.fonts"