Score:1

How to setup a custom shortcut to toggle auto suspend setting?

pw flag

I run python scripts that sometimes take several hours to complete. I don't want the laptop to suspend while the script is running. But I want the monitor to turn off based on default setting. How can I do this with a shortcut? I want to toggle "auto suspend" "when plugged in" to "Never" when I use the shortcut.

I tried to use caffeine but it does not let me to turn off the screen. Other app based suggestions are also welcome!

Score:0
cn flag

Use following commands to turn "suspend" off using a shortcut key, respectively for when on AC and when on battery:

gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type 'nothing'

Change the final argument to 'suspend' to restore the behavior to auto-suspend. Change set by reset and leave out the argument to restore the setting to factory default.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.