setup-cockpit/installation_scripts/i3.sh

112 lines
2.9 KiB
Bash

#!/bin/sh
## This script takes care of the i3 configuration
if [ -z "$BASE_DIR" ]; then
echo "BASE_DIR wasn't set."
exit 1
fi
if [ -z "$GITHUB_DOTFILES" ]; then
echo "GITHUB_DOTFILES wasn't set."
exit 1
fi
# Install required packages {{{
if [ "$OS" = 'arch' ]; then
sudo pacman -S --needed i3
sudo pacman -S --needed dunst suckless-tools
sudo pacman -S --needed picom hsetroot rofi xsettingsd lxappearance scrot viewnior
sudo pacman -S --needed noto-fonts
elif [ "$OS" = 'debian' ]; then
sudo apt install i3
sudo apt install dunst suckless-tools
sudo apt install picom hsetroot rofi xsettingsd lxappearance scrot viewnior
sudo apt install fonts-noto
else
echo "${RED}The OS wasn't defined. Quitting...${NC}"
exit 1
fi
# }}}
# Add clones from GitHub {{{
mkdir -p "$GITHUB_DOTFILES"
if [ -e "$GITHUB_DOTFILES"/i3-starterpack ]; then
if [ "$UPDATE" = 'true' ]; then
cd "$GITHUB_DOTFILES"/i3-starterpack && git pull
fi
else
cd "$GITHUB_DOTFILES" && git clone https://github.com/addy-dclxvi/i3-starterpack.git
fi
if [ -e "$GITHUB_DOTFILES"/i3blocks-contrib ]; then
if [ "$UPDATE" = 'true' ]; then
cd "$GITHUB_DOTFILES"/i3blocks-contrib && git pull
fi
else
cd "$GITHUB_DOTFILES" && git clone https://github.com/vivien/i3blocks-contrib.git
fi
# }}}
# Add config links {{{
echo "Adding .Xresources and .xsettingsd"
if [ ! -L ~/.Xresources ]; then
ln -rs "$GITHUB_DOTFILES"/i3-starterpack/.Xresources ~/.Xresources 2> /dev/null
fi
if [ ! -L ~/.xsettingsd ]; then
ln -rs "$GITHUB_DOTFILES"/i3-starterpack/.xsettingsd ~/.xsettingsd 2> /dev/null
fi
echo "Adding picom.config"
mkdir -p ~/.config
if [ ! -L ~/.config/picom.conf ]; then
ln -rs "$BASE_DIR"/dotfiles/picom.conf ~/.config/picom.conf 2> /dev/null
fi
echo "Adding feather.ttf"
mkdir -p ~/.fonts/icomoon
if [ ! -L ~/.fonts/icomoon/feather.ttf ]; then
ln -rs "$GITHUB_DOTFILES"/i3-starterpack/.fonts/icomoon/feather.ttf ~/.fonts/icomoon/feather.ttf 2> /dev/null
fi
# }}}
# Add i3 main config {{{
echo "Adding i3/config"
mkdir -p ~/.config/i3
if [ ! -L ~/.config/i3/config ]; then
ln -rs "$BASE_DIR"/dotfiles/i3/i3_config ~/.config/i3/config 2> /dev/null
fi
# }}}
# Add i3status config {{{
echo "Adding i3status/config"
mkdir -p ~/.config/i3status
if [ ! -L ~/.config/i3status/config ]; then
ln -rs "$BASE_DIR"/dotfiles/i3/i3status_config ~/.config/i3status/config 2> /dev/null
fi
# }}}
# Add i3blocks config {{{
echo "Adding i3blocks/config"
mkdir -p ~/.config/i3blocks/scripts
if [ ! -L ~/.config/i3blocks/config ]; then
ln -rs "$BASE_DIR"/dotfiles/i3/i3blocks_config ~/.config/i3blocks/config 2> /dev/null
fi
if [ ! -L ~/.config/i3blocks/scripts/arch-update ]; then
ln -rs "$GITHUB_DOTFILES"/i3blocks-contrib/arch-update/arch-update ~/.config/i3blocks/scripts/arch-update 2> /dev/null
fi
if [ ! -L ~/.config/i3blocks/scripts/rofi-calendar ]; then
ln -rs "$GITHUB_DOTFILES"/i3blocks-contrib/rofi-calendar/rofi-calendar ~/.config/i3blocks/scripts/rofi-calendar 2> /dev/null
fi
# }}}