~charles/dotfiles

ref: b8a2505022f932e959c810a5fcff310a4e3d0e27 dotfiles/overlay/bin/displayman -rwxr-xr-x 1003 bytes
b8a25050Charles Daniels update mimassoc for focal 4 months ago
                                                                                
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
#!/bin/sh

# Display management script. Attempts to re-configure displays each time
# it catches the signal USR1.

trigger_reconfigure () {
	echo "($(date)) re-configuring displays... "
	ls -1 "$HOME/.screenlayout"/*.sh | sort | while read -r f ; do

		echo "considering screenlayout $f"
		if [ ! -x "$f" ] ; then
			echo "ignoring $f, it is not executable"
			continue
		fi

		if "$f" ; then
			echo "configuration successful"
			break
		else
			echo "configuration failed"
		fi
	done

	# do some sanity checking
	xmodmap ~/.Xmodmap
	numlockx on
	xkbset nullify lock
	$HOME/bin/apply-dpms

	feh --bg-fill ~/.wallpapers/wallpaper

	if [ -e /dev/wsmouse ] ; then
		xinput set-prop /dev/wsmouse "WS Pointer Wheel Emulation" 1
		xinput set-prop /dev/wsmouse "WS Pointer Wheel Emulation Button" 2
	fi

}

if pgrep displayman | grep -qv $$ ; then
	echo "displayman is already running" 1>&2
	pkill -USR1 displayman
	exit 1
fi

trap trigger_reconfigure USR1

trigger_reconfigure

while true ; do
	sleep 1
done