Linux on Razer Blade Stealth 13

Display brightness

Make sure you are using Linux 5.13 as display brightness adjustment won't work on older kernels.

The easiest way to get it is to install Ubuntu 21.10 https://ubuntu.com/download/desktop

Sleep mode

  • Slowly blinking green light and no other response after wake up?
    The led flashes slow green when the laptop is powered on and the lid is closed.
  • Sleep mode drains battery very fast?
    This is because default mode is "s2idle" aka "freeze" (S0 ACPI Suspend-To-Idle state).

To fix both issues run the following commands as root:

echo open > /sys/module/button/parameters/lid_init_state
echo deep > /sys/power/mem_sleep

To make these changes permanent, modify your /etc/default/grub file to have the following line and run sudo update-grub after that:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash button.lid_init_state=open mem_sleep_default=deep"

"deep" sleep mode is the S3 ACPI Suspend-to-RAM state.

If you want the S4 ACPI Suspend-to-disk (Hibernation) state to work, you will need to set up a fixed key for your encrypted swap.
https://help.ubuntu.com/community/EnableHibernateWithEncryptedSwap

Suspend on lid close

Settings -> Power -> Automatic Suspend (When on battery power) -- must be set! Otherwise closing the lid won't suspend the laptop.

Webcam

Reload the uvcvideo kernel module with the "quirks=512" argument:

sudo modprobe -r uvcvideo
sudo modprobe uvcvideo quirks=512

Add the following to /etc/modprobe.d/razer.conf file to make this permanent:

options uvcvideo quirks=512

Nvidia GPU

sudo apt -y install nvidia-driver-470

By default you will have your dGPU "on-demand", you can query it:

sudo prime-select query

To use your dGPU, you need to run your app using the following arguments, running glmark2 in the following example:

 __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia glmark2

while glmark2 is running, you can use nvidia-smi command to confirm the app is indeed using dGPU.

Or, you can switch to dGPU only, sudo prime-select nvidia and reboot.

Powering off your dGPU

Switch to iGPU (Iris Xe Graphics) only, sudo prime-select intel and reboot.

You can try to entirely power off dGPU to save more battery power, https://github.com/mkottman/acpi_call.git
https://wiki.archlinux.org/title/hybrid_graphics#Turning_off_the_GPU_automatically

I haven't tried that yet, please report if this worked you :-)
You can probably check if you still see your card using lspci.

Text scaling

Instead of using display scaling or fractional scaling, you can adjust text size directly:

gsettings set org.gnome.desktop.interface text-scaling-factor 1.3

References