Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[SOLVED]invoke a screensaver and xset through script

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
bkpsusmitaa
Posts: 485
Joined: 2009-07-04 06:32
Location: Home: Barrackpore and Mysore
Has thanked: 5 times

[SOLVED]invoke a screensaver and xset through script

#1 Post by bkpsusmitaa »

The usual code on console: xset dpms force off

Also have xscreensaver-demo installed by default. But this can only be initiated from the GUI. Don't want these.

My need is to have a screensaver and LED of screen "powered off" run iteratively when required without further ado.

Don't want xlock through xautolock, if the unlock a password every time. Unlike this one: How to run custom script as screensaver in Openbox?

Within a script file, sssvr.sh, something like the following:

Code: Select all

#!/bin/bash
echo "Usage: ./ssvr.sh ssvr.sh"
done=0
i=0
while true
do
expr $(( i = i + 1 ))
read -p "To stop press n and Enter : " -t 2 INPOOT
xset dpms force off
kill -19 `pidof $1`
sleep 12
xset dpms force off
kill -18 `pidof $1`
sleep 2
if [ "$INPOOT" = "n" ]; then
echo "Ending..."
echo
exit 0
fi
done
The script works.

But is it possible to have the above-mentioned script file run through xautolock. Now that is the pertinent question.

Any suggestion for improvement to the simple script is also welcome.

Any support possible?
Last edited by bkpsusmitaa on 2021-06-14 14:05, edited 1 time in total.
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

Re: [?]invoke a screensaver and xset through script

#2 Post by ticojohn »

bkpsusmitaa wrote:The usual code on console: xset dpms force off

Also have xscreensaver-demo installed by default. But this can only be initiated from the GUI. Don't want these.
xscreensaver-demo can most certainly be initiated from a script. Maybe it won't do the other things you want to do. Just open a terminal and type "xscreensaver-demo &" and it will open. And, I have written a simple script that will run xscreensaver-demo.
I am not irrational, I'm just quantum probabilistic.

bkpsusmitaa
Posts: 485
Joined: 2009-07-04 06:32
Location: Home: Barrackpore and Mysore
Has thanked: 5 times

Re: [?]invoke a screensaver and xset through script

#3 Post by bkpsusmitaa »

Got help to modify the code a little.
It is interesting to note that when the complexity of xscreensaver-demo isn't temporarily needed, why to invoke the binary, whose compressed deb file is 2310 kB and the data file is 1662 kB. Uncompressed, they occupy around 7mB diskspace. And also some memory space. While my simple saver, sufficient for my regular purpose, takes a mere 600bytes and an equivalent amount of memory?
Has someone used xautolock to initiate a scipt during system inactivity?
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home

bkpsusmitaa
Posts: 485
Joined: 2009-07-04 06:32
Location: Home: Barrackpore and Mysore
Has thanked: 5 times

[solved]invoke a screensaver and xset through script

#4 Post by bkpsusmitaa »

the codes, kill -STOP and kill -CONT are getting me logged out of my user-account. So hashed.

The xautolock code is fairly simple. It is

Code: Select all

xautolock -time 1 -locker "xset dpms force off"
From the terminal, the above code could be iteratively executed using a script as posted above, and the said script could be invoked as:

Code: Select all

 xautolock -time 1 -locker "./ssvr.sh"
So this is a perfect screensaver for me, occupying only few hundred bytes of HDD space, and an equivalent space in RAM.
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home

Post Reply