MacbookPro-ArchLinux/readme.md

5.1 KiB

Installing Arch on a 2015 Retina MacBook Pro

Disk formatting

/dev/sda

  • /dev/sda1 - EFI Partition

  • /dev/sda2 - dmcrypt encrypted partition

    BTRFS filesystem with:

    • @root -> /

    • @home -> /home

    • @snapshots -> /.snapshots

    • @swap -> /swap

      for swapfile /swap/swapfile ensure only root can access swapfile

      chmod 600 /swa/swapfile

      create swapfile that is bigger than my ram for hibernate-to-disk

      dd if=/dev/zero of=/swapfile bs=1M count=8196 status=progress

    • @tmp -> /var/tmp

    • @log -> /var/log

Configuration

I use sway as my window manager, this time I decided to try a display manager aswell which I usually dont bother with and just type sway after login, and went for lemurs, a lightweight TUI dm written in Rust.

In my sway configuration file I changed the keyboard layout and options to be able to use the Command keys as Control keys just like in macOS:

# ~/.config/sway/config

input * {
    xkb_layout "de"
	xkb_variant "mac"
    xkb_options "caps:escape, altwin:ctrl_win"
	repeat_rate 25
	repeat_delay 250
}

And enabled natural scrolling, tapping for left clicking and 2-finger tapping for right clicking on the touchpad like so:

# ~/.config/sway/config

input * {
	natural_scroll enabled
	scroll_factor 0.5
	pointer_accel 0
	tap enabled
	tap_button_map lrm
}

Usually I use dmenu for starting applications or running quick commands, but since I have my own build of dmenu with a handful of patches and commandline options which I didn't have access to from my laptop, I chose to instead install a fork of rofi with wayland support.

Coming from macOS, what I missed most right away were touchpad gestures for switching workspaces, scrolling, selecting and dragging. Thankfully touchpad drivers on other operating systems have come a long way and it is possible to get almost all of these gestures on linux aswell thru libinput and libinput-gestures.

# /etc/libinput-gestures.conf

gesture swipe left 	4 swaymsg workspace next
gesture swipe right 4 swaymsg workspace prev
gesture swipe down 	4 swaylock-wrapper
gesture pinch in 	4 rofi-wrapper

I use these options in my /etc/libinput-gestures.conf to switch between adjacent workspaces with 4-finger swipes, lock my screen by swiping down with 4 fingers, and opening rofi (through my own wrapper in ~/.local/bin/) with a 4-finger pinch.

I also use the swaylock-effecs fork of swaylock, though I just use the image option without any effects because of how long it takes to compute the gaussean blur.

I then configured logind to ignore accidental short pressed to the power button, which happens frequently enough for the default (shutting down) to become annoying, and suspend when the lid is closed:

# /etc/systemd/logind.conf

[Login]
HandlePowerKey=ignore
HandlePowerKeyLongPress=poweroff

HandleLidSwitch=suspend
HandleLidSwitchExternalPower=suspend

Since I dont use a common display manager which automatically runs XDG autorun .desktop entries, I start libinput-gestures in my sway config:

# ~/.config/sway/config

exec_always libinput-gestures-setup restart

Then I installed macbook-lighter and followed the instructions in the README to be able to control the display backlight and keyboard leds with the function row keys:

# ~/.config/sway/config

bindsym XF86MonBrightnessUp exec "macbook-lighter-screen --inc 100"
bindsym XF86MonBrightnessDown exec "macbook-lighter-screen --dec 100"

bindsym XF86KbdBrightnessUp exec "macbook-lighter-kbd --inc 25"
bindsym XF86KbdBrightnessDown exec "macbook-lighter-kbd --dec 25"

I also added keybinds here to control the volume and mpd with their respective keys on the function row:

# ~/.config/sway/config

bindsym XF86AudioPrev exec "mpc prev"
bindsym XF86AudioNext exec "mpc next"
bindsym XF86AudioPlay exec "mpc toggle"

bindsym XF86AudioMute exec "pactl -- set-sink-mute $(pactl get-default-sink) toggle"
bindsym XF86AudioLowerVolume exec "pactl -- set-sink-volume $(pactl get-default-sink) -10%"
bindsym XF86AudioRaiseVolume exec "pactl -- set-sink-volume $(pactl get-default-sink) +10%"

I also installed and start dunst for desktop notifications, and gammastep to replace nightshift to make the display warmer at night:

# ~/.config/sway/config

exec_always gammastep -l lat:lon -t 6500k:4000k
exec dunst

For convenience I installed cmst to manage my wireless network connections and a polkit agent to be able to systemctl suspend or reboot without having to authenticate myself or use sudo:

# ~/.config/sway/config

exec polkit-dumb-agent
exec cmst -m

To conveniently manage my VPN (I use NordVPN), I wrote and use nordvpn-rofi.sh, a rofi-script.