dotfiles/gui/basic.sh

119 lines
4.2 KiB
Bash
Raw Normal View History

2022-05-15 02:51:57 +00:00
#!/bin/sh
set -e
DIR=$(dirname "$(readlink -f "$0")")
. "$DIR/../env.sh"
log 'Setting up system utilities X11 ime keyring clipboard screenshot filemanager network bluetooth'
case "$UNAMEA" in
*Ubuntu*)
sudo apt install -y \
xorg libx11-dev libxft-dev libxinerama-dev libxcursor-dev \
libxrandr-dev arandr autorandr \
pavucontrol \
ibus ibus-table ibus-table-wubi \
gnome-keyring \
nitrogen \
network-manager network-manager-gnome \
exfat-utils \
dunst \
xclip xsel \
xdotool \
libnotify-bin \
flameshot scrot \
2022-05-15 14:53:41 +00:00
copyq \
2022-05-15 02:51:57 +00:00
thunar gvfs-bin gvfs-backends thunar-archive-plugin file-roller tumbler
# desktop notification
lnsf "$DIR/dunst/dunstrc" "$XDG_CONFIG_HOME/dunst/dunstrc"
# network
sudo systemctl start NetworkManager
# bluetooth
if has_bluetooth; then
sudo apt install \
bluez bluez-tools blueman pulseaudio-module-bluetooth
sudo systemctl enable bluetooth
sudo systemctl start bluetooth
fi
# laptop
if is_laptop; then
sudo apt install \
acpilght tlp
sudo systemctl enable autorandr
sudo systemctl start autorandr
fi
;;
*artix*)
sudo pacman -S --noconfirm --needed \
xorg-server xorg-xinit xorg-xrandr xorg-xprop xorg-xev xdotool \
pulseaudio pulseaudio-alsa pulseaudio-bluetooth alsa-utils pavucontrol \
perl-file-mimeinfo \
2022-05-15 02:51:57 +00:00
xclip xsel \
clang \
ibus ibus-rime rime-wubi \
networkmanager network-manager-applet \
exfat-utils \
gnome-keyring libsecret \
thunar gvfs-smb gvfs-mtp thunar-archive-plugin file-roller tumbler \
2022-05-15 08:05:46 +00:00
flameshot \
2022-05-15 14:53:41 +00:00
copyq \
2022-05-19 04:24:03 +00:00
sxiv \
2022-05-15 02:51:57 +00:00
alacritty
# ntp
sudo pacman -S --noconfirm --needed \
chrony chrony-runit
sudo ln -sf /etc/runit/sv/chrony/ /run/runit/service/
# ime
RIME_CFG="$XDG_CONFIG_HOME/ibus/rime/build/default.yaml"
if ! grep -F "wubi86" "$RIME_CFG"; then
sed -i 's/schema_list:/schema_list:\n - schema: wubi86/' "$RIME_CFG"
fi
# bluetooth
if has_bluetooth; then
sudo pacman -S --noconfirm --needed \
bluez bluez-utils blueman
# bluetoothctl devices
# bluetoothctl pair <ADDR>
# bluetoothctl trust <ADDR>
# bluetoothctl connect <ADDR>
sudo ln -sf /etc/runit/sv/bluetoothd /run/runit/service/
fi
# laptop
if is_laptop; then
sudo pacman -S --noconfirm --needed \
2022-05-15 06:08:26 +00:00
arandr autorandr \
acpi light python-pip
2022-05-15 03:34:22 +00:00
yay -S --needed --noconfirm auto-cpufreq-git
2022-05-15 02:51:57 +00:00
sudo mkdir -p /etc/runit/sv/auto-cpufreq
2022-05-15 03:34:22 +00:00
sudo cp $DIR/auto-cpufreq/auto-cpufreq-runit /etc/runit/sv/auto-cpufreq/run
2022-05-15 02:51:57 +00:00
sudo chmod +x /etc/runit/sv/auto-cpufreq/run
2022-05-15 03:34:22 +00:00
sudo ln -sf /etc/runit/sv/auto-cpufreq/ /run/runit/service/
2022-05-15 02:51:57 +00:00
fi
;;
esac
# configuration
2022-05-19 04:24:03 +00:00
lnsf "$DIR/sxiv/sxiv.desktop" ~/.local/share/applications/sxiv.desktop
2022-05-15 06:08:26 +00:00
lnsf "$DIR/autorandr/postswitch" "$XDG_CONFIG_HOME/autorandr/postswitch"
2022-05-15 02:51:57 +00:00
lnsf "$DIR/thunar/uca.xml" "$XDG_CONFIG_HOME/Thunar/uca.xml"
lnsf "$DIR/alacritty/alacritty.yml" "$XDG_CONFIG_HOME/alacritty/alacritty.yml"
if is_laptop; then
echo for non-root user to change backlight, add following rule to /etc/udev/rules.d/backlight.rules
echo ```
echo ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="acpi_video0", GROUP="video", MODE="0664"
echo ```
echo for intel_backlight:
echo ```
echo RUN+="/bin/chgrp video /sys/class/backlight/intel_backlight/brightness"
echo RUN+="/bin/chmod g+w /sys/class/backlight/intel_backlight/brightness"
echo ```
2022-05-15 02:51:57 +00:00
fi
# auto execute autorandr for monitor hotplug
echo 'ACTION=="change", SUBSYSTEM=="drm", RUN+="/usr/bin/autorandr --batch --change --force"' \
> sudo tee /etc/udev/rules.d/40-monitor-hotplug.rules