4 # This file is part of the LibreOffice project.
6 # This Source Code Form is subject to the terms of the Mozilla Public
7 # License, v. 2.0. If a copy of the MPL was not distributed with this
8 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 # Watches for formula dumps by starmath and renders them
12 # If starmath is compiled with the macro DEBUG_ENABLE_DUMPASDOT defined.
13 # shift+enter, in the visual formula editor will make starmath dump a
14 # graphviz graph of the formula tree structure. This is very useful when
15 # debugging. The formula is dumped to /tmp/smath-dump.gv-
16 # This script monitors this file and renders the graph when written,
17 # after which the formula is displayed using feh.
19 # Usage: Let this script run in the background, e.g. start it in a terminal
20 # (and don't close the terminal). Then compile starmath with DEBUG_ENABLE_DUMPASDOT
21 # defined, use the visual formula editor to write something and hit shift+enter.
23 # Note: This won't work on Windows as the /tmp/ folder will be missing.
25 # Author: "Jonas Finnemann Jensen" <jopsen@gmail.com>
27 touch /tmp
/smath-dump.gv
;
28 while inotifywait
-q -e close_write
/tmp
/smath-dump.gv
;
30 dot
-Tpng < /tmp
/smath-dump.gv
> /tmp
/smath-dump.png
; > /dev
/null
31 kill `pidof -s feh`; > /dev
/null
32 feh
/tmp
/smath-dump.png
& > /dev
/null