File: trigger-3buttons

package info (click to toggle)
libpanel 1.10.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,956 kB
  • sloc: ansic: 19,093; xml: 39; sh: 24; javascript: 13; makefile: 10
file content (37 lines) | stat: -rwxr-xr-x 779 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
set -ex

export GTK_A11Y=NONE

cleanup(){
    kill -9 "$xpid" || :
    rm "$exe" || :
}
trap cleanup 0

exe=$(dirname "$0")/3buttons
#shellcheck disable=SC2046
cc "$exe.c" -o "$exe" $(pkg-config --cflags --libs libpanel-1 gtk4)

#Run program in virtual X framebuffer.
export DISPLAY=:71
Xvfb "$DISPLAY" &
xpid=$!
"$exe" &
pid=$!

#Wait a bit for server to be set up and window, to be mapped
sleep 5
#The panel has merely 3 buttons. Clicking a button destroys that button.
#If 0 buttons exist, the program terminates with 0.
#Therefore, after three <Tab> <Enter>, the program terminates
i=0
nbuttons=3
while [ "$i" -lt "$nbuttons" ]; do
    test -d "/proc/$pid"
    xdotool key Tab Return
    sleep 5
    i=$((i+1))
done
#Confirm the program terminated
! kill -0 "$pid"