How to prevent the suspension of KDE?

Get help with KDE4 specific problems
Post Reply
User avatar
Slaxmax
Contributor
Contributor
Posts: 403
Joined: 03 Jan 2013, 09:51
Distribution: KDE4
Location: Campinas Brazil https://goo.gl/yrxwKi

How to prevent the suspension of KDE?

Post#1 by Slaxmax » 19 Nov 2013, 18:58

Hello
I use porteus 2.1-kde4. How can I prevent the suspension when viewing youtube video or doing a file download?
“DNA is like a computer program but far, far more advanced than any software ever created.”
― Bill Gates, The Road Ahead

User avatar
fanthom
Site Admin
Site Admin
Posts: 4614
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland, currently - Cork, IE
Contact:

Re: How to prevent the suspension of KDE?

Post#2 by fanthom » 21 Nov 2013, 20:39

please check: System Settings -> Hardware section -> Power Management
Please add [Solved] to your thread title if the solution was found.

User avatar
Slaxmax
Contributor
Contributor
Posts: 403
Joined: 03 Jan 2013, 09:51
Distribution: KDE4
Location: Campinas Brazil https://goo.gl/yrxwKi

Re: How to prevent the suspension of KDE?

Post#3 by Slaxmax » 22 Nov 2013, 22:01

Okay I want to continue the suspension, but not suspend these cases I said.
“DNA is like a computer program but far, far more advanced than any software ever created.”
― Bill Gates, The Road Ahead

User avatar
brokenman
Site Admin
Site Admin
Posts: 5554
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: How to prevent the suspension of KDE?

Post#4 by brokenman » 23 Nov 2013, 00:30

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.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
fanthom
Site Admin
Site Admin
Posts: 4614
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland, currently - Cork, IE
Contact:

Re: How to prevent the suspension of KDE?

Post#5 by fanthom » 24 Nov 2013, 11:04

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.
Please add [Solved] to your thread title if the solution was found.

User avatar
Slaxmax
Contributor
Contributor
Posts: 403
Joined: 03 Jan 2013, 09:51
Distribution: KDE4
Location: Campinas Brazil https://goo.gl/yrxwKi

Re: How to prevent the suspension of KDE?

Post#6 by Slaxmax » 22 Jan 2014, 17:00

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
“DNA is like a computer program but far, far more advanced than any software ever created.”
― Bill Gates, The Road Ahead

Post Reply