File: UpdateInfoline

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 (53 lines) | stat: -rwxr-xr-x 1,191 bytes parent folder | download | duplicates (3)
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
#!/bin/bash
# Update the infoline.
#
# Usage:
# Exec exec $[FVWM_SYSTEMDIR]/scripts(UpdateInfoline delay_in_sec \
#    $[infostore.Fvwm_Crystal_Recipe] $[infostore.Your_Id]

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

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

trap cleanup INT QUIT TERM

# 1 function per recipe with infoline
Amiga() {
    while :
    do
	sleep "$1"
	# fvwm is started with exec; be sure it is running
	pidof fvwm 1>/dev/null || cleanup

	INFOLINE=$(${FVWM_SYSTEMDIR}/scripts/infoline_amiga|sed -e "s:SetEnv FVWM_INFOLINE ::" -e 's:"::g')
	STRING="SendToModule FvwmButtons-TopLogo ChangeButton InfoLine Title \"${2}'s Workbench: ${INFOLINE}\""
	FvwmCommand "${STRING}"
    done
}

SilentHacker() {
    while :
    do
	sleep "$1"
	pidof fvwm 1>/dev/null || cleanup
	INFOLINE=$(fvwm-crystal.infoline|sed -e "s:SetEnv FVWM_INFOLINE ::")
	STRING="SendToModule FvwmButtons-InfoLine ChangeButton InfoLine Title ${INFOLINE}"
	FvwmCommand "${STRING}"
    done
}

# the main loop
RECIPE=$(basename "$2")
case "$RECIPE" in
    Amiga)
	Amiga "$1" "$3";;
    SilentHacker)
	SilentHacker "$1";;
    *)
	FvwmCommand Echo "$RECIPE"
esac