Display i3-nagbar when commands lead to an error

e.g. pressing Mod1+x when having the following in your configfile:

    bindsym Mod1+x some invalid command

will lead to an i3-nagbar instance popping up, offering you to view the
error log (which will contain parser errors from this commit on).
This commit is contained in:
Michael Stapelberg
2012-08-02 17:43:00 +02:00
parent 9191b56924
commit cc7f16007a
9 changed files with 358 additions and 64 deletions

View File

@ -389,9 +389,9 @@ struct CommandResult *parse_command(const char *input) {
position[(copywalk - input)] = (copywalk >= walk ? '^' : ' ');
position[len] = '\0';
printf("%s\n", errormessage);
printf("Your command: %s\n", input);
printf(" %s\n", position);
ELOG("%s\n", errormessage);
ELOG("Your command: %s\n", input);
ELOG(" %s\n", position);
/* Format this error message as a JSON reply. */
y(map_open);
@ -435,7 +435,15 @@ void debuglog(char *fmt, ...) {
va_list args;
va_start(args, fmt);
fprintf(stderr, "# ");
fprintf(stdout, "# ");
vfprintf(stdout, fmt, args);
va_end(args);
}
void errorlog(char *fmt, ...) {
va_list args;
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
}