File: screenblank

package info (click to toggle)
acpi-support 0.142-8
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 788 kB
  • sloc: sh: 1,068; ansic: 131; makefile: 33
file content (53 lines) | stat: -rw-r--r-- 1,697 bytes parent folder | download
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
d=/tmp/.X11-unix
for x in $d/X*; do
    displaynum=${x#$d/X}
    getXuser;
    if [ "x$XAUTHORITY" != x ]; then
	export DISPLAY=:"$displaynum"
	if pidof xscreensaver >/dev/null; then
		su "$XUSER" -s /bin/sh -c "xscreensaver-command -throttle"
	fi
	if [ x$LOCK_SCREEN = xtrue ]; then
		if pidof xscreensaver >/dev/null; then
			su "$XUSER" -s /bin/sh -c "xscreensaver-command -lock"
		elif pidof gnome-screensaver > /dev/null; then
			su "$XUSER" -s /bin/sh -c "gnome-screensaver-command --lock"
		elif pidof dcopserver >/dev/null; then
			avail_sessions=`dcop --all-users --list-sessions | grep '.DCOP.*__0'`
			# send the lock command to all sessions
			for session in $avail_sessions; do
				# /dev/null because dcop warns if it can't connect to X (this is normal!)
				dcop --session "$session" --all-users kdesktop KScreensaverIface lock > /dev/null 2>&1
			done
		elif pidof xautolock >/dev/null;then
			su "$XUSER" -s /bin/sh -c "/usr/bin/xautolock -locknow"
		elif [ -x /usr/bin/xlock ]; then
			su "$XUSER" -s /bin/sh -c "/usr/bin/xlock -mode blank &"
		elif [ -x /usr/bin/xtrlock ]; then
			su "$XUSER" -s /bin/sh -c "/usr/bin/xtrlock &"
		elif [ -x /usr/bin/i3lock ]; then
			su "$XUSER" -s /bin/sh -c "/usr/bin/i3lock"
	 	fi
	fi

	case "$DISPLAY_DPMS" in
	  xset)
		su "$XUSER" -s /bin/sh -c "xset dpms force off"
		;;
	  xrandr)
		su "$XUSER" -s /bin/sh -c "xrandr --output $XRANDR_OUTPUT --off"
		;;
	  vbetool)
		/usr/sbin/vbetool dpms off
		;;
	esac

	if [ x$RADEON_LIGHT = xtrue ]; then
	    [ -x /usr/sbin/radeontool ] && radeontool light off
	fi
    else
	if [ -x$DISPLAY_DPMS_NO_USER = xtrue ]; then
	    [ -x /usr/sbin/vbetool ] && /usr/sbin/vbetool dpms off
	fi 
    fi
done