dotfiles/suckless/install.sh

101 lines
2.5 KiB
Bash
Raw Normal View History

2020-11-02 04:08:18 +00:00
#!/bin/sh
2020-09-17 02:47:33 +00:00
2020-11-08 16:26:14 +00:00
set -e
DIR=$(dirname "$(readlink -f "$0")")
2020-11-02 04:08:18 +00:00
. "$DIR/../env.sh"
2020-09-17 10:24:35 +00:00
2020-11-04 06:05:09 +00:00
"$PDIR/fish/install.sh"
"$PDIR/gui/install.sh"
"$PDIR/picom/install.sh"
"$PDIR/dunst/install.sh"
2020-09-17 02:47:33 +00:00
# install dependencies
2020-09-17 10:24:35 +00:00
case "$PM" in
apt)
sudo apt install \
2020-09-17 16:02:24 +00:00
xorg libx11-dev libxft-dev libxinerama-dev \
libxrandr-dev arandr autorandr \
2020-09-17 10:24:35 +00:00
ibus ibus-table ibus-table-wubi \
2020-09-19 01:23:38 +00:00
pavucontrol \
2020-09-17 10:24:35 +00:00
gnome-keyring \
2020-09-17 16:02:24 +00:00
xss-lock \
nitrogen \
2020-09-17 10:24:35 +00:00
trayer
sudo apt remove gdm3
;;
pacman)
2020-09-18 18:01:58 +00:00
sudo pacman -S --needed \
2020-09-17 16:02:24 +00:00
xorg-server xorg-xinit xorg-xrandr xorg-xev xorg-xprop \
alsa-firmware alsa-utils alsa-plugins pulseaudio-alsa pulseaudio pavucontrol \
arandr autorandr \
ibus ibus-table ibus-table-chinese \
gnome-keyring \
xss-lock \
nitrogen \
trayer
2020-09-17 10:24:35 +00:00
;;
esac
2020-09-17 03:07:58 +00:00
# clone / compile utilities and dwm itself
2020-11-08 16:26:14 +00:00
REPOS="$DIR/suckless/repos"
mkdir -p "$REPOS"
installrepo () {
ODIR=$(pwd)
2020-11-08 16:57:55 +00:00
REPO="$DIR/repos/$2"
2020-11-08 16:26:14 +00:00
[ ! -d "$REPO" ] && git clone --depth "$1" "$REPO"
cd "$REPO"
make && sudo make install
cd "$ODIR"
}
installrepo https://gitee.com/klesh/st.git st
installrepo https://gitee.com/klesh/dmenu.git dmenu
installrepo https://gitee.com/klesh/slock.git slock
installrepo https://github.com/klesh/dict.sh.git dict.sh
installrepo https://gitee.com/klesh/dwm.git dwm
2020-09-17 03:07:58 +00:00
# config xinit to start for dwm
rm ~/.xinitrc
2020-09-17 03:07:58 +00:00
cat <<EOT > ~/.xinitrc
2020-09-30 15:04:51 +00:00
#!/bin/sh
2020-09-17 03:07:58 +00:00
export QT_QPA_PLATFORMTHEME="qt5ct"
export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
export XMODIFIERS="@im=ibus"
export QT_IM_MODULE=ibus
export GTK_IM_MODULE=xim
2020-09-17 03:07:58 +00:00
2020-09-30 15:04:51 +00:00
# setup gnome keyring
2020-09-17 03:07:58 +00:00
dbus-update-activation-environment --systemd DISPLAY
export SSH_AUTH_SOCK=$(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)
2020-09-17 03:07:58 +00:00
2020-09-30 15:04:51 +00:00
# load monitors profile
2020-09-17 03:07:58 +00:00
autorandr --change --force
2020-09-30 15:04:51 +00:00
# restart dwm if it existed without error
2020-11-08 16:26:14 +00:00
xrdb -query > /tmp/dwm.log
2020-09-17 03:07:58 +00:00
while :; do
2020-11-05 04:30:12 +00:00
ssh-agent dwm 2>>/tmp/dwm.log || break
2020-09-17 03:07:58 +00:00
done
EOT
2020-09-17 16:02:24 +00:00
2020-10-31 17:36:55 +00:00
cat <<'EOT' > ~/.profile
#!/bin/sh
export PATH=$HOME/dotfiles/bin:$HOME/.local/bin:$PATH
2020-11-04 03:58:06 +00:00
export VIM_MODE=enhanced
2020-11-08 16:26:14 +00:00
export DMENU_DEFAULT_OPTS='-i -c -fn monospace:13 -nb #222222 -nf #bbbbbb -sb #5b97f7 -sf #eeeeee -l 20'
2020-11-01 17:50:32 +00:00
2020-10-31 17:36:55 +00:00
# auto startx
2020-11-05 04:30:12 +00:00
[ -z "$DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq "1" ] \
&& startx
2020-10-31 17:36:55 +00:00
EOT
2020-09-17 16:02:24 +00:00
# config dwm
2020-11-02 04:08:18 +00:00
mkdir -p "$XDG_CONFIG_HOME/dwm"
2020-11-09 08:45:08 +00:00
lnsf "$DIR/config/dwm/autostart" "$XDG_CONFIG_HOME/dwm/autostart"
2020-11-02 04:08:18 +00:00
lnsf "$DIR/config/autorandr/postswitch" "$XDG_CONFIG_HOME/autorandr/postswitch"