feat: laptop support
This commit is contained in:
parent
dc6672bc41
commit
09f392a328
2
env.sh
2
env.sh
|
@ -10,6 +10,8 @@ PDIR=$(dirname "${DIR-$0}")
|
||||||
GITHUB_PROXY=${GITHUB_PROXY-$HTTPS_PROXY}
|
GITHUB_PROXY=${GITHUB_PROXY-$HTTPS_PROXY}
|
||||||
WSL=$(grep -i Microsoft /proc/sys/kernel/osrelease || true)
|
WSL=$(grep -i Microsoft /proc/sys/kernel/osrelease || true)
|
||||||
TMPDIR=${TMPDIR-"/tmp"}
|
TMPDIR=${TMPDIR-"/tmp"}
|
||||||
|
UNAMEA=$(uname -a)
|
||||||
|
RUNIT=$(command -v runit)
|
||||||
|
|
||||||
in_china() {
|
in_china() {
|
||||||
! [ -f $TMPDIR/myip_full ] && curl -s myip.ipip.net > $TMPDIR/myip_full
|
! [ -f $TMPDIR/myip_full ] && curl -s myip.ipip.net > $TMPDIR/myip_full
|
||||||
|
|
2
gui/auto-cpufreq/auto-cpufreq-runit
Normal file
2
gui/auto-cpufreq/auto-cpufreq-runit
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/sh
|
||||||
|
exec /usr/local/bin/auto-cpufreq --daemon
|
106
gui/basic.sh
Executable file
106
gui/basic.sh
Executable file
|
@ -0,0 +1,106 @@
|
||||||
|
#!/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 \
|
||||||
|
xss-lock \
|
||||||
|
nitrogen \
|
||||||
|
network-manager network-manager-gnome \
|
||||||
|
exfat-utils \
|
||||||
|
dunst \
|
||||||
|
xclip xsel \
|
||||||
|
xdotool \
|
||||||
|
libnotify-bin \
|
||||||
|
flameshot scrot \
|
||||||
|
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 \
|
||||||
|
pipewire pipewire-pulse pipewire-jack pavucontrol \
|
||||||
|
arandr \
|
||||||
|
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 \
|
||||||
|
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 \
|
||||||
|
acpi acpilight python-pip
|
||||||
|
yay -S auto-cpufreq-git
|
||||||
|
sudo mkdir -p /etc/runit/sv/auto-cpufreq
|
||||||
|
sudo cp ./auto-cpufreq/auto-cpufreq-runit /etc/runit/sv/auto-cpufreq/run
|
||||||
|
sudo chmod +x /etc/runit/sv/auto-cpufreq/run
|
||||||
|
sudo ln -s /etc/runit/sv/auto-cpufreq/ /run/runit/service/
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
# configuration
|
||||||
|
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 ```
|
||||||
|
fi
|
100
gui/sysutils.sh
Executable file → Normal file
100
gui/sysutils.sh
Executable file → Normal file
|
@ -4,10 +4,10 @@ set -e
|
||||||
DIR=$(dirname "$(readlink -f "$0")")
|
DIR=$(dirname "$(readlink -f "$0")")
|
||||||
. "$DIR/../env.sh"
|
. "$DIR/../env.sh"
|
||||||
|
|
||||||
log 'Setting up system utilities X11 ibus keyring dunst clipboard screenshot thunar network bluetooth'
|
log 'Setting up system utilities X11 ime keyring clipboard screenshot filemanager network bluetooth'
|
||||||
|
|
||||||
case "$PM" in
|
case "$UNAMEA" in
|
||||||
apt)
|
*Ubuntu*)
|
||||||
sudo apt install -y \
|
sudo apt install -y \
|
||||||
xorg libx11-dev libxft-dev libxinerama-dev libxcursor-dev \
|
xorg libx11-dev libxft-dev libxinerama-dev libxcursor-dev \
|
||||||
libxrandr-dev arandr autorandr \
|
libxrandr-dev arandr autorandr \
|
||||||
|
@ -24,6 +24,10 @@ case "$PM" in
|
||||||
libnotify-bin \
|
libnotify-bin \
|
||||||
flameshot scrot \
|
flameshot scrot \
|
||||||
thunar gvfs-bin gvfs-backends thunar-archive-plugin file-roller tumbler
|
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
|
# bluetooth
|
||||||
if has_bluetooth; then
|
if has_bluetooth; then
|
||||||
sudo apt install \
|
sudo apt install \
|
||||||
|
@ -31,88 +35,65 @@ case "$PM" in
|
||||||
sudo systemctl enable bluetooth
|
sudo systemctl enable bluetooth
|
||||||
sudo systemctl start bluetooth
|
sudo systemctl start bluetooth
|
||||||
fi
|
fi
|
||||||
# laptop utitlies
|
# laptop
|
||||||
if is_laptop; then
|
if is_laptop; then
|
||||||
sudo apt install \
|
sudo apt install \
|
||||||
acpilght tlp
|
acpilght tlp
|
||||||
|
sudo systemctl enable autorandr
|
||||||
|
sudo systemctl start autorandr
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
pacman)
|
*artix*)
|
||||||
# for setting up default programs: exo-preferred-applications
|
|
||||||
sudo pacman -S --noconfirm --needed \
|
sudo pacman -S --noconfirm --needed \
|
||||||
xorg-server xorg-xinit xorg-xrandr xorg-xev xorg-xprop \
|
xorg-server xorg-xinit xorg-xrandr xorg-xprop xorg-xev xdotool \
|
||||||
arandr autorandr \
|
pipewire pipewire-pulse pipewire-jack pavucontrol \
|
||||||
alsa-firmware alsa-utils alsa-plugins pulseaudio-alsa pipewire-pulse pavucontrol \
|
arandr \
|
||||||
ibus ibus-table ibus-table-chinese \
|
xclip xsel \
|
||||||
gnome-keyring \
|
clang \
|
||||||
xss-lock \
|
ibus ibus-rime rime-wubi \
|
||||||
nitrogen \
|
|
||||||
networkmanager network-manager-applet \
|
networkmanager network-manager-applet \
|
||||||
exfat-utils \
|
exfat-utils \
|
||||||
exo \
|
|
||||||
dunst \
|
|
||||||
xclip xsel xdotool \
|
|
||||||
gnome-keyring libsecret \
|
gnome-keyring libsecret \
|
||||||
flameshot scrot \
|
|
||||||
thunar gvfs-smb gvfs-mtp thunar-archive-plugin file-roller tumbler \
|
thunar gvfs-smb gvfs-mtp thunar-archive-plugin file-roller tumbler \
|
||||||
clang
|
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
|
# bluetooth
|
||||||
if has_bluetooth; then
|
if has_bluetooth; then
|
||||||
sudo pacman -S --noconfirm --needed \
|
sudo pacman -S --noconfirm --needed \
|
||||||
bluez bluez-utils blueman
|
bluez bluez-utils blueman
|
||||||
sudo systemctl enable bluetooth
|
|
||||||
sudo systemctl start bluetooth
|
|
||||||
# bluetoothctl devices
|
# bluetoothctl devices
|
||||||
# bluetoothctl pair <ADDR>
|
# bluetoothctl pair <ADDR>
|
||||||
# bluetoothctl trust <ADDR>
|
# bluetoothctl trust <ADDR>
|
||||||
# bluetoothctl connect <ADDR>
|
# bluetoothctl connect <ADDR>
|
||||||
|
sudo ln -sf /etc/runit/sv/bluetoothd /run/runit/service/
|
||||||
fi
|
fi
|
||||||
|
# laptop
|
||||||
if is_laptop; then
|
if is_laptop; then
|
||||||
sudo pacman -S --noconfirm --needed \
|
sudo pacman -S --noconfirm --needed \
|
||||||
acpilght tlp
|
acpi light python-pip
|
||||||
|
yay -S auto-cpufreq-git
|
||||||
|
sudo mkdir -p /etc/runit/sv/auto-cpufreq
|
||||||
|
sudo cp ./auto-cpufreq/auto-cpufreq-runit /etc/runit/sv/auto-cpufreq/run
|
||||||
|
sudo chmod +x /etc/runit/sv/auto-cpufreq/run
|
||||||
|
sudo ln -s /etc/runit/sv/auto-cpufreq/ /run/runit/service/
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
xbps)
|
|
||||||
sudo xbps-install -y xorg dbus gnome-keyring libgnome-keyring \
|
|
||||||
nitrogen xsel xdotool xclip flameshot clang pkg-config chrony \
|
|
||||||
Thunar gvfs-smb gvfs-mtp thunar-archive-plugin file-roller tumbler \
|
|
||||||
pipewire pipewire-pulse alsa-pipewire alsa-utils pulseaudio-utils pavucontrol libpulseaudio \
|
|
||||||
ibus ibus-rime \
|
|
||||||
base-devel libX11-devel libXft-devel libXinerama-devel \
|
|
||||||
socklog-void
|
|
||||||
# config alsa
|
|
||||||
sudo mkdir -p /etc/alsa/conf.d
|
|
||||||
sudo ln -s /usr/share/alsa/alsa.conf.d/50-pipewire.conf /etc/alsa/conf.d
|
|
||||||
sudo ln -s /usr/share/alsa/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d
|
|
||||||
# enable ntp
|
|
||||||
sudo ln -sf /etc/sv/chronyd /var/service/
|
|
||||||
# enable logging
|
|
||||||
sudo ln -sf /etc/sv/socklog-unix /var/service/
|
|
||||||
sudo ln -sf /etc/sv/nanoklogd /var/service/
|
|
||||||
echo "Wubi"
|
|
||||||
echo "download rime-data-wubi from http://mirrors.163.com/ubuntu/pool/universe/r/rime-wubi/rime-data-wubi_0.0~git20200908.f1876f0-3_amd64.deb"
|
|
||||||
echo " ar x rime-data-wubi_0.0~git20200908.f1876f0-3_amd64.deb"
|
|
||||||
echo " unzstd data.zst"
|
|
||||||
echo " cd /"
|
|
||||||
echo " sudo tar xvf /home/klesh/Downloads/rime-data-wubi/data.tar"
|
|
||||||
echo " sudo vim /usr/share/rime-data/default.yaml"
|
|
||||||
echo "add wub86 to schema"
|
|
||||||
echo "restart ibus"
|
|
||||||
echo "add rime , done"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
# configuration
|
||||||
lnsf "$DIR/thunar/uca.xml" "$XDG_CONFIG_HOME/Thunar/uca.xml"
|
lnsf "$DIR/thunar/uca.xml" "$XDG_CONFIG_HOME/Thunar/uca.xml"
|
||||||
|
lnsf "$DIR/alacritty/alacritty.yml" "$XDG_CONFIG_HOME/alacritty/alacritty.yml"
|
||||||
|
|
||||||
# start network
|
if is_laptop; then
|
||||||
if has_cmd systemctl; then
|
|
||||||
sudo systemctl enable NetworkManagerXF86AudioRaiseVolume
|
|
||||||
sudo systemctl start NetworkManager
|
|
||||||
sudo systemctl enable autorandr
|
|
||||||
sudo systemctl start autorandr
|
|
||||||
|
|
||||||
lnsf "$DIR/dunst/dunstrc" "$XDG_CONFIG_HOME/dunst/dunstrc"
|
|
||||||
|
|
||||||
echo for non-root user to change backlight, add following rule to /etc/udev/rules.d/backlight.rules
|
echo for non-root user to change backlight, add following rule to /etc/udev/rules.d/backlight.rules
|
||||||
echo ```
|
echo ```
|
||||||
echo ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="acpi_video0", GROUP="video", MODE="0664"
|
echo ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="acpi_video0", GROUP="video", MODE="0664"
|
||||||
|
@ -122,7 +103,4 @@ if has_cmd systemctl; then
|
||||||
echo RUN+="/bin/chgrp video /sys/class/backlight/intel_backlight/brightness"
|
echo RUN+="/bin/chgrp video /sys/class/backlight/intel_backlight/brightness"
|
||||||
echo RUN+="/bin/chmod g+w /sys/class/backlight/intel_backlight/brightness"
|
echo RUN+="/bin/chmod g+w /sys/class/backlight/intel_backlight/brightness"
|
||||||
echo ```
|
echo ```
|
||||||
|
|
||||||
echo for amd ryzen laptop add "acpi_backlight=vendor" to /etc/default/grub and then run
|
|
||||||
echo sudo grub-mkconfig -o /boot/grub/grub.cfg
|
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user