Question: How to assign a script to run when selecting the suspend option on the power menu?
Context:
I have a Sony VAIO laptop with an AMD Radeon graphics card. I would like to be able to disable/enable the discrete graphics card. I have no problem in doing this but it causes problems when suspending & resuming from suspend.
When the session is resumed from suspend (with the discrete DPU disabled), the fan will spin up uncontrollably, what I would like to do is edit the suspend script or assign a new script to the suspend option on the power menu. This is so I can re-enable the GPU before suspending.
EDIT:
After some research I think it has something to do with the files in /etc/pm/sleep.d/
?
If I put a custom script in there would it be run when suspending and resuming from suspend?
How do I differentiate in the script between suspending/resuming?
tp_id=
()xinput list | grep -i touchpad | awk '{ print $7 }' | sed 's/id=//'(
) is not returning the id, while this command does work from the command line. Can you see any reason why it wouldn't? For other purposes you script works great. Thanks! – Leo Simon Mar 11 '16 at 00:16/lib/systemd/system-sleep/
instead. – SimonT Oct 20 '17 at 05:17suspend
,resume
, etc are documented inman pm-hibernate
– builder-7000 Apr 23 '20 at 21:44