aboutsummaryrefslogtreecommitdiff
path: root/system/xssstate/README.Slackware
blob: d53c41923d1ba09ff60c183461abac5e18ba0d0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
xssstate
--------

This is the xssstate utility from suckless.org.

This tool is a simple tool that retrieves the X screensaver state.
The screensaver states include the idle time, the screensaver state,
and the time how long to wait until the screensaver should be active.

The values for the screensaver states in X can be changed using
xset(1).

Turn off the screensaver:

  % xset s 0
  % xset s 0ff

Turn on the screensaver after 60 seconds inactivity:

  % xset s 60

Force the screensaver to be active:

  % xset s blank

For more options, see xset(1).

Why
---

I created this package, because I needed this one utility to control
my screensaver and lock my screen with a simple tool.

The same utility is bundled in the suckless-tools package on
slackbuilds.org. If you need the other utilities in that package,
you can use that. B. Watson did a nice job including these
into one package.

I did not have use for the other utilities in that package, and
have created this package.

Example usage
-------------

In the section below, an xss_idle.sh script is given. This script
is an example on how to use this for a background service that
will control your screensaver. This can be used to invoke xlock(1)
using the following command.

  % xss_idle.sh xlock &

This can be usefull in your $HOME/.xinitrc file.

You can also use slock, or any other utility that can lock the
screen.

Example script: xss_idle.sh
---------------------------

#!/bin/sh
#
# Use xset s $time to control the timeout when this will run.
#

if [ $# -lt 1 ];
then
  printf "usage: %s cmd\n" "$(basename $0)" 2>&1
  exit 1
fi
cmd="$@"

while true
do
  if [ $(xssstate -s) != "disabled" ];
  then
    tosleep=$(($(xssstate -t) / 1000))
    if [ $tosleep -le 0 ];
    then
      $cmd
    else
      sleep $tosleep
    fi
  else
    sleep 10
  fi
done