This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to stop power saving functions when running a program?

Tags: None
(comma "," separated)
fellows
Registered Member
Posts
20
Karma
0
I have a ongoing issue when using kodi, it doesn't inhibit energy saving so when I am watching a video the screen will dim after a while. It only seems to happen with kodi, mpv and firefox do not do the same thing when watching videos so I am trying to find a work around for kodi specifically. I can turn off power management in the tray applet but it is annoying to have to do this every time I use the program and then turn it back on again afterwards.

I have tried a few different methods, systemd-inhibit doesn't work. I have found this script - https://github.com/graysky2/kodi-prevent-xscreensaver/blob/master/common/kodi-prevent-xscreensaver but it doesn't work either. I found something here https://askubuntu.com/questions/682648/cant-disable-power-management-in-kubuntu-15-04-desktop which I thought would help so I tried to replace "xscreensaver-command -deactivate" with "qdbus org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.SimulateUserActivity" from the first linked script so it looks like this:


Code: Select all
#!/bin/bash
# Emulate the mplayer hearbeat-cmd to keep xscreensaver from coming on while the kodi gui is active.
# Inspiration from this post: http://ubuntuforums.org/showthread.php?t=1931074&p=11716198#post11716198

# Nothing to do if user does not have requisite binaries.
[[ -z $(which xscreensaver-command) ]] && exit 1

while true; do
   if [[ -n $(pidof kodi.bin) ]]; then
      while [[ -n $(pidof kodi.bin) ]]; do
         qdbus org.freedesktop.ScreenSaver /ScreenSaver org.freedesktop.ScreenSaver.SimulateUserActivity
         sleep 49s
      done
   else
      sleep 49s
   fi
done


I added this to autostart but it also doesn't work.

So what is the best way to do this? Did I do something wrong in changing the command in the script?

What is the qdbus org.freedesktop command to disable power saving? I'm not sure where to find documentation on this.
hyena
Registered Member
Posts
11
Karma
0
OS
Could also use this.

It works properly when for exp. when I watch Netflix, but when I read sth with Okular it goes dim.
airdrik
Registered Member
Posts
1854
Karma
5
OS
I believe the usual recommendation is to use Activities for this and set up special behavior for your specific Activity in System Settings > Power Management > Activity Settings.


airdrik, proud to be a member of KDE forums since 2008-Dec.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar