MacbookPro-ArchLinux/readme.md
2022-12-26 19:51:28 +01:00

129 lines
5.1 KiB
Markdown

# 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](https://wiki.archlinux.org/title/swap#Swap_file) /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](https://swaywm.org) 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](https://github.com/coastalwhite/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](https://wiki.archlinux.org/title/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](https://aur.archlinux.org/packages/rofi-lbonn-wayland).
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](https://github.com/bulletmark/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](https://github.com/mortie/swaylock-effects) 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](https://github.com/harttle/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](https://wiki.archlinux.org/title/Dunst) for desktop notifications, and [gammastep](https://gitlab.com/chinstrap/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`](https://nirgendwo.xyz/git/janis/dotfiles/src/branch/main/.local/bin/nordvpn-rofi.sh)