How to restart libinput-gestures after resume from hibernate or suspend?

This thread/post outlines how to write a script to restart libinput-gestures after resuming from hibernate or suspend on Gnome or KDE. Apparently, this only affects some users. Unfortunately, this affects my Macbook Air running NixOS. Does anyone know how you’d write that script to work on NixOS/Hyprland?

#!/bin/bash

dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver'" |
  while read x; do
    case "$x" in
      *"boolean true"*) libinput-gestures-setup stop;;
      *"boolean false"*) libinput-gestures-setup restart;;
    esac
  done
exit 0

This would probably be a systemd user unit, I suppose.

I have to admit this is a little over my head, but I tried going through the Extend section of the NixOS wiki and took a stab.

Would something like this work? Does the ExecStart/Stop also apply to hibernation, or just boot-up and shutdown?

  systemd.services.gesturesSession = {
    wantedBy = [ "multi-user.target" ];
    description = "Restart libinput-gestures after hibernate.";
    serviceConfig = {
      ExecStart = ''libinput-gestures''; 
      ExecStop = ''pkill -f gestures'';
    };
  };

I found that I can issue these commands using either hypridle or swayidle, before and after hibernation.