summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-29 14:28:40 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-29 14:28:40 -0300
commit52484fb3b9caff8b8137cb0ecc92db090207c792 (patch)
tree478fa58165c96a84640a8eb3d7308fb418ea4a7e /main.c
parent8ce33e6a9a3ae71ee5837403193cd12ef47ebe0e (diff)
downloadeeshow-52484fb3b9caff8b8137cb0ecc92db090207c792.tar.gz
eeshow-52484fb3b9caff8b8137cb0ecc92db090207c792.tar.bz2
eeshow-52484fb3b9caff8b8137cb0ecc92db090207c792.zip
new option "-E command" to execute commands when the GUI is ready
This is mainly intended for taking screenshots, e.g., with xdotool and xwd.
Diffstat (limited to 'main.c')
-rw-r--r--main.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/main.c b/main.c
index c0f7931..0b6dc74 100644
--- a/main.c
+++ b/main.c
@@ -84,6 +84,9 @@ void usage(const char *name)
" -e show extra information (e.g., pin types)\n"
" -v increase verbosity of diagnostic output\n"
" -C 'cat' the file to standard output\n"
+" -E shell_command ...\n"
+" execute the specified shell command when the GUI is ready.\n"
+" Sets EESHOW_WINDOW_ID to the X11 window ID.\n"
" -H show history of repository on standard output\n"
" -N n limit history to n revisions (unlimited if omitted or 0)\n"
" -S parse S-expressions from stdin and dump to stdout\n"
@@ -129,6 +132,8 @@ int main(int argc, char **argv)
const char *cat = NULL;
const char *history = NULL;
const char *fmt = NULL;
+ const char **commands = NULL;
+ unsigned n_commands = 0;
struct pl_ctx *pl = NULL;
int limit = 0;
char c;
@@ -167,7 +172,7 @@ int main(int argc, char **argv)
if (!have_dashdash)
gtk_init(&argc, &argv);
- while ((c = getopt(dashdash, argv, "1evC:F:H:LN:OPSV")) != EOF)
+ while ((c = getopt(dashdash, argv, "1evC:E:F:H:LN:OPSV")) != EOF)
switch (c) {
case '1':
one_sheet = 1;
@@ -181,6 +186,11 @@ int main(int argc, char **argv)
case 'C':
cat = optarg;
break;
+ case 'E':
+ commands = realloc_type_n(commands, const char *,
+ n_commands + 1);
+ commands[n_commands++] = optarg;
+ break;
case 'F':
fmt = optarg;
break;
@@ -244,7 +254,8 @@ int main(int argc, char **argv)
if (!have_dashdash) {
optind = 0; /* reset getopt */
- return run_gui(&file_names, !one_sheet, limit);
+ return run_gui(&file_names, !one_sheet, limit,
+ commands, n_commands);
}
if (dashdash == argc) {