Page 1 of 1

How to prevent the suspension of KDE?

Posted: 19 Nov 2013, 18:58
by Slaxmax
Hello
I use porteus 2.1-kde4. How can I prevent the suspension when viewing youtube video or doing a file download?

Re: How to prevent the suspension of KDE?

Posted: 21 Nov 2013, 20:39
by fanthom
please check: System Settings -> Hardware section -> Power Management

Re: How to prevent the suspension of KDE?

Posted: 22 Nov 2013, 22:01
by Slaxmax
Okay I want to continue the suspension, but not suspend these cases I said.

Re: How to prevent the suspension of KDE?

Posted: 23 Nov 2013, 00:30
by brokenman
I don't think this is possible without writing some script to look for youtube or download processes. It wouldn't be too hard to create such a script that switches off power options. You could look for an application called wigglemouse which 'wiggles' the mouse every 10 minutes or so to prevent sleepage.

Re: How to prevent the suspension of KDE?

Posted: 24 Nov 2013, 11:04
by fanthom
this is probably not what you are looking for but please try (in case it also disables suspension):
http://kde-look.org/content/show.php/Sc ... tent=93752

btw: will add this plasmoid to next porteus release.

Re: How to prevent the suspension of KDE?

Posted: 22 Jan 2014, 17:00
by Slaxmax
I wrote this script to prevent the suspension of KDE or any desktop environment.
You need only xautomation (xte) package for use this script
For autostart in KDE4 put this script in /home/guest/.kde4/Autostart/

Code: Select all

#!/bin/sh
# This script disable power scheme if cpu usage greater than $cputarget or
# any process $process1,$process2... are active.
# Author: Slaxmax http://forum.porteus.org/

while :
do

process1="wget"             
process2="uget-gtk"
process3="transmission-qt"
cputarget=7


##################################################################################################################

    NUMCPUS=`grep ^proc /proc/cpuinfo | wc -l`; \
    FIRST=`cat /proc/stat  | awk '/^cpu / {print $5}'`; sleep 1; \
    SECOND=`cat /proc/stat | awk '/^cpu / {print $5}'`; \
    USED=`echo 2 k 100 $SECOND $FIRST-$NUMCPUS / - p | dc`
    
var=$(awk -v key=$cputarget -v result=$USED 'BEGIN{print result<key?1:0}')
        echo CPU $USED%


if [ $var -eq 0 ] || [ $(ps aux | grep -E "($process1|$process2|$process3)" | grep -v grep | wc -l) -ge 1 ]; then

        xte 'mousermove -1 0' 
        xte 'mousermove 1 0'

    echo power on  
   
   else
  
    echo power off
             
   fi
         sleep 50
         clear
done
Enjoy! :D