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