One Mix One Netbook
#!/bin/sh
#echo 1 | sudo tee /sys/class/graphics/fbcon/rotate_all
# 0 - Normal rotation
# 1 - Rotate clockwise
# 2 - Rotate upside down
# 3 - Rotate counter-clockwise
#
#https://github.com/plbossart/UCM/iss...ment-383365511
# RUN: monitor-sensor to see directions
# No Idea, . . . Rotate right?
# SENSOR_MAT="0, 1, 0; 1, 0, 0; 0, 0, 1"
SENSOR_MAT="0, 1, 0; -1, 0, 1; 0, 0, 1"
#----------------------------------------------------------------------
# DO_INSTALL
#----------------------------------------------------------------------
do_install() {
sudo apt -y install firmware-intel-sound alsa-firmware-loaders firmware-linux-nonfree
sudo apt -y install firmware-iwlwifi firmware-realtek fonts-terminus fonts-terminus-otb xfonts-terminus xfonts-terminus-dos xfonts-terminus-oblique
sudo cp ./TS-disable ./FIX /usr/local/bin
sudo chmod 0775 /usr/local/bin/TS-disable /usr/local/bin/FIX
sudo ln /usr/local/bin/TS-disable /usr/local/bin/TS-enable
sudo apt-get -y install xbindkeys xdotool
cat - > ~/.xbindkeysrc <<EOF_XBINDKEYS
"xdotool click 2"
Control + b:3 + Release
EOF_XBINDKEYS
cat - > ~/.xsessionrc <<EOF_XSESSIONRC
/usr/local/bin/FIX
xbindkeys
EOF_XSESSIONRC
}
#----------------------------------------------------------------------
# FIX_GRUB
#----------------------------------------------------------------------
fix_grub() {
grub_parms=
grub_parms="net.ifnames=0 mitigations=off video=efifb fbcon=rotate:3"
cat /etc/default/grub | awk \
-v grub_parms="$grub_parms" \
'
/^GRUB_CMDLINE_LINUX=/ {
printf "GRUB_CMDLINE_LINUX=\"%s\"\n",grub_parms
next
}
{
print $0
}
' > /etc/default/grub.new
mv /etc/default/grub /etc/default/grub.old
mv /etc/default/grub.new /etc/default/grub
}
#----------------------------------------------------------------------
# FIX_CONSOLE_FONT
#----------------------------------------------------------------------
fix_console_font() {
cat /etc/default/console-setup | awk '
/^FONTFACE/ {
next
}
/^FONTSIZE/ {
next
}
END {
printf "FONTFACE=\"Terminus\"\n"
printf "FONTSIZE=\"12x24\"\n"
}
' > /etc/default/console-setup.new # '
mv /etc/default/console-setup /etc/default/console-setup.old
mv /etc/default/console-setup.new /etc/default/console-setup
}
#----------------------------------------------------------------------
# FIX_ROTATE_SENSOR
#----------------------------------------------------------------------
fix_rotate_sensor() {
cat - <<FIX_ROTATE_END > /lib/udev/hwdb.d/61-sensor-local.hwdb
sensor:modalias:acpi:BOSC0200*:dmi*
ACCEL_MOUNT_MATRIX=0, 1, 0; 1, 0, 0; 0, 0, 1
FIX_ROTATE_END
systemd-hwdb update
}
#----------------------------------------------------------------------
# FIX_SOUND
#----------------------------------------------------------------------
fix_sound() {
echo "blacklist snd_hdmi_lpe_audio" > /etc.modprobe.d/blacklist_hdmi.conf
}
#----------------------------------------------------------------------
# FIX_SDDM
#----------------------------------------------------------------------
fix_sddm() {
cat - <<EOF_FIX_SDDM > /etc/sddm.conf.d/onemix.conf
[X11]
DisplayCommand=/usr/share/sddm/scripts/Xsetup
EOF_FIX_SDDM
setup_script=/usr/share/sddm/scripts/Xsetup
grep xrandr $setup_script && return
echo "xrandr --output eDP-1 --rotate left" >> $setup_script
}
#----------------------------------------------------------------------
# MAIN
#----------------------------------------------------------------------
while [ $# -gt 0 ]
do
case "x$1" in
xall)
fix_rotate_sensor
fix_grub
fix_console_font
fix_sddm
;;
xsensor)
fix_rotate_sensor
;;
xgrub)
fix_grub
;;
xfont)
fix_console_font
;;
xsddm)
fix_sddm
;;
xinstall)
do_install
;;
esac
shift
done