Skip to content

Instantly share code, notes, and snippets.

@cornfeedhobo
Last active May 28, 2024 16:56
Show Gist options
  • Save cornfeedhobo/8f32430dc6c52b9a4776df91701b1d96 to your computer and use it in GitHub Desktop.
Save cornfeedhobo/8f32430dc6c52b9a4776df91701b1d96 to your computer and use it in GitHub Desktop.
Framework Laptop Customizations

Framework Laptop Customizations

This documents the changes made while installing OpenSUSE LEAP 15.3 on the Framework Laptop (1st edition).


Guided install

During the guided install, there are some minor changes that will make things smoother later.

Enlarged swap for hibernate

There is an option to enlarge swap to support hibernation, but it still fails to create a partition large enough.

  • Use the guided setup, then the expert partitioner, based on the guided setup
  • Delete the root and swap partitions
  • Add a new swap partition that is at least 200MiB larger than your physically installed memory
  • Add your remaining partitions
  • Note: LUKS encryption is still supported

Boot Loader

  • CPU Mitigations (optional): Auto + No SMT
  • Check that the installer has automatically populated resume=
  • Add mem_sleep_default=deep
  • Add acpi_osi="Windows 2020"

Networking

  • Set hostname (optional)

Reboot

Your laptop may freeze during reboot. The caps lock might flash rapidly. This is expected and will be resolved be the Post-Install changes. Hold down the power button until the laptop stops.


Post-Install Changes

Once the base system is installed, you will need to install and configure the necessary components.

Kernel

To make use of the newest features of the laptop, you'll need the newest backported kernel.

sudo zypper ar --priority 50 --refresh https://download.opensuse.org/repositories/Kernel:stable:Backport/standard/Kernel:stable:Backport.repo
sudo zypper ref
sudo zypper up --allow-vendor-change

Trackpad

X11

I found that the best way to configure the trackpad was with xorg.

/etc/X11/xorg.conf.d/99-framework.conf
Section "InputClass"
	Identifier "Framework Clickpad"
	MatchProduct "Touchpad"
	MatchDriver "synaptics"
	
	# Enable clicking
	Option "ClickPad" "true"
	Option "EmulateMidButtonTime" "0
	Option "ClickMethod" "clickfinger"
	Option "ClickFinger1" "1"
	Option "ClickFinger2" "3"
	Option "ClickFinger3" "2"
	
	# Disable tapping
	Option "TapButton1" "0"
	Option "TapButton2" "0"
	Option "TapButton3" "0"
	Option "MaxTapTime" "0"
	Option "SoftButtonAreas" "0 0 0 0 0 0 0 0"
	
	# Prevent Accidental Clicks
	Option "PalmDetect" "1"
	Option "PalmMinWidth" "5"
	Option "PalmMinZ" "40"
	
	# Calm the pad down while clicking
	Option "VertHysteresis" "5"
	Option "HorizHysteresis" "5"
	
	# Natural (reverse) scrolling
	Option "VertTwoFingerScroll" "1"
	Option "VertScrollDelta" "-90"
	Option "HorizTwoFingerScroll" "1"
	Option "HorizScrollDelta" "-90"
	
	# Smooth movement
	Option "MinSpeed" "1"
	Option "MaxSpeed" "2"
	Option "AccelerationProfile" "2"
	Option "ConstantDeceleration" "4"
	#Option "PressureMotionMinZ" "15"
EndSection

Touchegg

Touchegg is available in most repos, but you'll want the newest. There is one available in the X11:Unity reposity where you can grab the latest and install it manually.

Once installed, you can configure it:

~/.config/touchegg/touchegg.conf
  

    
      
        false
        qdbus-qt5 org.kde.kglobalaccel /component/kwin invokeShortcut 'Expose'
        begin
      
    

    
      
        false
        qdbus-qt5 org.kde.kglobalaccel /component/kwin invokeShortcut 'ExposeClass'
        begin
      
    

    
      
        false
        qdbus-qt5 org.kde.kglobalaccel /component/kwin invokeShortcut 'Switch to Previous Desktop'
        begin
      
    

    
      
        false
        qdbus-qt5 org.kde.kglobalaccel /component/kwin invokeShortcut 'Switch to Next Desktop'
        begin
      
    

    
      
        false
        XF86Back
        begin
      
    

    
      
        false
        XF86Forward
        begin
      
    

  


And you'll need a systemd user service to ensure it's stable across all power states

~/.config/systemd/user/touchegg.service
[Unit]
Description=Touchegg User Service

[Service]
ExecStartPre=/bin/sh -c 'killall -qw touchegg || true'
ExecStart=/usr/bin/touchegg
Restart=always
RestartSec=1s

[Install]
WantedBy=default.target

Finally you can enable the services:

sudo systemctl enable --now touchegg.service
systemctl enable --now --user touchegg.service

Suspend-then-hibernate

Systemd

/etc/systemd/logind.conf
HandleLidSwitch=suspend-then-hibernate
/etc/systemd/sleep.conf
HiberateDelaySec=60min
/etc/systemd/system.conf
RebootWatchdogSec=0

KDE Power Management

  • System Settings
    • Power Management
      • Energy Savings
        • On Battery
          • While asleep, hibernate after a period of inactivity
        • On Low Battery
          • While asleep, hibernate after a period of inactivity

Reboot

The laptop may freeze again. Hold down the power button until the laptop shuts off. This should be the last time it freezes during shutdown / reboot.

@DaAwesomeP
Copy link

Update: For 12th gen to get the brightness/airplane mode keys to work, you need to prevent the conflicting ALS driver from loading:

echo "blacklist hid_sensor_hub" > /etc/modprobe.d/90-framework-als-blacklist.conf
mkinitrd

Note that the kernel parameter module_blacklist=hid_sensor_hub did not work and I specifically needed hid_sensor_hub in the modprobe file and not hid-sensor-hub.

@cornfeedhobo
Copy link
Author

@DaAwesomeP I won't be upgrading from the 11th gen for quite a while, but I can respond to the other questions:

What does acpi_osi="Windows 2020" workaround/fix/improve?

Shutting down hangs unless this is set.

How did you test/troubleshoot that mem_sleep_default=deep is required to get to S3 sleep?

Battery drain while asleep for 3 hours with and without it set. deep had less drain, but still more than I was happy with. I don't remember the hard numbers at this point and didn't document them, sorry.

Have you experimented with nvme.noacpi=1

No, I didn't try that. After reading this comment, I'm thinking that it might be worth trying with s2idle - it sounds like you'll get drain that is comparable to s3deep. I still think ~3%/hr is too much to tolerate, but maybe this means an optimal config could drop s3deep and still configure hibernation after 2-3 hours.

@brianjcohen
Copy link

brianjcohen commented May 28, 2024

@cornfeedhobo I'm trying to get suspend-then-hiberate going on Tumbleweed running KDE Plasma6. I know you're on LEAP but perhaps you or someone else here can help with a couple questions.

  • In Plasma6, the KDE Energy Saving setting 'After a period of inactivity' allows you to select one of 'Do Nothing', 'Sleep', 'Hibernate', and 'Shutdown' along with a time offset (eg. 'After 120 minutes'). Are you setting a value here?
  • Likewise, the setting for 'When laptop lid closed' can be set to one of 'Do Nothing', 'Sleep', 'Hibernate', 'Shutdown', 'Lock Screen', 'Turn Off Screen'. Does this setting matter.
  • In this thread comment, there are additional login.conf directives being suggested, instead of just the single HandleLidSwitch directive mentioned in this gist. Did it turn out that HandleLidSwitch was the only one that really mattered? https://community.frame.work/t/responded-linux-deep-sleep/2491/73

Edit: I'm finding some evidence that the systemd devs actually changed the meaning of suspend-then-hibernate within the last couple years and that it no longer means "transition from suspend to hibernate on my preferred offset": https://old.reddit.com/r/openSUSE/comments/1bfpebv/suspendthenhibernate_hibernate_timeout/

Edit: Scratch that. It looks like the systemd devs actually reverted that change. https://old.reddit.com/r/archlinux/comments/zczdnq/systemctl_suspendthenhibernate_not_working_anymore/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment