scripts: add PATH variable
[platform/core/uifw/headless-server.git] / data / scripts / winfo
1 #!/bin/sh
2
3 PATH=/bin:/usr/bin:/sbin:/usr/sbin
4
5 if [ "$XDG_RUNTIME_DIR" = "" ]; then
6         export XDG_RUNTIME_DIR=/run
7 fi
8
9 WINFO_RUN_DIR="$XDG_RUNTIME_DIR/pepper"
10
11 if [ ! -d "$WINFO_RUN_DIR" ]; then
12         echo "Error: no ${WINFO_RUN_DIR} directory exist."
13         exit 1
14 fi
15
16 cd $WINFO_RUN_DIR
17
18 function usage()
19 {
20         echo "Usage> # winfo {command}"
21         echo ""
22         echo "   Supported commands:"
23         echo ""
24         echo "     protocol_trace_on (turn on wayland protocol trace)"
25         echo "     protocol_trace_off (turn off wayland protocol trace)"
26         echo "     stdout (redirect STDOUT to a file : /run/pepper/stdout.txt)"
27         echo "     stderr (redirect STDERR to a file : /run/pepper/stderr.txt)"
28         echo "     keygrab_status"
29         echo "     keymap"
30         echo "     topvwins"
31         echo "     connected_clients (display connected clients info : pid, uid, gid, socket fd)"
32         echo "     reslist (display resources info of the connected clients"
33         echo "     help (display this help message)"
34         echo ""
35         echo "   To execute commands, just create/remove/update a file with the commands above."
36         echo "   Please refer to the following examples."
37         echo ""
38         echo "     # winfo protocol_trace_on   : enable event trace"
39         echo "     # winfo protocol_trace_off  : disable event trace"
40         echo "     # winfo stdout              : redirect STDOUT"
41         echo "     # winfo stderr              : redirect STDERR"
42         echo "     # winfo keygrab_status      : display keygrab status"
43         echo "     # winfo keymap              : display keymap"
44         echo "     # winfo topvwins            : display top/visible window stack"
45         echo "     # winfo connected_clients   : display connected clients information"
46         echo "     # winfo reslist             : display each resources information of connected clients"
47         echo "     # winfo help                : display this help message"
48         echo ""
49 }
50
51 if [ "$1" = "" ]; then
52         usage
53         exit 1
54 fi
55
56 CMD="$1"
57
58 rm -f ${CMD} ; touch ${CMD}
59 echo "winfo ${CMD}"