dotfiles/restore.sh

139 lines
4.3 KiB
Bash
Raw Normal View History

2023-10-08 22:26:07 -05:00
#!/usr/bin/env bash
shopt -s extglob # used for not copying config.fish if it's nixos
2023-10-08 22:26:07 -05:00
GIT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
command_exists() { type "$1" &>/dev/null; }
2023-11-20 00:48:36 -06:00
# fish
2023-10-08 22:26:07 -05:00
rm -rf $HOME/.config/fish/
if command_exists "nixos-rebuild"; then
cd $GIT_DIR/fish/
mkdir $HOME/.config/fish/
cp -r !(config.fish) $HOME/.config/fish/
cd -
else
cp -r $GIT_DIR/fish/ $HOME/.config/
fi
fish -c 'fisher update'
2024-04-17 21:41:22 -05:00
fish -c "tide configure --auto --style=Classic --prompt_colors='True color' --classic_prompt_color=Dark --show_time='24-hour format' --classic_prompt_separators=Vertical --powerline_prompt_heads=Sharp --powerline_prompt_tails=Flat --powerline_prompt_style='One line' --prompt_spacing=Compact --icons='Many icons' --transient=No"
2023-11-14 11:41:09 -06:00
2023-11-20 00:48:36 -06:00
# kitty
rm -rf $HOME/.config/kitty/
2023-10-08 22:26:07 -05:00
cp -r $GIT_DIR/kitty/ $HOME/.config/
2023-11-20 00:48:36 -06:00
# nvim
rm -rf $HOME/.config/nvim/
2023-10-08 22:26:07 -05:00
cp -r $GIT_DIR/nvim/ $HOME/.config/
2023-11-14 11:41:09 -06:00
2023-11-20 00:48:36 -06:00
# gpg
rm -f $HOME/.gnupg/gpg-agent.conf
rm -f $HOME/.gnupg/gpg.conf
mkdir $HOME/.gnupg
2023-10-10 20:25:23 -05:00
cp -r $GIT_DIR/gnupg/* $HOME/.gnupg/
2023-11-14 11:41:09 -06:00
2023-11-20 00:48:36 -06:00
# vesktop
mkdir $HOME/.config/vesktop
cp -r $GIT_DIR/vesktop/* $HOME/.config/vesktop/
2024-03-07 19:49:01 -06:00
2023-11-20 00:48:36 -06:00
# i3
rm -rf $HOME/.config/i3
cp -r $GIT_DIR/i3 $HOME/.config/
# sway
rm -rf $HOME/.config/sway
cp -r $GIT_DIR/sway $HOME/.config/
outputs=$(swaymsg -t get_outputs)
width=$(echo $outputs | jq -r .[0].modes.[0].width)
height=$(echo $outputs | jq -r .[0].modes.[0].height)
sed -i "s/set \$lockwall \"swaylock -i ~\/\.config\/sway\/backgrounds\/widthxheight\.png\"/set \$lockwall \"swaylock -i ~\/\.config\/sway\/backgrounds\/${width}x${height}\.png\"/g" $HOME/.config/sway/config
2023-11-20 12:09:00 -06:00
# greetd (for sway)
if [ -d /etc/greetd ]; then
2023-11-23 00:23:48 -06:00
sudo rm /etc/greetd/config.toml
sudo cp $GIT_DIR/greetd/config.toml /etc/greetd/config.toml
2023-11-20 12:09:00 -06:00
fi
2023-11-23 00:23:48 -06:00
2023-12-06 21:46:34 -06:00
# xinitrc
cp $GIT_DIR/other-files/.xinitrc $HOME/.xinitrc
# Claws Mail configs
mkdir $HOME/.claws-mail/
cp $GIT_DIR/claws-mail/clawsrc $HOME/.claws-mail/clawsrc
cp $GIT_DIR/claws-mail/matcherrc $HOME/.claws-mail/matcherrc
2024-03-06 20:26:26 -06:00
# rofi
rm -rf $HOME/.config/rofi/
cp -r $GIT_DIR/rofi $HOME/.config/rofi/
# GTK dark theme
mkdir ~/.config/gtk-3.0
2024-08-01 14:48:42 -05:00
echo -e "[Settings]\ngtk-application-prefer-dark-theme = true" >~/.config/gtk-3.0/settings.ini
gsettings set org.gnome.desktop.interface color-scheme prefer-dark
2024-08-01 14:48:42 -05:00
gsettings set org.gnome.desktop.interface gtk-theme Adwaita-dark
2024-03-18 20:53:52 -05:00
# fix-gamepad.service
if ! command_exists "nixos-rebuild" && command_exists "systemctl"; then
sudo cp $GIT_DIR/systemd/fix-gamepad.service /etc/systemd/system/
#sudo systemctl enable --now fix-gamepad.service
2024-03-18 20:53:52 -05:00
fi
2024-03-22 12:55:56 -05:00
# fontconfig
rm -rf $HOME/.config/fontconfig/conf.d/
mkdir -p $HOME/.config/fontconfig/conf.d/
2024-03-22 12:55:56 -05:00
cp -r $GIT_DIR/fontconfig/* $HOME/.config/fontconfig/conf.d/
# waybar
rm -rf $HOME/.config/waybar/
mkdir $HOME/.config/waybar/
cp -r $GIT_DIR/waybar/* $HOME/.config/waybar/
2024-08-01 14:48:42 -05:00
# sway-runner
# TODO: make this work on nix too
if command_exists "xbps-install"; then
sudo cp $GIT_DIR/sway-runner /usr/bin/sway-runner
sudo chown root /usr/bin/sway-runner
fi
# Librewolf
# to make sure a profile exists to apply this to
if [ $(find ~/.librewolf -mindepth 1 -maxdepth 1 -type d -name "*.*" | wc -l) -eq 0 ]; then
librewolf &
pkill librewolf
sleep 1
fi
cd ~/.librewolf
for dir in $(find . -mindepth 1 -maxdepth 1 -type d -name "*.*"); do
for line in $(cat $GIT_DIR/librewolf/prefs.js); do
if ! grep -q "$line" $dir/prefs.js; then
echo "$line" >>$dir/prefs.js
fi
done
done
# WezTerm
wezterm shell-completion --shell fish > ~/.config/fish/completions/wezterm.fish
2024-08-16 11:18:15 -05:00
cp $GIT_DIR/wezterm.lua ~/.wezterm.lua
gsettings set org.cinnamon.desktop.default-applications.terminal exec wezterm-gui
# Git config
cp $GIT_DIR/gitconfig ~/.gitconfig
# VS code
mkdir -p $HOME/.config/Code/User/
2024-03-06 20:18:13 -06:00
mkdir -p $HOME/.vscode/
cp $GIT_DIR/vscode/keybindings.json $HOME/.config/Code/User/
cp $GIT_DIR/vscode/settings.json $HOME/.config/Code/User/
if command_exists "code"; then
for ext in $(cat $GIT_DIR/vscode/extensions.txt); do code --install-extension $ext; done
cp $GIT_DIR/vscode/argv.json $HOME/.vscode/argv.json
elif command_exists "code-oss"; then
for ext in $(cat $GIT_DIR/vscode/extensions.txt); do code-oss --install-extension $ext; done
cp $GIT_DIR/vscode/argv.json $HOME/.vscode-oss/argv.json
fi
echo "restore.sh done!"
2024-08-23 16:05:30 -05:00
# default applications
xdg-settings set default-web-browser librewolf.desktop