My journey to get Alpine + Wayland + River to work on ThinkPad T14 G3 AMD
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
linux-on-desktop/README.md

222 lines
5.2 KiB

---
gitea: none
include_toc: true
---
2 years ago
# linux-on-desktop
My journey to get Alpine + Wayland + River to work on ThinkPad T14 G3 AMD
## Preparing hardware
Disable secure boot and fn-lock in bios (so that F-keys work as F-keys by default and require Fn for their secondary multimedia functions).
## Installing Alpine
Follow https://wiki.alpinelinux.org/wiki/Installation
Note that you will need to use Rufus; Ventoy does not work on this laptop (hangs after choosing the image).
## Installing River
In `/etc/apk/repositories`, uncomment TODO
```
doas apk update
doas apk add eudev
doas setup-udev
doas apk add mesa-dri-gallium mesa-va-gallium
doas apk add river river-doc mandoc
doas apk add adwaita-icon-theme foot ttf-dejavu
doas rc-update add seatd
doas rc-service seatd start
doas addgroup YOURUSER audio
doas addgroup YOURUSER input
doas addgroup YOURUSER seat
doas addgroup YOURUSER video
doas addgroup YOURUSER wheel
install -Dm0755 /usr/share/doc/river/examples/init -t ~/.config/river
```
Also:
```
doas apk add xwayland
```
because the latest river in testing is built in a way that requires xwayland.
Try to run with
```
XDG_RUNTIME_DIR=/tmp river
```
You should see the blue screen of river. Try to open terminal with Win+Shift+Enter. Try to exit with Win+Shift+E.
### Login manager
To enter username/password in GUI, get to river after that, and get back to logon screen after exiting river:
```
doas apk add elogind polkit-elogind
doas rc-update add elogind
doas rc-service elogind start
doas apk add greetd greetd-gtkgreet cage
doasaddgroup greetd video
doas rc-update add greetd
```
change `/etc/greetd/config.toml`
```
command = "cage -s -- gtkgreet"
```
and create `/etc/greetd/environments` with a single line `river`
and reboot.
I didn't find a way to make cage+gtkgreet handle HiDPI, the text is very tiny.
An alternative is agreety, but for some reason it seems that both greeter and standard linux login prompt
run at the same time on the same terminal, making it impossible to actually login.
### Installing Waybar
```
doas apk add waybar
```
and add startup section at the end of river init file (`~/.config/river/init`):
```
# startup
riverctl spawn "waybar"
```
### HiDPI
```
doas apk add kanshi
mkdir .config/kanshi
```
and create `.config/kanshi/config` with the following:
```
profile {
output eDP-1 enable scale 2.5
}
```
(`eDP-1` identifier was obtained by installing sway, running sway (by adding it to `/etc/greetd/environments`,
and in terminal inside sway executing `swaymsg -t get_outputs`).
#### HiDPI - cursors
And in order to have decently sized mouse cursors instead of the tiniest ones, add the following line to the top of `.config/river/init`:
```
riverctl xcursor-theme Adwaita 24
```
This will only affect river itself, the cursor will stay tiny in waybar and firefox and maybe other applications. To solve this:
```
doas apk add gsettings-desktop-schemas
gsettings set org.gnome.desktop.interface cursor-theme 'Adwaita'
```
### Environment
In order to not have to create wrapper scripts for all apps:
Create `/usr/local/bin/inga-river` (and later `chmod +x /usr/local/bin/inga-river`) with the following (found in google):
```
#!/bin/sh
export GDK_BACKEND=wayland,x11
export MOZ_ENABLE_WAYLAND=1
export CLUTTER_BACKEND=wayland
export QT_QPA_PLATFORM=wayland-egl
export ECORE_EVAS_ENGINE=wayland-egl
export ELM_ENGINE=wayland_egl
export SDL_VIDEODRIVER=wayland
export _JAVA_AWT_WM_NONREPARENTING=1
export NO_AT_BRIDGE=1
export BEMENU_BACKEND=wayland
river $@
```
and replace `river` with `inga-river` in `/etc/greetd/environments`.
2 years ago
### Launcher
`doas apk add bemenu`, and then add this line into your river config:
```
riverctl map normal Super R spawn 'bemenu-run -i -n'
```
## Other software
### Clipboard?
### Firefox
```
doas apk add firefox
firefox
```
go to `about:support` and make sure that Window Protocol is wayland, not xwayland.
(it should be wayland because MOZ_ENABLE_WAYLAND is set to 1 by inga-river)
## Hardware
### Sleep
Laptop goes to sleep after some idle period. When it wakes up, the root fs is readonly, meaning that I have to restart the laptop.
### WiFi
At the moment Linux kernel does not support TODO Qualcomm WiFi module installed in this laptop.
Otherwise, alpine wiki describes how to configure WiFi using `iwd`.
### Backlight
```
doas apk add light
doas nano /etc/udev/rules.d/backlight.rules
```
add the following lines into backlight.rules to make it possible for all users in video group (not just superusers) to control backlight:
```
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="amdgpu_bl0", RUN+="/bin/chgrp video /sys/class/backlight/%k/brightness"
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="amdgpu_bl0", RUN+="/bin/chmod g+w /sys/class/backlight/%k/brightness"
```
and then
```
doas rc-service udev restart
```
Backlight control with Fn+F5/F6 should work now.
(`amdgpu_bl0` is specific for this laptop; value for others can be obtained from `/sys/class/backlight/`)
### Trackpoint
```
find /sys/devices/platform/i8042/ -name name | xargs grep -Fl TrackPoint
```
to find which serio corresponds to trackpoint, then
```
echo 70 | doas tee /sys/devices/platform/i8042/serio1/sensitivity
```
for reasonably low sensitivity (does not persist).
TODO
### Sound
```
doas apk add pamixer
```
TODO