123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- #!/bin/bash
- URL="https://git.sr.ht/~heckyel/i3-config"
- while true
- do
- function _copy_i3_config() {
- # check root
- if [[ "$UID" == 0 ]]; then
- root_key=''
- elif [[ $(command -v sudo) ]]; then
- root_key=sudo
- elif [[ $(command -v doas) ]]; then
- root_key=doas
- fi
- ## Install dependencies
- if [[ $(command -v pacman) ]]; then
- $root_key pacman -Syy --noconfirm
- # i3 base
- $root_key pacman -S --noconfirm i3-wm i3status dmenu sysstat
- # i3 blocks and dependecies
- $root_key pacman -S --noconfirm i3blocks rofi \
- conky acpi scrot st sakura feh ranger bubblewrap \
- ttf-hack xenocara-xbacklight xdg-user-dirs
- fi
- # Install i3config
- printf '%b%s%b%s%b\n' '\e[1;32m' '==> ' '\e[0m\033[1m' 'Cloning i3-config...' '\e[m'
- git clone "$URL" "/tmp/i3config/" --depth=1
- printf '%b%s%b%s%b\n' '\e[1;32m' '==> ' '\e[0m\033[1m' 'Copying images...' '\e[m'
- install -d -m755 "$HOME/.config/i3/images"
- for i in background.png; do
- install -m644 -v "/tmp/i3config/images/$i" "$HOME/.config/i3/images/$i"
- done
- printf '%b%s%b%s%b\n' '\e[1;32m' '==> ' '\e[0m\033[1m' 'Copying scripts...' '\e[m'
- cp -rv /tmp/i3config/scripts "$HOME/.config/i3/"
- printf '%b%s%b%s%b\n' '\e[1;32m' '==> ' '\e[0m\033[1m' 'Copying i3-config...' '\e[m'
- for i in config i3blocks.conf; do
- install -m644 -v "/tmp/i3config/$i" "$HOME/.config/i3/$i"
- done
- printf '%b%s%b%s%b\n' '\e[1;32m' '==> ' '\e[0m\033[1m' 'Copying conky...' '\e[m'
- install -d -m755 "$HOME/.config/conky/"
- install -m644 -v /tmp/i3config/extra/conky.conf "$HOME/.config/conky/"
- printf '%b%s%b%s%b\n' '\e[1;32m' '==> ' '\e[0m\033[1m' 'Copying bubblewrap scripts...' '\e[m'
- install -d -m755 "$HOME/.config/bwrap/"
- for i in /tmp/i3config/bwrap/*.bash; do
- install -m644 -v "$i" "$HOME/.config/bwrap/"
- done
- printf '%b%s%b%s%b\n' '\e[1;32m' '==> ' '\e[0m\033[1m' 'Copying FontAwesome...' '\e[m'
- install -d -m755 "$HOME/.local/share/fonts/"
- for i in /tmp/i3config/fonts/*.ttf; do
- install -m644 -v "$i" "$HOME/.local/share/fonts/"
- done
- printf '%b%s%b%s%b\n' '\e[1;32m' '==> ' '\e[0m\033[1m' 'Make log directory...' '\e[m'
- install -d -m755 "$HOME/.config/i3/logs/"
- # clean up temp files
- rm -rf /tmp/i3config/
- # update xdg-user-dirs
- printf '%b%s%b%s%b\n' '\e[1;32m' '==> ' '\e[0m\033[1m' 'Run xdg-user-dirs-update...' '\e[m'
- $(command -v xdg-user-dirs-update) && xdg-user-dirs-update
- }
- case ${LANG/_*/} in
- es)
- read -r -p "¿Estás seguro de instalar i3config? [S/n]: " input
- case $input in
- [sS]|"") _copy_i3_config "$@"; break ;;
- [nN]) break ;;
- *) echo "Por favor responde sí o no" ;;
- esac
- ;;
- *)
- read -r -p "Are you sure to install i3config? [Y/n]: " input
- case $input in
- [yY]|"") _copy_i3_config "$@"; break ;;
- [nN]) break ;;
- *) echo "Please answer yes or no.";;
- esac
- ;;
- esac
- done
- unset URL
|