File: DesktopCheckMounts

package info (click to toggle)
fvwm-crystal 3.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 19,748 kB
  • ctags: 793
  • sloc: sh: 2,815; cs: 880; python: 875; makefile: 212
file content (29 lines) | stat: -rwxr-xr-x 619 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
#!/bin/bash
# FVWM-Crystal helper script that check for mount changes
# Usage: Exec exec $[FVWM_SYSTEMDIR]/scripts/DesktopCheckMounts <delay [s]>

# the PID to kill if fvwm is interrupted
TMPFILE="/tmp/crystal_desktopcheckmount_$$"
touch ${TMPFILE}

cleanup() {
	rm ${TMPFILE}
	exit 0
}

trap cleanup INT QUIT TERM

# the main loop
CRC=$(cksum /proc/mounts|cut -d" " -f1)
while :
do
	sleep "$1"
	# fvwm is started by exec; be sure it is running
	pidof fvwm 1>/dev/null || cleanup

	NEWCRC=$(cksum /proc/mounts|cut -d" " -f1)
	if [[ "$NEWCRC" != "$CRC" ]]; then
		CRC="${NEWCRC}"
		FvwmCommand ShowDesktopIcons
	fi
done