Release_Tracking/bpo4/615/acosail-bpo4-230920-fixup.sh
2023-10-12 14:05:23 +08:00

74 lines
2.1 KiB
Bash

#!/bin/bash
current_uid=$(id -u)
if [ "$current_uid" -eq 0 ]; then
echo "please run as a normal user"
exit 1
fi
tab=$'\t'
xorg_conf="/usr/local/etc/X11/xorg.conf"
if [ -e "$xorg_conf" ]; then
true
else
echo "file $xorg_conf not exist"
exit 1
fi
confline_DPMS="Option \"DPMS\" \"false\""
confline_1920_1080_60=$(gtf 1920 1080 60 | grep -v "^[[:space:]]*#\|^[[:space:]]*$" | sed "s/^[[:space:]]*//g")
conf_1920_1080_60=$(echo $confline_1920_1080_60 | awk '{print $2}')
confline_PREFM="Option \"PreferredMode\" ${conf_1920_1080_60}"
# sed -in "/Section \"Monitor\"/,/^EndSection/{/^[[:space:]]*Option[[:space:]]*\"DPMS/{s/true/false/}}" ${xorg_conf}
sed -in "/Section \"Monitor\"/,/^EndSection/{/^[[:space:]]*Option[[:space:]]*\"\(DPMS\|PreferredMode\)/{d}}" ${xorg_conf}
sed -in "/Section \"Monitor\"/,/^EndSection/{/^[[:space:]]*Modeline/{d}}" ${xorg_conf}
sed -in "/Section \"Monitor\"/a\\${tab}\\${confline_PREFM}" ${xorg_conf}
sed -in "/Section \"Monitor\"/a\\${tab}\\${confline_1920_1080_60}" ${xorg_conf}
sed -in "/Section \"Monitor\"/a\\${tab}\\${confline_DPMS}" ${xorg_conf}
fcitx5_config_dir="${HOME}/.config/fcitx5/conf"
if [ ! -d "$fcitx5_config_dir" ]; then
mkdir -p "$fcitx5_config_dir"
fi
cat <<EOF > ${HOME}/.config/fcitx5/conf/classicui.conf
# Vertical Candidate List
Vertical Candidate List=False
# Use Per Screen DPI
PerScreenDPI=False
# Use mouse wheel to go to prev or next page
WheelForPaging=True
# Font
Font="Sans 10"
# Menu Font
MenuFont="Sans 10"
# Use input method langauge to display text
UseInputMethodLangaugeToDisplayText=True
# Theme
Theme=default
EOF
kde_conf="${HOME}/.config/kwinrc"
if [ -e "$kde_conf" ]; then
true
else
echo "file $kde_conf not exist"
exit 1
fi
confline_Xrander="Backend=XRender"
sed -in "/\[Compositing\]/,/^$/{/^[[:space:]]*Backend=/{d}}" ${kde_conf}
sed -in "/\[Compositing\]/a\\${confline_Xrander}" ${kde_conf}
root_PATH=$(sudo env | grep "PATH")
sudo sed -in "/^[[:space:]]*export[[:space:]]*PATH=/d" /root/.bashrc
cat <<EOF | sudo tee -a /root/.bashrc >/dev/null
export ${root_PATH}
EOF
echo "all changes have been made, please reboot to take effect"