Hey, I was wondering if someone is familiar with a way to do this:
If - I am downloading, watching, running a specific program, etc…
I do not want to enter a hibernation mood.
Can it be done?
Thanks in advance.
You could look at running commands with systemd-inhibit or if you’re running gnome, gnome-session-inhibit.
Thank you, I will look it up.
I am wondering if it would be possible (in Gnome) to either
- have a rule set that will be checked against to determine if an invoked program should be prepended with gnome-session-inhibit (e.g. if started program is rhythmbox, then always start it with gnome-session-inhibit)
or
- inhibit suspend/hibernate whenever I am playing songs on rhythmbox
Actually, I would prefer the latter, since it would allow suspend/hibernate even when rhythmbox is running, but actually not playing any song.
I am asking, because I am a musician and don’t want the system getting locked or suspended while I am playing along a list of songs in rhythmbox or any other multimedia application like audacity. It’s no use having to unlock the laptop again just to rewind or jump to a certain position in a song. (And it’s a pain to notice the system suspending whilst jamming to a song).
My current workaround for this situation is running a script which touches the settings for screen lock and suspend via dconf.
The simplest way to do that would be to:
copy the desktop file from /usr/share/applications to ~/.local/share/applications/
modify the exec line of the desktop file to include gnome-session-inhibit.
For example:
Exec=gnome-session-inhibit rhythmbox %U
You can also change the name of the file and the Name in the desktop file if you’d like to have the ability to run the original and the modified.
If you are on KDE plasma, there is a switch to manually block sleep and screen locking. And generally when a video/audio player like VLC is running it will automatically block sleep.
Yup, that’s exactly the behavior I was wondering if it is also available or possible with Gnome.
That’s why I ended up with
!/bin/sh
status=`dconf read /org/gnome/desktop/screensaver/lock-enabled`
if [ $status == "true" ]
then
status=false
power=nothing
else
status=true
power=suspend
fi
dconf write /org/gnome/settings-daemon/plugins/power/sleep-inactive-battery-type "'$power'"
dconf write /org/gnome/desktop/screensaver/lock-enabled "$status"
echo $status
Not very robust, but at least a start. Still, I would prefer a setting to tell Gnome not to lock the screen and not to suspend (except when battery is low) when it’s showing media content.