## General

See Roland Guelle’s excellent Razerblade HOWTO and the various xipherzero pages, the Ubuntu community Razer page.

## Keeps on sleeping after suspend

sudo bash
echo 'GRUB_CMDLINE_LINUX_DEFAULT="button.lid_init_state=open"' >>  /etc/default/grub
update-grub

### Keyboard lights

Install the dorky keyboard drivers and the dorky GUI, polychromatic.

sudo add-apt-repository ppa:openrazer/stable
sudo apt update
sudo apt install openrazer-meta
# sudo gpasswd -a plugdev user  ## no longer needed?

This is reasonably smooth, but you can get into various kernel-module difficulties. Also note that if you are running a custom user python (e.g. if you load up a virtualenv or anaconda python in your .bashrc) then this will not work, since openrazor inspects your path to find its python.

Anyway, after all that fussing, you now have a rainbow-coloured GUI to control your rainbow-coloured keyboard lights! Wheeeee!

### Is horizontal scrolling backwards for you?

It is for me. Per default, vertical scrolling is “natural” and horizontal is “traditional”. Cognitive dissonance.

xinput --list  # look for a "Synaptics" pointer
xinput --watch-props <id>

finds the erroneous thingy and

xinput --set-prop <id> "Synaptics Scrolling Distance" -94 -94

fixes it.

It turns out there is a special synaptics command synclient, which also does it. AFAICT this is deprecated and not as modern because it doesn’t use the modern libinput although they seem to coexist peacefully on my system so maybe I should not care about that until something breaks nastily. The archlinux backgrounder might make it clear if I were inclined to read it.

synclient VertScrollDelta=-94 HorizScrollDelta=-94

This needs to be run after laptop resume also which gets complicated. I needed to set up a script that will talk to X, in /home/me/bin/scrollrite.sh:

#!/bin/bash

#title          :scrollrite.sh
#notes          :Script gets called from /lib/systemd/system-sleep
#==========================================================================
sleep 5
declare -x DISPLAY=":0.0"
declare -x XAUTHORITY="/home/me/.Xauthority"

synclient VertScrollDelta=-94 HorizScrollDelta=-94

Then I need to invoke it…

## Running a user script upon waking

Let’s say we want to fix the trackpag every time the laptop wakes.

Answers about /usr/lib/pm-utils/sleep.d I believe are no longer current. I can supposedly create a system service or a resume hook in e.g./lib/systemd/system-sleep/fixthings.

Immediately before entering system suspend and/or hibernation systemd-suspend.service (and the other mentioned units, respectively) will run all executables in /usr/lib/systemd/system-sleep/ and pass two arguments to them. The first argument will be "pre", the second either "suspend", "hibernate", "hybrid-sleep", or "suspend-then-hibernate" depending on the chosen action. Immediately after leaving system suspend and/or hibernation the same executables are run, but the first argument is now "post". All executables in this directory are executed in parallel, and execution of the action is not continued until all executables have finished.

Note that scripts or binaries dropped in /usr/lib/systemd/system-sleep/ are intended for local use only and should be considered hacks. If applications want to react to system suspend/hibernation and resume, they should rather use the Inhibitor interface.

The latter looks simpler.

Here is the /lib/systemd/system-sleep/fixthings hook script.

#!/bin/sh

case $1/$2 in
pre/*)
echo "Going to $2..." # Place your pre suspend commands here, or exit 0 # if no pre suspend action required exit 0 ;; post/*) echo "Waking up from$2..."
# Place your post suspend (resume) commands here, or exit 0
# if no post suspend action required
/home/me/bin/scrollrite.sh
;;
esac

It must be rendered executable:

sudo chmod +x /lib/systemd/system-sleep/resume

UPDATE: This seemed to work for me but as of now, does not. Did I imagine it?

## Misc

See the Ubuntu compatibility page. Notably webcam is broken, and fan control is weird and sounds like a jet aircraft totally fine these days. The archlinux page has some suggestions for the webcam thing. Specifically, put

options uvcvideo quirks=512

in /etc/modprobe.d/uvcvideo.conf.

## My screen never powers off even when laptop is idle

Weird, mine too. But no longer. I fixed it using dpms

xset dpms 0 0 600