Add a --daemon command-line parameter
When specifying --daemon, calcurse immediately forks and runs the notification daemon in the background. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
parent
d127ce9447
commit
6061fec01d
@ -200,6 +200,10 @@ second form is equivalent to `-Q --filter-type cal --days <num>`.
|
||||
Note: as for the `-a` flag, the calendar from which to read the appointments
|
||||
can be specified using the `-c` flag.
|
||||
|
||||
`--daemon`::
|
||||
Start calcurse in background mode. See <<basics_daemon,Background mode>> for
|
||||
details.
|
||||
|
||||
`--days <num>`::
|
||||
Specify the length of the range (in days) when used with `-Q`. Cannot be
|
||||
combined with `--to`.
|
||||
|
14
src/args.c
14
src/args.c
@ -73,7 +73,8 @@ enum {
|
||||
OPT_LIST_IMPORTED,
|
||||
OPT_EXPORT_UID,
|
||||
OPT_READ_ONLY,
|
||||
OPT_STATUS
|
||||
OPT_STATUS,
|
||||
OPT_DAEMON
|
||||
};
|
||||
|
||||
/*
|
||||
@ -439,7 +440,7 @@ int parse_args(int argc, char **argv)
|
||||
{
|
||||
/* Command-line flags */
|
||||
int grep = 0, grep_filter = 0, query = 0, next = 0;
|
||||
int status = 0, gc = 0, import = 0, export = 0;
|
||||
int status = 0, gc = 0, import = 0, export = 0, daemon = 0;
|
||||
/* Query ranges */
|
||||
time_t from = -1, to = -1;
|
||||
int range = -1;
|
||||
@ -514,6 +515,7 @@ int parse_args(int argc, char **argv)
|
||||
{"list-imported", no_argument, NULL, OPT_LIST_IMPORTED},
|
||||
{"read-only", no_argument, NULL, OPT_READ_ONLY},
|
||||
{"status", no_argument, NULL, OPT_STATUS},
|
||||
{"daemon", no_argument, NULL, OPT_DAEMON},
|
||||
{NULL, no_argument, NULL, 0}
|
||||
};
|
||||
|
||||
@ -730,6 +732,9 @@ int parse_args(int argc, char **argv)
|
||||
case OPT_STATUS:
|
||||
status = 1;
|
||||
break;
|
||||
case OPT_DAEMON:
|
||||
daemon = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
usage_try();
|
||||
@ -741,7 +746,7 @@ int parse_args(int argc, char **argv)
|
||||
if (filter.type_mask == 0)
|
||||
filter.type_mask = TYPE_MASK_ALL;
|
||||
|
||||
if (status + grep + query + next + gc + import + export > 1) {
|
||||
if (status + grep + query + next + gc + import + export + daemon > 1) {
|
||||
ERROR_MSG(_("invalid argument combination"));
|
||||
usage();
|
||||
usage_try();
|
||||
@ -808,6 +813,9 @@ int parse_args(int argc, char **argv)
|
||||
io_check_file(path_todo);
|
||||
io_load_data(&filter);
|
||||
io_export_data(xfmt, export_uid);
|
||||
} else if (daemon) {
|
||||
notify_init_vars();
|
||||
dmon_start(0);
|
||||
} else {
|
||||
/* interactive mode */
|
||||
non_interactive = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user