[HowTo] Enable and configure hibernation with BTRFS

Thanks!
With the new & updated wiki, my script is now working again, copy pasted the wiki and also enabled a few related stuff, tested & verified:

manjaro-gnome-post-install/btrfs-hibernation.sh at main · zilexa/manjaro-gnome-post-install · GitHub

The script will:

  1. Automatically perform the actions in this wiki, creating the root subvolume for swap, swap file and configuring hibernation.
  2. Additionally, enable "suspend-then-hibernate", the most modern way of standby! suspend-then-hibernate will be the default suspend method for suspend, always hibernating 2 hours after suspend.
  3. Power-off key will skip suspend, instead hibernate the system immediately.
  4. (If a laptop) lid close will “suspend-then-hibernate”.

What is suspend-then-hibernate?
The system will go quickly into standby and wake up quickly if woken by the user within 2 hours. Otherwise, it will automatically wake up and hibernate (write to swap & shutdown completely), saving battery power and preventing you from losing data when battery dies.
When you wake the system after 2 hours, wake up can take slightly longer as it will wake up from hibernation.