Skip to content

Instantly share code, notes, and snippets.

@Pastitas
Last active September 6, 2023 06:57
Show Gist options
  • Save Pastitas/d6ceb1b067ba93a868b247896e51605c to your computer and use it in GitHub Desktop.
Save Pastitas/d6ceb1b067ba93a868b247896e51605c to your computer and use it in GitHub Desktop.
Auto hibernate reboot to windows and fancontrol scritp

Enable hibernate and reboot into windows for dual booting

sudo vim /usr/lib/systemd/system-sleep/windows

#!/bin/bash

# Enable the use of hybrid-sleep for hibernate/reboot into windows when dual booting.
# requires the flag HybridSleepMode=reboot to be enabled in /etc/systemd/sleep.conf
# and grub-reboot to be installed

case $1/$2 in
   pre/hybrid-sleep)    
      # grub-reboot 2\
      # sudo bootctl set-oneshot auto-windows
      # sudo efibootmgr -n 0006
   ;;
 
esac

sudo chmod +x /usr/lib/systemd/system-sleep/windows

Relaunch the fancontrol script after restore from suspension/hibernation

sudo vim /usr/lib/systemd/system-sleep/fancontrol

#!/bin/bash

# fancontrol resume hook

case $1 in
   post) fancontrol ;;
esac

sudo chmod +x /usr/lib/systemd/system-sleep/fancontrol

Windows reboot with systemd-boot

Sleep is broken, so no hybrid sleep. Hibernation is not working, so reboot it is

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=bash -c 'systemctl reboot --boot-loader-entry=auto-windows;$SHELL'
Name=Windows
Terminal=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment