Unable to turn off system sleep mode

Hi community members,

I want to disable system sleep, or at least activate it only after several hours of inactivity. I tried to do this by setting the time of “when inactive for” to “never” in the system power saving setting of power manager, but it didn’t work. The program I was running on VS Code paused after some time of inactivity. Indeed, I could stop the system from suspension by setting “blank after”, “put to sleep after”, “switch off after” under the display power management panel, or just turning on presentation mode, but I prefer turning off the monitor as well. Would you pinpoint why the “system power saving” did not work and give some suggestions on what to do next? Appreciate any assistance or tips.

Linux 6.4.6-1

[HowTo] Disable / Turn off Hibernate completely! - #19 by Zesko

Turn off all rest states (Sleep, suspend, hibernate, hybrid-sleep)

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Back to enable all rest states

sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target