Again with the Linux

So I just got a new laptop, specifically a Purism Librem 13 inch. I really wasn't happy with the direction Mac was continuing to go (planned obselecence and waste, framing lockin as "bravery," a decline in quality, and so on).

I don't understand how moving away from a mag-safe plug is advancement. Does it stop being a good thing to let the cord separate instead of throwing your machine down on the floor and tripping you worse?

Also, the key travel and trackpad both feel too small. I guess the "hard press" for the trackpad brings up the dictionary for some reason. I always press it, and it's a modal without focus that I never expect or want. It's very weird. Maybe some people like all of this stuff though. I don't know.

I don't want an iPad or a computer that aspires to be one. I get that a lot of people want an entertainment device and obscuring the "general purpose" nature of the machine promotes the UX that can be mutually beneficial. And I get that a lot of tools and making various things can work like that too. For me, the vibe has changed on macs, and with my older laptop acting increasingly tired, it's time to move on.

So given that a thing with a touch bar, no escape key, and lacking any ports except dongle recepticals was out, it was between a Windows or Linux machine (yes, I know about duel booting). And by the way, the port thing is not just cosmetic. I have several peripherals that rely on the old USB interface, and I'm very not into replacing them or buying 8 dollar dongles to lose.

I've had both, and the locked-in feeling is stronger for me with running Windows, so that's a no go. Next up, I needed to decide on the type of actual machine. I've done the live cd/USB thing, and I've distro-hopped a bit. There's a lot of variation that's interesting, but for the most part, I just need something fairly standard. So the esoteric Android-on-the-desktop, pen-testing, ultra-mega-paranoid, and entertainment center type distros weren't important.

My go to would have probably been an intel machine (maybe with arch or antegros) had I not decided to look into computers with Linux by default. A lot of them are a little old or don't have great build quality. I haven't looked at System 76 in a while, and I could have also ended up with the Galago Pro. With roughly the same specs, it would have been about the same as what I ended up with, a Purism 13".

It's unique. The keys have more travel than that mac, and are a bit more spaced out, which is pretty nice. The colors on the new macs (judging from my partner's) look pretty bad (at least by default). This seems to not be an issue with this one. There are a ton of different ports and hardware kill switches (camera/mic and bluetooth/wifi). The body is meant to allow for replaceable ram and hard drives (the screws are actually just phillips heads, which is nice even if it's mostly just symbolic).

But

All that said, of course, since it's Linux, there's some stuff to fight through. The first thing was that I wanted to remap the caps lock to control. Usually, this is easy. I've never had this much trouble with a linux distro (PureOS) before. The more superficial commands and UIs didn't seem to work. Additionally, with Purism laptops apparently there's a weird thing with the | and \ key where it wants to be square brackets? No idea why, but fortunately, the solution to that problem and some experimentation led me to find the way to remap the caps lock easily.

Basically, the following lines have to be in /etc/rc.local, with permission 750 and owned by root.

!/bin/sh -e

setkeycodes 3a 29
setkeycodes 56 43
exit 0

The 3a to 29 is for the caps lock, and the 56 to 43 is for the pipe key.

Nothing else I had to do was unfamiliar to me because I've used Linux before. Programmers would probably like this laptop. And it ships with a simple gnome layout that isn't too intimidating (maybe a bit the opposite actually).

Custom Stuff

One other thing I needed to "fix" was the screen resolution. It was too high. Everything was too small, and it hurt my head/eyes. I ended up just tacking it on the end of the startup script for i3(wm) which is a tiling window manager. Basically, everything can happily live as a full screen program. There's very little clicking. Not user friendly for non-programmers/linux enthusiasts probably. I really like it though. I didn't figure out a general fix for the resolution for other window managers because I don't think I'll really be using them.

Another thing was the system beep. You need to add this line:

blacklist pcspkr to the file /etc/modprobe.d/blacklist

On a per-session basis, you could also use rmmod pcspkr

One last tweak was increasing the trackpad speed.

Keyboard Shortcuts

Honestly, it's a bit weird, but this is actually Mac's best strength. Of course, that's with a bit of customization, and I'm sure I'll get similar results at some point, but the fundamental aspect that I'm missing is that macs have a command key and a control key that both use shortcuts. Generally command is more OS-like stuff and ctrl is for the "readline" interface, aka emacs and command-line shortcuts. It's a clean separation that's great. I haven't worked out anything that good here yet.

The worst of this is probably the collision around copying and pasting. In linux, ctrl-c is both the stop command on the terminal and the copy command in other contexts. It's bad by default. It's worse when it concerns vim. I'll get around to fixing this at some point.

Programs

There are a few desktop programs that I use quite often that have linux versions as well, which was unexpected. Slack, Steam, and Spotify all have desktop apps that you can get, one way or another. Spotify works pretty well, though media integration (sound controls) aren't as front facing as on a mac keyboard. Sound in general is a little bit more awkward.

Steam almost installed, but I'm missing a few dependencies. I think I might need to enable other repo sources(?), but I'm not really sure. And once they are installed, I don't know which, if any of the games I've bought will work (Maybe the ones with the Steam logo?).

Slack prompted me for my keyring password, which was weird as hell. I remember dropbox(pretty sure it was them?) doing some dirty and insecure stuff along these lines before so I'll read up on this before I go through with it.

In any case, these three seem alright.

Program Replacements

As far as more utilitarian programs, Libre Office is fine for office stuff. I'm not sure if I'll end up going with a web based (using html/js/css) thing like impress.js or reveal.js for presentations or maybe use the google thing. Unlikely to go with the libre office tool "impress" though.

The choice of terminals is a little overwhelming and none stand out as clearly the best. They work mostly the same.

One extremely pleasant surprise was "Krita," which is a digital painting program. It seems like for the kinds of things I was doing with Photoshop and Affinity (designer/photo), it will fill the gap nicely.

I still haven't found a replacement for Sketch, which is incredibly useful for storyboarding and other tasks that revolve around blocking in layouts.

Flicker and Glide

I'd say the two things that are worse in the UI, but they're not deal breakers for me. The first is a flicker that happens when scrolling a bit. I'm not sure what causes this, but I've seen it on other linux machines that I've used. It looks like a section of the screen gets a bit jagged. It's not great, and I would guess it's something in a fairly core system (X?).

The other thing is a bit more frustrating. With the trackpad movement and with two finger scrolling, there aren't the acceleration curves to the motion that I'm used to. A fast flick moving things a lot as opposed to a subtle drag moving a very tiny amount is a nice dimension that helps the economy of your hand motion. There are ways to change this, but it doesn't get as good as it is on a mac.

Updates

Today, I made a couple of small changes. I installed ruby and node environments, which turned out to be easier via their package managers (gem and npm) and version managers (chruby and nvm). The path here was a little convoluted due to (I think) the defaults for source lists that come with PureOS.

Additionally, I made some changes to vim so that it wouldn't have an independent clipboard from the rest of the OS. This meant two minor changes:

  1. sudo apt install vim-gtk
  2. set clipboard=unnamedplus inside of .vimrc (which of course, needs to be sourced by .zshrc, .bashrc or something else).

Update 2

  • Took care of the audio controls (in an i3 config file)
  • Installed steam/slack (for "application" type programs that are proprietary, PureOS's apt is awkward compared to flatpak/flathub)
  • Some logout logic and mappings

Update 3

Finally got natural scrolling working with this command:

xinput --set-prop 10 "libinput Natural Scrolling Enabled" 1

Discovering this took a very long time. xinput list-props 10 was the way to see what the name of the setting was called (as well as showing that it was off, 0). To discover that device to begin with, xinput will tell you where it is located.

So solving this ended up solving the "what terminal to use" problem. gnome-terminal seems to work fine, and has some high level configuration accessible through a menu.

Found a lead on how to do laptop closing/opening stuff, but didn't seem to work.

Update 4

I set up a dotfiles repo if you want to follow along. It has my vim config as well. One other thing tht is big to note here is that I rely on omyzsh (for shell config) and janus (for vim config) quite a bit. Out of the box, neither is perfect, but I find myself tweaking them more than reinventing my own setup each time.

Other Notes

  • Headphone jack stopped working once. Fixed it with alsactl restore
  • Once added a bad config file for X and had to access the filesystem via a Live USB of another linux in order to remove it (not sure if PureOS has some other mechanism to log in with command line only mode, but I couldn't find one). These two lines were really important udisksctl unlock -b /dev/sdb5 (where sdb5 is the name of the encrypted volume) and udisksctl mount -b /dev/mapper/whatever (where whatever is the name of the location it unlocked to.

Still Left

  • laptop close to lock
  • keybindings readline style interface
  • audio bug on twitter videos (but not embedded youtube videos) where people sound like kidnappers