zkk / ArchLinux dual boot su Lenovo Yoga X390



Operazioni preliminari

Windows 11

Creazione chiavetta USB

Scarico il file iso di Arch nella edizione del 01/07/2026 e copio l’immagine sulla chiavetta USB (smontata dal filesystem):

sudo dd bs=4M if=/path/to/image.iso of=/dev/sdX status=progress oflag=sync

Installazione sistema base

Boot da USB

Imposta terminale

loadkeys it
setfont ter-132b

Imposta internet

iwctl
[iwd]# device list
[iwd]# station wlan0 scan
[iwd]# station wlan0 get-networks
[iwd]# station wlan0 connect SSID
[iwd]# exit
ping -c 4 8.8.8.8

Partizione disco

fdisk -l
cfdisk /dev/nvme0n1

Creare le seguenti parizioni (nvme0n1p1 è la partizione EFI già presente):

mkfs.ext4 /dev/nvme0n1p6
mkswap /dev/nvme0n1p5

Montaggio partizioni

mount /dev/nvme0n1p6 /mnt
mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot
swapon /dev/nvme0n1p5

Installazione

pacstrap -K /mnt base linux linux-firmware neovim networkmanager intel-ucode
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
pacman -Syu
pacman -S wirelwss_tools wpa_supplicant iwd dialog network-manager-applet
pacman -S sudo vim base-devel

Configurazione

ln -sf /usr/share/zoneinfo/Europe/Rome /etc/localtime
hwclock --systohc
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "KEYMAP=it" > /etc/vconsole.conf
echo "X390" > /etc/hostname
echo "127.0.1.1    X390.localdomain X390" >> /etc/hosts
systemctl enable NetworkManager
passwd
mkinitcpio -P
useradd -m -G wheel,video,audio -s /bin/bash max
passwd max
visudo
pacman -S grub efibootmgr os-prober
echo "GRUB_DISABLE_OS_PROBER=false" >> /etc/default/grub
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
exit
umount -R /mnt
reboot

Reboot

Finalizzare installazione

Entro come utente max.

nmcli device wifi connect "WIFI_NAME" password "WIFI_PASSWORD"
sudo pacman -S mesa xorg-xwayland terminus-font
sudo pacman -S sway swaybg swaylock swayidle waybar alacritty wofi libnotify
sudo pacman -S mako polkit-gnome grim slurp wl-clipboard brightnessctl
sudo pacman -S ttf-firacode-nerd ttf-mononoki-nerd ttf-jetbrains-mono-nerd
sudo pacman -S archlinux-wallpaper
sudo pacman -S btop git stow ruby lsd bat nfs-utils ripgrep fzf fd
sudo pacman -S ripgrep fzf fd pacman-contrib chromium less
sudo pacman -S lua-language-server marksman
sudo pacman -S vscode-css-languageserver vscode-html-languageserver
sudo pacman -S vscode-json-languageserver
sudo pacman -S zsh-completions zsh-autosuggestions
sudo pacman -S zsh-syntax-highlighting zsh-history-substring
sudo pacman -S pipewire pipewire-alsa pipewire-pulse alsa-utils
sudo pacman -S wireplumber sof-firmware pavucontrol
systemctl --user --now enable pipewire wireplumber pipewire-pulse

Set bigget font TTY/GRUB

TTY

sudo pacman -S terminus-font
sudo echo "FONT=ter-132n" >> /etc/vconsole.conf

GRUB

sudo grub-mkfont -s 28 -o /boot/grub/fonts/biggerfont.pf2 /usr/share/fonts/TTF/FiraCodeNerdFontMono-Regular.ttf

Aggiungo il seguente codice alla fine del file /etc/default/grub.

# Bigger font
GRUB_FONT="/boot/grub/fonts/biggerfont.pf2"

dotfiles

ssh-keygen

Copiare il contenuto della chiave all’interno del file:

Nel VPS max73.it per permettere di clonare il repo dei dotfiles.

mkdir dotfiles
cd dotfiles
git clone git@max73.it:dots-x390.git .

Yay

sudo pacman -Syu
sudo pacman -S --needed base-devel git
mkdir TEMP
cd TEMP
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
makepkg -si
yay --version

Sway system

cd ~/dotfiles
stow swaysystem
swaymsg exit

Configurazioni per:

Rotation

sudo pacman -S iio-sensor-proxy
sudo systemctl enable --now iio-sensor-proxy.server

Creato script sway-rotate.sh:

#!/bin/sh
# Target your specific internal display. Run 'swaymsg -t get_outputs' to verify name.
OUTPUT="eDP-1"

# Monitor the accelerometer and loop through orientation updates
monitor-sensor | while read -r line; do
    # Extract the orientation state string
    ORIENTATION=$(echo "$line" | grep -oE 'orientation changed: [a-z-]+' | cut -d' ' -f3)

    case "$ORIENTATION" in
        normal)
            swaymsg output "$OUTPUT" transform 0
            ;;
        bottom-up)
            swaymsg output "$OUTPUT" transform 180
            ;;
        left-up)
            swaymsg output "$OUTPUT" transform 270
            ;;
        right-up)
            swaymsg output "$OUTPUT" transform 90
            ;;
    esac

    # Map all touch and stylus inputs to match the active output transformation
    if [ ! -z "$ORIENTATION" ]; then
        swaymsg input "type:touch" map_to_output "$OUTPUT"
        swaymsg input "type:tablet_tool" map_to_output "$OUTPUT"
    fi
done

Inserito la seguente riga nel file di configurazione di Sway:

# exec rot8
exec_always ~/bin/sway-rotate.sh

Keyboard in Tablet

yay -S wvkbd

Creato script toggle-kbd.sh:

#!/bin/bash
# Check if wvkbd is already running
if pgrep -x "wvkbd-mobintl" > /dev/null; then
    # If running, kill it to hide it
    killall wvkbd-mobintl
else
    # If not running, start it in the background
    # -L 250 sets the keyboard height to 250 pixels (adjust as preferred)
    wvkbd-mobintl -L 250 &
fi

Inserito le seguenti righe nel file di configurazione di Sway:

# Toggle on-screen keyboard
bindsym $mod+Escape exec ~/bin/toggle-kbd.sh
# Ensure the virtual keyboard does not grab focus from text inputs
for_window [app_id="wvkbd"] focus_mode_never
# Prevent Sway from attempting to tile the keyboard layer
for_window [app_id="wvkbd"] floating enable

Special Keys

Aggiunge le seguenti righe al file di configurazione di Sway:

# Desktop Volume Controls via Scripts
bindsym XF86AudioRaiseVolume exec ~/bin/volume_control.sh up
bindsym XF86AudioLowerVolume exec ~/bin/volume_control.sh down
bindsym XF86AudioMute exec ~/bin/volume_control.sh mute
bindsym XF86AudioMicMute exec wpctl set-source-mute @DEFAULT_AUDIO_SOURCE@ toggle
# Screen Brightness Controls via Scripts
bindsym XF86MonBrightnessUp exec ~/bin/brightness_control.sh up
bindsym XF86MonBrightnessDown exec ~/bin/brightness_control.sh down

Zsh

cd ~/dotfiles
stow zsh
chsh -s $(which zsh)
reboot