Skip to content

Instantly share code, notes, and snippets.

@amcolash
Last active March 21, 2023 13:20
Show Gist options
  • Save amcolash/e74e6a60ad7a3beb27ca38997361e5a8 to your computer and use it in GitHub Desktop.
Save amcolash/e74e6a60ad7a3beb27ca38997361e5a8 to your computer and use it in GitHub Desktop.
Notes on how I set up my Tuxedo Infinity Book S 14 v5
#!/bin/bash
ICON_ON="/usr/share/icons/Papirus-Dark/22x22/panel/caffeine-cup-full.svg"
ICON_OFF="/usr/share/icons/Papirus-Dark/22x22/panel/caffeine-cup-empty.svg"
CLICK="xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -T"
STATUS=`xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode`
if [[ $STATUS == "true" ]]; then
echo "<img>${ICON_ON}</img>"
else
echo "<img>${ICON_OFF}</img>"
fi
echo "<tool>Caffeine: $STATUS</tool>"
echo "<click>${CLICK}</click>"
#!/bin/bash
# Based off of a script from https://forum.salixos.org/viewtopic.php?t=8045#p45756
# set to:
# 5 for CapsLock
# 9 for NumLock
# 13 for ScrollLock
FIELD=5
ICON_ON="/usr/share/icons/Papirus-Dark/22x22/panel/caps-lock-on.svg"
ICON_OFF="/usr/share/icons/Papirus-Dark/22x22/panel/caps-lock-off.svg"
CLICK="xdotool key Caps_Lock"
STATUS=`xset q | grep Caps | tr -s ' ' | cut -d ' ' -f $FIELD`
if [[ $STATUS == "on" ]]; then
echo "<img>${ICON_ON}</img>"
else
echo "<img>${ICON_OFF}</img>"
fi
echo "<tool>CapsLock: $STATUS</tool>"
echo "<click>${CLICK}</click>"
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT="saved"
# Make the boot fast w/o showing grub
GRUB_TIMEOUT_STYLE="hidden"
GRUB_TIMEOUT="2"
# Forced distro name instead of using lsb release which just says Ubuntu
# GRUB_DISTRIBUTOR="Xubuntu 20.04"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
# Enable deep sleep (suspend to ram) and hibernation
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi= acpi_os_name=Linux acpi_backlight=vendor mem_sleep_default=deep resume=UUID=8ebc5858-21e7-4520-a120-785fa5b1a774"
# Quieter boot
GRUB_CMDLINE_LINUX="console=ttyS0 loglevel=3"
# Immediately resume when hibernated
GRUB_RECORDFAIL_TIMEOUT="1"
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL="console"
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE="640x480"
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID="true"
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
#!/bin/sh
set -e
# Copied useful bits from /etc/grub.d/05_debian-theme
# Set a monochromatic theme for Tanglu/Ubuntu.
echo "${1}set menu_color_normal=white/black"
echo "${1}set menu_color_highlight=black/light-gray"
if [ -e /usr/share/plymouth/themes/default.grub ]; then
sed "s/^/${1}/" /usr/share/plymouth/themes/default.grub
fi
#!/bin/bash
# Based off of a script from https://forum.salixos.org/viewtopic.php?t=8045#p45756
# set to:
# 5 for CapsLock
# 9 for NumLock
# 13 for ScrollLock
FIELD=9
ICON_ON="/usr/share/icons/Papirus-Dark/22x22/panel/num-lock-on.svg"
ICON_OFF="/usr/share/icons/Papirus-Dark/22x22/panel/num-lock-off.svg"
CLICK="xdotool key Num_Lock"
STATUS=`xset q | grep Num | tr -s ' ' | cut -d ' ' -f $FIELD`
if [[ $STATUS == "on" ]]; then
echo "<img>${ICON_ON}</img>"
else
echo "<img>${ICON_OFF}</img>"
fi
echo "<tool>NumLock: $STATUS</tool>"
echo "<click>${CLICK}</click>"

Setting Up Tuxedo InfinityBook S 14 v5

Add Tuxedo Repo + Install Tuxedo Drivers/Utils

All of the Tuxedo stuff seems to be optional and this laptop has fantasic support out of the box w/ Xubuntu.

To add the repos, make a source list for the tuxedo repos sudo vim /etc/apt/sources.list.d/tuxedo-computers.list

Add the following (for now, until updated)

deb http://deb.tuxedocomputers.com/ubuntu focal main
# deb http://intel.tuxedocomputers.com/ubuntu focal main
deb http://graphics.tuxedocomputers.com/ubuntu focal main
# deb http://kernel.tuxedocomputers.com/ubuntu focal main

Add the repo key curl -s https://raw.githubusercontent.com/tuxedocomputers/tuxedo.sh/master/keys/ubuntu.pub | sudo apt-key add -

Note: not sure if I actually need tuxedo-keyboard-dkms, tuxedo-control-center is nice to have but not necessary. It allows changing fan/cpu speeds. sudo apt install tuxedo-control-center

Install my Meta Packages

This is definitely one of the most important things to do as it makes life much easier going forward and installs a lot of utils/repos right away.

sudo apt install git
git clone git@github.com:amcolash/ubuntu-meta-packages.git
cd ubuntu-meta-packages
./install.sh

GRUB

There are a lot of tweaks to make GRUB work better for my needs. Here is a list of all of them. See my custom grub file below as well.

Suspend / Sleep

Power management + sleep states seem to be a bit off with this device out of the box. I found that I was able to fix suspend and actually use deep sleep (s3) with the following from: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1808957

  • Edit /etc/default/grub and add mem_sleep_default=deep to the default, i.e.: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash mem_sleep_default=deep"

  • Run sudo update-grub

  • [XFCE] To save backlight brightness across sleep + hybernate, use this script to save/restore on resume: https://askubuntu.com/a/805434/397460

Quick Boot + Silent GRUB

  • Use the scripts from: https://gist.github.com/LeahCim/9332432 (so that the TIMEOUT and TIMEOUT_STYLE are saved)
  • Make sure to chmod +x them so that they actually are run.
  • Edit /etc/default/grub
    • Edit GRUB_CMDLINE_LINUX to include console=ttyS0 loglevel=3 to hide fsck stuff on boot (so it looks like GRUB_CMDLINE_LINUX="console=ttyS0")
    • Change TIMEOUT to 2 second
    • For immediate resume from hibernate, change GRUB_RECORDFAIL_TIMEOUT to 0. (see here)[To fix grub timeout: https://ubuntuforums.org/showthread.php?t=2333934]
  • Run sudo update-grub

Optional Extras

Howdy

I have had issues getting howdy (face unlock) to reliably work in various distros / lock screens. Here are some links to check. boltgolt/howdy#121 boltgolt/howdy#408

Steps for linux mint:

sudo chmod a+x /lib/security/howdy/recorders
sudo apt install python3-opencv
sudo howdy config --> no_confirmation = true

[IGNORE] (This doesn't seem to actually matter) Intel Wi-Fi 6 AX 200 Driver

It looks like Xubuntu works with this wifi device out of the box, but I am not sure if I am getting the full potential of it. Just in case, I grabbed the driver from Intel here.

wget https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi/iwlwifi-cc-46.3cfab8da.0.tgz
tar -xvf iwlwifi-cc-46.3cfab8da.0.tgz
sudo cp iwlwifi-cc-46.3cfab8da.0/* /lib/firmware

Base XFCE Setup

Fixing the GRUB Theme

Since we change the GRUB_DISTRIBUTOR value from Ubuntu to Xubuntu, we need to fix the default theme as well. Just add the 50_simple-theme file to /etc/grub.d/ and make it executable. This is just a copy of useful bits of the original /etc/grub.d/05_debian-theme.

Fix initramfs Stuff on Boot

Follow the directions here: https://forums.linuxmint.com/viewtopic.php?p=1836169&sid=40023f0781a2902d9939e4826269a4cc#p1836169

Fix Keyboard AltGr (Re-map it to a normal Alt)

Make a file /etc/X11/Xsession.d/80_xmodmap for execution on login

#!/bin/sh
# Set custom keycodes
#
# This file is sourced by Xsession(5), not executed.
# The "|| true" is to ensure that the Xsession script does not terminate on error

USRMODMAP="$HOME/.Xmodmap"

if [ -x /usr/bin/xmodmap ]; then
  if [ -f "$USRMODMAP" ]; then
    /usr/bin/xmodmap "$USRMODMAP" || true
  fi
fi

Make $HOME/.Xmodmap

clear mod5
keycode 108 = Alt_L

Keyboard Layout

  • Settings -> Keyboard -> Layout
  • Uncheck System Defaults
  • Use "English (US) -> English (intl, with AltGr dead keys)"

Fix "Natural Scrolling"

  • Enable the option in mouse section of xfce, set accel to 4.8
  • Remove synaptic driver: sudo apt remove xserver-xorg-input-synaptics

Better Workspace Switcher Color w/ Arc Dark Theme

echo "wnck-pager:selected { background-color: #5494E2; }" >> $HOME/.config/gtk-3.0/gtk.css
echo "wnck-pager:hover { background-color: #64A4F2; }" >> $HOME/.config/gtk-3.0/gtk.css`

Fix Screen Tear w/ Compton

There is some really bad screen tearing in XFCE since it doesn't use an HW compositor. Let's use that GPU!

  • Disable XFCE WM (or via gui in wm tweaks): xfconf-query -c xfwm4 -p /general/use_compositing -s false
  • Make sure compton is installed (part of my meta packages, but otherwise): sudo apt install compton
  • Add compton to startup, easiest way is to add a startup item which executes compton

Disable Screensaver

I decided to disable the screensaver as I don't use one and would rather just blank the screen anyways. The screensave seems to show the desktop for a moment before going back to the lock screen so this helps that as well.

  • Open Screensaver Settings
  • Disable screensaver
  • On lock screen tab, uncheck "lock screen with screensaver"

Hibernation

The new route to try (make sure to add resume UUID into grub config): https://itectec.com/ubuntu/ubuntu-how-to-go-automatically-from-suspend-into-hibernate/ and make sure to update other relevant suspend spots: https://forums.linuxmint.com/viewtopic.php?t=287015

To turn on hibernation: https://askubuntu.com/a/1032166/397460

To auto hibernate from sleep: http://www.futurile.net/2016/12/10/delayed-hibernation-xenial-xerus/

To re-enable hibernation in xfce menus: https://askubuntu.com/a/94963/397460

Numlock/Caps Lock

The infinitybook does not have lights for indicating caps lock (very annoying) and num lock (midly annoying). Due to this, I needed to have a simple solution for XFCE as an indicator and also toggle button. Things I found were not very reliable or only partially worked for my use case. I opted in the end to use the genmon panel plugin to do this. Attached below are the caps + num lock scripts which require xdotool as well as the papirus icon set, but are easily modified to other icons if needed.

Only bit of setup is placing the scripts somewhere (in my case ~/.local/bin/) and then turning the update value to 0.25 seconds so it is nice and quick to toggle the icon back and forth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment