[Solved] nosleep command?

Everything about X, Gnome, KDE, ... and everything running on it

[Solved] nosleep command?

Postby bester69 » 2016-11-16 13:06

Hi,

Im looking something like nosleep windows app, or simulate activity (this last one would be better). Is there any specific linux app for this porpose?,

Im looking for a simple command line or a simple gui to pause screensaver and sleep states.


thanks.
Last edited by bester69 on 2016-11-16 23:52, edited 1 time in total.
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1638
Joined: 2015-04-02 13:15

Re: nosleep command?

Postby pylkko » 2016-11-16 14:05

User avatar
pylkko
 
Posts: 1741
Joined: 2014-11-06 19:02

Re: nosleep command?

Postby bester69 » 2016-11-16 14:18


Hi pylkko, i opened this post because i was looking for an easy specific generic app (i didnt want make use of qdbus..), just like kind of nosleep command, something independient of DE. For example, Kodi working prevent system getting into suspend. Is there any app that simulate mouse activity movement to workaround this??, in windows also exist that kind of app..

its a pitty, there shoud be some app for this purpose.. :(
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1638
Joined: 2015-04-02 13:15

Re: nosleep command?

Postby bester69 » 2016-11-16 15:10

I think this script ive just done will do it

unsleep.sh
Code: Select all
#!/bin/bash
#
#Disable modes
sudo systemctl mask sleep.target &
#Open GUI
gcolor2
#Re-enable modes
sudo systemctl unmask sleep.target &
exit


thanks again :)
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1638
Joined: 2015-04-02 13:15

Re: [Solved] nosleep command?

Postby bester69 » 2016-11-17 05:18

This script prevent the system to sleep by emulating some period activity:

nosleep.sh
Code: Select all
#!/bin/bash
 
for i in {1..120}
do
  xdotool mousemove 20 200
  sleep 60
  xdotool mousemove 20 210
  sleep 60

bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1638
Joined: 2015-04-02 13:15

Re: [Solved] nosleep command?

Postby bester69 » 2020-05-27 20:47

A better and final version.:

Requirements.:
- gpick (used as systemtray indicator)
- nosleep_systemctl.sh (sudoers script)


gnosleep.sh (Ctrl + Shift +9) : Toggle Sleep/Nosleep
Code: Select all
#!/bin/bash
#

A=$(pidof gpick)
if [ ! -z "$A" ]
then
killall gpick
sudo /home/user/scripts/nosleep_systemctl.sh "0"
exit
  fi   

killall gpick
sudo /home/user/scripts/nosleep_systemctl.sh "1"
gpick &> /dev/null
sudo /home/user/scripts/nosleep_systemctl.sh "0"



nosleep_systemctl.sh --> nosleep (command line)
nosleep 0 (normal mode)
nosleep 1 (disable sleep system)


Code: Select all
#!/bin/bash
#

OPT="$1"
 case "$OPT" in
    "1" ) 
    echo "- Nosleep Systemctl: 1 "
    sudo systemctl  --runtime mask sleep.target suspend.target
        ;;
    "0" ) 
    echo "- Nosleep Desactivado Systemctl: 0"
    sudo systemctl --runtime unmask sleep.target suspend.target
        ;;       
    * )
        echo "Sin Error..."
        ;;
esac
flag=$(find /run/systemd/system/ -type l -name "sleep.target")
if [ ! -z "$flag" ]
then
echo "Estado MASKED sleep.target suspend.target"
else
echo "Estado UNMASKED sleep.target suspend.target"
fi
bester69 wrote:You wont change my mind when I know Im right, Im not an ...
User avatar
bester69
 
Posts: 1638
Joined: 2015-04-02 13:15

Re: [Solved] nosleep command?

Postby Bloom » 2020-05-27 21:50

Package: caffeine
Version: 2.9.4-2
Priority: optional
Section: misc
Maintainer: Andrew Shadura <andrewsh@debian.org>
Installed-Size: 323 kB
Depends: gir1.2-ayatanaappindicator3-0.1, gir1.2-gtk-3.0, python3-ewmh, python3-gi, python3-pkg-resources, python3-xlib, xdg-utils (>= 1.1.1), python3:any
Homepage: https://launchpad.net/caffeine
Download-Size: 49,4 kB
APT-Sources: http://ftp.be.debian.org/debian stable/main amd64 Packages
Description: prevent the desktop becoming idle in full-screen mode
Caffeine prevents the desktop from becoming idle when an application
is running full-screen. A desktop indicator ‘caffeine-indicator’
supplies a manual toggle, and the command ‘caffeinate’ can be used
to prevent idleness for the duration of any command.
User avatar
Bloom
 
Posts: 268
Joined: 2017-11-11 12:23


Return to Desktop & Multimedia

Who is online

Users browsing this forum: No registered users and 12 guests

fashionable