3 * vim:ts=4:sw=4:expandtab
14 static pid_t configerror_pid = -1;
16 static Match current_match;
17 static Barconfig current_bar;
18 /* The pattern which was specified by the user, for example -misc-fixed-*. We
19 * store this in a separate variable because in the i3 config struct we just
20 * store the i3Font. */
21 static char *font_pattern;
22 /* The path to the temporary script files used by i3-nagbar. We need to keep
23 * them around to delete the files in the i3-nagbar SIGCHLD handler. */
24 static char *edit_script_path, *pager_script_path;
26 typedef struct yy_buffer_state *YY_BUFFER_STATE;
27 extern int yylex(struct context *context);
28 extern int yyparse(void);
29 extern int yylex_destroy(void);
31 YY_BUFFER_STATE yy_scan_string(const char *);
33 static struct bindings_head *current_bindings;
34 static struct context *context;
36 /* We don’t need yydebug for now, as we got decent error messages using
37 * yyerror(). Should you ever want to extend the parser, it might be handy
38 * to just comment it in again, so it stays here. */
41 void yyerror(const char *error_message) {
42 context->has_errors = true;
45 ELOG("CONFIG: %s\n", error_message);
46 ELOG("CONFIG: in file \"%s\", line %d:\n",
47 context->filename, context->line_number);
48 ELOG("CONFIG: %s\n", context->line_copy);
49 char buffer[context->last_column+1];
50 buffer[context->last_column] = '\0';
51 for (int c = 1; c <= context->last_column; c++)
52 buffer[c-1] = (c >= context->first_column ? '^' : ' ');
53 ELOG("CONFIG: %s\n", buffer);
62 * Goes through each line of buf (separated by \n) and checks for statements /
63 * commands which only occur in i3 v4 configuration files. If it finds any, it
64 * returns version 4, otherwise it returns version 3.
67 static int detect_version(char *buf) {
70 while (*walk != '\0') {
76 /* check for some v4-only statements */
77 if (strncasecmp(line, "bindcode", strlen("bindcode")) == 0 ||
78 strncasecmp(line, "force_focus_wrapping", strlen("force_focus_wrapping")) == 0 ||
79 strncasecmp(line, "# i3 config file (v4)", strlen("# i3 config file (v4)")) == 0 ||
80 strncasecmp(line, "workspace_layout", strlen("workspace_layout")) == 0) {
81 printf("deciding for version 4 due to this line: %.*s\n", (int)(walk-line), line);
85 /* if this is a bind statement, we can check the command */
86 if (strncasecmp(line, "bind", strlen("bind")) == 0) {
87 char *bind = strchr(line, ' ');
90 while ((*bind == ' ' || *bind == '\t') && *bind != '\0')
94 if ((bind = strchr(bind, ' ')) == NULL)
96 while ((*bind == ' ' || *bind == '\t') && *bind != '\0')
100 if (strncasecmp(bind, "layout", strlen("layout")) == 0 ||
101 strncasecmp(bind, "floating", strlen("floating")) == 0 ||
102 strncasecmp(bind, "workspace", strlen("workspace")) == 0 ||
103 strncasecmp(bind, "focus left", strlen("focus left")) == 0 ||
104 strncasecmp(bind, "focus right", strlen("focus right")) == 0 ||
105 strncasecmp(bind, "focus up", strlen("focus up")) == 0 ||
106 strncasecmp(bind, "focus down", strlen("focus down")) == 0 ||
107 strncasecmp(bind, "border normal", strlen("border normal")) == 0 ||
108 strncasecmp(bind, "border 1pixel", strlen("border 1pixel")) == 0 ||
109 strncasecmp(bind, "border borderless", strlen("border borderless")) == 0 ||
110 strncasecmp(bind, "--no-startup-id", strlen("--no-startup-id")) == 0 ||
111 strncasecmp(bind, "bar", strlen("bar")) == 0) {
112 printf("deciding for version 4 due to this line: %.*s\n", (int)(walk-line), line);
118 /* advance to the next line */
127 * Calls i3-migrate-config-to-v4 to migrate a configuration file (input
130 * Returns the converted config file or NULL if there was an error (for
131 * example the script could not be found in $PATH or the i3 executable’s
135 static char *migrate_config(char *input, off_t size) {
139 if (pipe(writepipe) != 0 ||
140 pipe(readpipe) != 0) {
141 warn("migrate_config: Could not create pipes");
147 warn("Could not fork()");
153 /* close writing end of writepipe, connect reading side to stdin */
155 dup2(writepipe[0], 0);
157 /* close reading end of readpipe, connect writing side to stdout */
159 dup2(readpipe[1], 1);
161 static char *argv[] = {
162 NULL, /* will be replaced by the executable path */
165 exec_i3_utility("i3-migrate-config-to-v4", argv);
170 /* close reading end of the writepipe (connected to the script’s stdin) */
173 /* write the whole config file to the pipe, the script will read everything
177 while (written < size) {
178 if ((ret = write(writepipe[1], input + written, size - written)) < 0) {
179 warn("Could not write to pipe");
186 /* close writing end of the readpipe (connected to the script’s stdout) */
189 /* read the script’s output */
190 int conv_size = 65535;
191 char *converted = malloc(conv_size);
194 if (read_bytes == conv_size) {
196 converted = realloc(converted, conv_size);
198 ret = read(readpipe[0], converted + read_bytes, conv_size - read_bytes);
200 warn("Cannot read from pipe");
207 /* get the returncode */
210 if (!WIFEXITED(status)) {
211 fprintf(stderr, "Child did not terminate normally, using old config file (will lead to broken behaviour)\n");
215 int returncode = WEXITSTATUS(status);
216 if (returncode != 0) {
217 fprintf(stderr, "Migration process exit code was != 0\n");
218 if (returncode == 2) {
219 fprintf(stderr, "could not start the migration script\n");
220 /* TODO: script was not found. tell the user to fix his system or create a v4 config */
221 } else if (returncode == 1) {
222 fprintf(stderr, "This already was a v4 config. Please add the following line to your config file:\n");
223 fprintf(stderr, "# i3 config file (v4)\n");
224 /* TODO: nag the user with a message to include a hint for i3 in his config file */
233 * Handler which will be called when we get a SIGCHLD for the nagbar, meaning
234 * it exited (or could not be started, depending on the exit code).
237 static void nagbar_exited(EV_P_ ev_child *watcher, int revents) {
238 ev_child_stop(EV_A_ watcher);
240 if (unlink(edit_script_path) != 0)
241 warn("Could not delete temporary i3-nagbar script %s", edit_script_path);
242 if (unlink(pager_script_path) != 0)
243 warn("Could not delete temporary i3-nagbar script %s", pager_script_path);
245 if (!WIFEXITED(watcher->rstatus)) {
246 fprintf(stderr, "ERROR: i3-nagbar did not exit normally.\n");
250 int exitcode = WEXITSTATUS(watcher->rstatus);
251 printf("i3-nagbar process exited with status %d\n", exitcode);
253 fprintf(stderr, "ERROR: i3-nagbar could not be found. Is it correctly installed on your system?\n");
256 configerror_pid = -1;
259 /* We need ev >= 4 for the following code. Since it is not *that* important (it
260 * only makes sure that there are no i3-nagbar instances left behind) we still
261 * support old systems with libev 3. */
262 #if EV_VERSION_MAJOR >= 4
264 * Cleanup handler. Will be called when i3 exits. Kills i3-nagbar with signal
265 * SIGKILL (9) to make sure there are no left-over i3-nagbar processes.
268 static void nagbar_cleanup(EV_P_ ev_cleanup *watcher, int revent) {
269 if (configerror_pid != -1) {
270 LOG("Sending SIGKILL (9) to i3-nagbar with PID %d\n", configerror_pid);
271 kill(configerror_pid, SIGKILL);
277 * Writes the given command as a shell script to path.
278 * Returns true unless something went wrong.
281 static bool write_nagbar_script(const char *path, const char *command) {
282 int fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IXUSR);
284 warn("Could not create temporary script to store the nagbar command");
287 write(fd, "#!/bin/sh\n", strlen("#!/bin/sh\n"));
288 write(fd, command, strlen(command));
294 * Starts an i3-nagbar process which alerts the user that his configuration
295 * file contains one or more errors. Also offers two buttons: One to launch an
296 * $EDITOR on the config file and another one to launch a $PAGER on the error
300 static void start_configerror_nagbar(const char *config_path) {
301 if (only_check_config)
304 fprintf(stderr, "Starting i3-nagbar due to configuration errors\n");
306 /* We need to create a custom script containing our actual command
307 * since not every terminal emulator which is contained in
308 * i3-sensible-terminal supports -e with multiple arguments (and not
309 * all of them support -e with one quoted argument either).
311 * NB: The paths need to be unique, that is, don’t assume users close
312 * their nagbars at any point in time (and they still need to work).
314 edit_script_path = get_process_filename("nagbar-cfgerror-edit");
315 pager_script_path = get_process_filename("nagbar-cfgerror-pager");
317 configerror_pid = fork();
318 if (configerror_pid == -1) {
319 warn("Could not fork()");
324 if (configerror_pid == 0) {
325 char *edit_command, *pager_command;
326 sasprintf(&edit_command, "i3-sensible-editor \"%s\" && i3-msg reload\n", config_path);
327 sasprintf(&pager_command, "i3-sensible-pager \"%s\"\n", errorfilename);
328 if (!write_nagbar_script(edit_script_path, edit_command) ||
329 !write_nagbar_script(pager_script_path, pager_command))
334 sasprintf(&editaction, "i3-sensible-terminal -e \"%s\"", edit_script_path);
335 sasprintf(&pageraction, "i3-sensible-terminal -e \"%s\"", pager_script_path);
337 NULL, /* will be replaced by the executable path */
339 (context->has_errors ? "error" : "warning"),
341 (context->has_errors ?
342 "You have an error in your i3 config file!" :
343 "Your config is outdated. Please fix the warnings to make sure everything works."),
347 (errorfilename ? "-b" : NULL),
348 (context->has_errors ? "show errors" : "show warnings"),
352 exec_i3_utility("i3-nagbar", argv);
356 /* install a child watcher */
357 ev_child *child = smalloc(sizeof(ev_child));
358 ev_child_init(child, &nagbar_exited, configerror_pid, 0);
359 ev_child_start(main_loop, child);
361 /* We need ev >= 4 for the following code. Since it is not *that* important (it
362 * only makes sure that there are no i3-nagbar instances left behind) we still
363 * support old systems with libev 3. */
364 #if EV_VERSION_MAJOR >= 4
365 /* install a cleanup watcher (will be called when i3 exits and i3-nagbar is
367 ev_cleanup *cleanup = smalloc(sizeof(ev_cleanup));
368 ev_cleanup_init(cleanup, nagbar_cleanup);
369 ev_cleanup_start(main_loop, cleanup);
374 * Kills the configerror i3-nagbar process, if any.
376 * Called when reloading/restarting.
378 * If wait_for_it is set (restarting), this function will waitpid(), otherwise,
379 * ev is assumed to handle it (reloading).
382 void kill_configerror_nagbar(bool wait_for_it) {
383 if (configerror_pid == -1)
386 if (kill(configerror_pid, SIGTERM) == -1)
387 warn("kill(configerror_nagbar) failed");
392 /* When restarting, we don’t enter the ev main loop anymore and after the
393 * exec(), our old pid is no longer watched. So, ev won’t handle SIGCHLD
394 * for us and we would end up with a <defunct> process. Therefore we
396 waitpid(configerror_pid, NULL, 0);
400 * Checks for duplicate key bindings (the same keycode or keysym is configured
401 * more than once). If a duplicate binding is found, a message is printed to
402 * stderr and the has_errors variable is set to true, which will start
406 static void check_for_duplicate_bindings(struct context *context) {
407 Binding *bind, *current;
408 TAILQ_FOREACH(current, bindings, bindings) {
409 TAILQ_FOREACH(bind, bindings, bindings) {
410 /* Abort when we reach the current keybinding, only check the
415 /* Check if one is using keysym while the other is using bindsym.
417 /* XXX: It should be checked at a later place (when translating the
418 * keysym to keycodes) if there are any duplicates */
419 if ((bind->symbol == NULL && current->symbol != NULL) ||
420 (bind->symbol != NULL && current->symbol == NULL))
423 /* If bind is NULL, current has to be NULL, too (see above).
424 * If the keycodes differ, it can't be a duplicate. */
425 if (bind->symbol != NULL &&
426 strcasecmp(bind->symbol, current->symbol) != 0)
429 /* Check if the keycodes or modifiers are different. If so, they
430 * can't be duplicate */
431 if (bind->keycode != current->keycode ||
432 bind->mods != current->mods)
434 context->has_errors = true;
435 if (current->keycode != 0) {
436 ELOG("Duplicate keybinding in config file:\n modmask %d with keycode %d, command \"%s\"\n",
437 current->mods, current->keycode, current->command);
439 ELOG("Duplicate keybinding in config file:\n modmask %d with keysym %s, command \"%s\"\n",
440 current->mods, current->symbol, current->command);
446 static void migrate_i3bar_exec(struct Autostart *exec) {
447 ELOG("**********************************************************************\n");
448 ELOG("IGNORING exec command: %s\n", exec->command);
449 ELOG("It contains \"i3bar\". Since i3 v4.1, i3bar will be automatically started\n");
450 ELOG("for each 'bar' configuration block in your i3 config. Please remove the exec\n");
451 ELOG("line and add the following to your i3 config:\n");
454 ELOG(" status_command i3status\n");
456 ELOG("**********************************************************************\n");
458 /* Generate a dummy bar configuration */
459 Barconfig *bar_config = scalloc(sizeof(Barconfig));
460 /* The hard-coded ID is not a problem. It does not conflict with the
461 * auto-generated bar IDs and having multiple hard-coded IDs is irrelevant
462 * – they all just contain status_command = i3status */
463 bar_config->id = sstrdup("migrate-bar");
464 bar_config->status_command = sstrdup("i3status");
465 TAILQ_INSERT_TAIL(&barconfigs, bar_config, configs);
467 /* Trigger an i3-nagbar */
468 context->has_warnings = true;
471 void parse_file(const char *f) {
472 SLIST_HEAD(variables_head, Variable) variables = SLIST_HEAD_INITIALIZER(&variables);
473 int fd, ret, read_bytes = 0;
477 char buffer[1026], key[512], value[512];
479 if ((fd = open(f, O_RDONLY)) == -1)
480 die("Could not open configuration file: %s\n", strerror(errno));
482 if (fstat(fd, &stbuf) == -1)
483 die("Could not fstat file: %s\n", strerror(errno));
485 buf = scalloc((stbuf.st_size + 1) * sizeof(char));
486 while (read_bytes < stbuf.st_size) {
487 if ((ret = read(fd, buf + read_bytes, (stbuf.st_size - read_bytes))) < 0)
488 die("Could not read(): %s\n", strerror(errno));
492 if (lseek(fd, 0, SEEK_SET) == (off_t)-1)
493 die("Could not lseek: %s\n", strerror(errno));
495 if ((fstr = fdopen(fd, "r")) == NULL)
496 die("Could not fdopen: %s\n", strerror(errno));
498 while (!feof(fstr)) {
499 if (fgets(buffer, 1024, fstr) == NULL) {
502 die("Could not read configuration file\n");
505 /* sscanf implicitly strips whitespace. Also, we skip comments and empty lines. */
506 if (sscanf(buffer, "%s %[^\n]", key, value) < 1 ||
507 key[0] == '#' || strlen(key) < 3)
510 if (strcasecmp(key, "set") == 0) {
511 if (value[0] != '$') {
512 ELOG("Malformed variable assignment, name has to start with $\n");
516 /* get key/value for this variable */
517 char *v_key = value, *v_value;
518 if (strstr(value, " ") == NULL && strstr(value, "\t") == NULL) {
519 ELOG("Malformed variable assignment, need a value\n");
523 if (!(v_value = strstr(value, " ")))
524 v_value = strstr(value, "\t");
527 while (*v_value == '\t' || *v_value == ' ')
530 struct Variable *new = scalloc(sizeof(struct Variable));
531 new->key = sstrdup(v_key);
532 new->value = sstrdup(v_value);
533 SLIST_INSERT_HEAD(&variables, new, variables);
534 DLOG("Got new variable %s = %s\n", v_key, v_value);
540 /* For every custom variable, see how often it occurs in the file and
541 * how much extra bytes it requires when replaced. */
542 struct Variable *current, *nearest;
544 /* We need to copy the buffer because we need to invalidate the
545 * variables (otherwise we will count them twice, which is bad when
546 * 'extra' is negative) */
547 char *bufcopy = sstrdup(buf);
548 SLIST_FOREACH(current, &variables, variables) {
549 int extra = (strlen(current->value) - strlen(current->key));
552 next < (bufcopy + stbuf.st_size) &&
553 (next = strcasestr(next, current->key)) != NULL;
554 next += strlen(current->key)) {
556 extra_bytes += extra;
561 /* Then, allocate a new buffer and copy the file over to the new one,
562 * but replace occurences of our variables */
563 char *walk = buf, *destwalk;
564 char *new = smalloc((stbuf.st_size + extra_bytes + 1) * sizeof(char));
566 while (walk < (buf + stbuf.st_size)) {
567 /* Find the next variable */
568 SLIST_FOREACH(current, &variables, variables)
569 current->next_match = strcasestr(walk, current->key);
571 int distance = stbuf.st_size;
572 SLIST_FOREACH(current, &variables, variables) {
573 if (current->next_match == NULL)
575 if ((current->next_match - walk) < distance) {
576 distance = (current->next_match - walk);
580 if (nearest == NULL) {
581 /* If there are no more variables, we just copy the rest */
582 strncpy(destwalk, walk, (buf + stbuf.st_size) - walk);
583 destwalk += (buf + stbuf.st_size) - walk;
587 /* Copy until the next variable, then copy its value */
588 strncpy(destwalk, walk, distance);
589 strncpy(destwalk + distance, nearest->value, strlen(nearest->value));
590 walk += distance + strlen(nearest->key);
591 destwalk += distance + strlen(nearest->value);
595 /* analyze the string to find out whether this is an old config file (3.x)
596 * or a new config file (4.x). If it’s old, we run the converter script. */
597 int version = detect_version(buf);
599 /* We need to convert this v3 configuration */
600 char *converted = migrate_config(new, stbuf.st_size);
601 if (converted != NULL) {
603 ELOG("****************************************************************\n");
604 ELOG("NOTE: Automatically converted configuration file from v3 to v4.\n");
606 ELOG("Please convert your config file to v4. You can use this command:\n");
607 ELOG(" mv %s %s.O\n", f, f);
608 ELOG(" i3-migrate-config-to-v4 %s.O > %s\n", f, f);
609 ELOG("****************************************************************\n");
615 printf("**********************************************************************\n");
616 printf("ERROR: Could not convert config file. Maybe i3-migrate-config-to-v4\n");
617 printf("was not correctly installed on your system?\n");
618 printf("**********************************************************************\n");
623 /* now lex/parse it */
626 context = scalloc(sizeof(struct context));
627 context->filename = f;
629 if (yyparse() != 0) {
630 fprintf(stderr, "Could not parse configfile\n");
634 check_for_duplicate_bindings(context);
636 /* XXX: The following code will be removed in i3 v4.3 (three releases from
637 * now, as of 2011-10-22) */
638 /* Check for any exec or exec_always lines starting i3bar. We remove these
639 * and add a bar block instead. Additionally, a i3-nagbar warning (not an
640 * error) will be displayed so that users update their config file. */
641 struct Autostart *exec, *next;
642 for (exec = TAILQ_FIRST(&autostarts); exec; ) {
643 next = TAILQ_NEXT(exec, autostarts);
644 if (strstr(exec->command, "i3bar") != NULL) {
645 migrate_i3bar_exec(exec);
646 TAILQ_REMOVE(&autostarts, exec, autostarts);
651 for (exec = TAILQ_FIRST(&autostarts_always); exec; ) {
652 next = TAILQ_NEXT(exec, autostarts_always);
653 if (strstr(exec->command, "i3bar") != NULL) {
654 migrate_i3bar_exec(exec);
655 TAILQ_REMOVE(&autostarts_always, exec, autostarts_always);
660 if (context->has_errors || context->has_warnings) {
661 ELOG("FYI: You are using i3 version " I3_VERSION "\n");
663 ELOG("Please convert your configfile first, then fix any remaining errors (see above).\n");
664 start_configerror_nagbar(f);
668 FREE(context->line_copy);
674 while (!SLIST_EMPTY(&variables)) {
675 current = SLIST_FIRST(&variables);
677 FREE(current->value);
678 SLIST_REMOVE_HEAD(&variables, variables);
686 %lex-param { struct context *context }
691 uint32_t *single_color;
692 struct Colortriple *color;
694 struct Binding *binding;
697 %token <number> NUMBER "<number>"
698 %token <string> WORD "<word>"
699 %token <string> STR "<string>"
700 %token <string> STR_NG "<string (non-greedy)>"
701 %token <string> HEXCOLOR "#<hex>"
702 %token <string> OUTPUT "<RandR output>"
705 %token TOKCOMMENT "<comment>"
706 %token TOKFONT "font"
707 %token TOKBINDSYM "bindsym"
708 %token <number> MODIFIER "<modifier>"
709 %token TOKCONTROL "control"
710 %token TOKSHIFT "shift"
711 %token TOKFLOATING_MODIFIER "floating_modifier"
712 %token TOKFLOATING_MAXIMUM_SIZE "floating_maximum_size"
713 %token TOKFLOATING_MINIMUM_SIZE "floating_minimum_size"
714 %token <string> QUOTEDSTRING "<quoted string>"
715 %token TOKWORKSPACE "workspace"
716 %token TOKOUTPUT "output"
717 %token TOKASSIGN "assign"
719 %token TOKIPCSOCKET "ipc_socket"
720 %token TOKRESTARTSTATE "restart_state"
721 %token TOKEXEC "exec"
722 %token TOKEXEC_ALWAYS "exec_always"
723 %token <single_color> TOKSINGLECOLOR
724 %token <color> TOKCOLOR
726 %token TOKMODE "mode"
728 %token TOK_ORIENTATION "default_orientation"
729 %token TOK_HORIZ "horizontal"
730 %token TOK_VERT "vertical"
731 %token TOK_AUTO "auto"
732 %token TOK_WORKSPACE_LAYOUT "workspace_layout"
733 %token TOKNEWWINDOW "new_window"
734 %token TOKNEWFLOAT "new_float"
735 %token TOK_NORMAL "normal"
736 %token TOK_NONE "none"
737 %token TOK_1PIXEL "1pixel"
738 %token TOK_HIDE_EDGE_BORDERS "hide_edge_borders"
739 %token TOKFOCUSFOLLOWSMOUSE "focus_follows_mouse"
740 %token TOK_FORCE_FOCUS_WRAPPING "force_focus_wrapping"
741 %token TOK_FORCE_XINERAMA "force_xinerama"
742 %token TOK_FAKE_OUTPUTS "fake_outputs"
743 %token TOK_WORKSPACE_AUTO_BAF "workspace_auto_back_and_forth"
744 %token TOKWORKSPACEBAR "workspace_bar"
745 %token TOK_DEFAULT "default"
746 %token TOK_STACKING "stacking"
747 %token TOK_TABBED "tabbed"
748 %token <number> TOKSTACKLIMIT "stack-limit"
749 %token TOK_POPUP_DURING_FULLSCREEN "popup_during_fullscreen"
750 %token TOK_IGNORE "ignore"
751 %token TOK_LEAVE_FULLSCREEN "leave_fullscreen"
752 %token TOK_FOR_WINDOW "for_window"
754 %token TOK_BAR_OUTPUT "output (bar)"
755 %token TOK_BAR_TRAY_OUTPUT "tray_output"
756 %token TOK_BAR_SOCKET_PATH "socket_path"
757 %token TOK_BAR_MODE "mode (bar)"
758 %token TOK_BAR_HIDE "hide"
759 %token TOK_BAR_DOCK "dock"
760 %token TOK_BAR_MODIFIER "modifier (bar)"
761 %token TOK_BAR_CONTROL "shift (bar)"
762 %token TOK_BAR_SHIFT "control (bar)"
763 %token TOK_BAR_MOD1 "Mod1"
764 %token TOK_BAR_MOD2 "Mod2"
765 %token TOK_BAR_MOD3 "Mod3"
766 %token TOK_BAR_MOD4 "Mod4"
767 %token TOK_BAR_MOD5 "Mod5"
768 %token TOK_BAR_POSITION "position"
769 %token TOK_BAR_BOTTOM "bottom"
770 %token TOK_BAR_TOP "top"
771 %token TOK_BAR_STATUS_COMMAND "status_command"
772 %token TOK_BAR_I3BAR_COMMAND "i3bar_command"
773 %token TOK_BAR_FONT "font (bar)"
774 %token TOK_BAR_WORKSPACE_BUTTONS "workspace_buttons"
775 %token TOK_BAR_VERBOSE "verbose"
776 %token TOK_BAR_COLORS "colors"
777 %token TOK_BAR_COLOR_BACKGROUND "background"
778 %token TOK_BAR_COLOR_STATUSLINE "statusline"
779 %token TOK_BAR_COLOR_FOCUSED_WORKSPACE "focused_workspace"
780 %token TOK_BAR_COLOR_ACTIVE_WORKSPACE "active_workspace"
781 %token TOK_BAR_COLOR_INACTIVE_WORKSPACE "inactive_workspace"
782 %token TOK_BAR_COLOR_URGENT_WORKSPACE "urgent_workspace"
783 %token TOK_NO_STARTUP_ID "--no-startup-id"
785 %token TOK_MARK "mark"
786 %token TOK_CLASS "class"
787 %token TOK_INSTANCE "instance"
788 %token TOK_WINDOW_ROLE "window_role"
790 %token TOK_CON_ID "con_id"
791 %token TOK_TITLE "title"
792 %token TOK_URGENT "urgent"
794 %type <binding> binding
795 %type <binding> bindcode
796 %type <binding> bindsym
797 %type <number> binding_modifiers
798 %type <number> binding_modifier
799 %type <number> direction
800 %type <number> layout_mode
801 %type <number> border_style
802 %type <number> new_window
803 %type <number> new_float
804 %type <number> colorpixel
806 %type <number> popup_setting
807 %type <number> bar_position_position
808 %type <number> bar_mode_mode
809 %type <number> bar_modifier_modifier
810 %type <number> optional_no_startup_id
811 %type <string> command
812 %type <string> word_or_number
813 %type <string> qstring_or_number
814 %type <string> optional_workspace_name
815 %type <string> workspace_name
816 %type <string> window_class
830 | floating_maximum_size
831 | floating_minimum_size
838 | focus_follows_mouse
839 | force_focus_wrapping
842 | workspace_back_and_forth
855 | popup_during_fullscreen
869 TAILQ_INSERT_TAIL(bindings, $1, bindings);
874 TOKBINDCODE bindcode { $$ = $2; }
875 | TOKBINDSYM bindsym { $$ = $2; }
879 binding_modifiers NUMBER command
881 printf("\tFound keycode binding mod%d with key %d and command %s\n", $1, $2, $3);
882 Binding *new = scalloc(sizeof(Binding));
893 binding_modifiers word_or_number command
895 printf("\tFound keysym binding mod%d with key %s and command %s\n", $1, $2, $3);
896 Binding *new = scalloc(sizeof(Binding));
907 TOK_FOR_WINDOW match command
909 if (match_is_empty(¤t_match)) {
910 ELOG("Match is empty, ignoring this for_window statement\n");
913 printf("\t should execute command %s for the criteria mentioned above\n", $3);
914 Assignment *assignment = scalloc(sizeof(Assignment));
915 assignment->type = A_COMMAND;
916 assignment->match = current_match;
917 assignment->dest.command = $3;
918 TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
923 | matchstart criteria matchend
925 printf("match parsed\n");
933 match_init(¤t_match);
940 printf("match specification finished\n");
952 printf("criteria: class = %s\n", $3);
953 current_match.class = regex_new($3);
956 | TOK_INSTANCE '=' STR
958 printf("criteria: instance = %s\n", $3);
959 current_match.instance = regex_new($3);
962 | TOK_WINDOW_ROLE '=' STR
964 printf("criteria: window_role = %s\n", $3);
965 current_match.role = regex_new($3);
970 printf("criteria: id = %s\n", $3);
972 long parsed = strtol($3, &end, 10);
973 if (parsed == LONG_MIN ||
974 parsed == LONG_MAX ||
976 (end && *end != '\0')) {
977 ELOG("Could not parse con id \"%s\"\n", $3);
979 current_match.con_id = (Con*)parsed;
980 printf("id as int = %p\n", current_match.con_id);
985 printf("criteria: window id = %s\n", $3);
987 long parsed = strtol($3, &end, 10);
988 if (parsed == LONG_MIN ||
989 parsed == LONG_MAX ||
991 (end && *end != '\0')) {
992 ELOG("Could not parse window id \"%s\"\n", $3);
994 current_match.id = parsed;
995 printf("window id as int = %d\n", current_match.id);
1000 printf("criteria: mark = %s\n", $3);
1001 current_match.mark = regex_new($3);
1006 printf("criteria: title = %s\n", $3);
1007 current_match.title = regex_new($3);
1010 | TOK_URGENT '=' STR
1012 printf("criteria: urgent = %s\n", $3);
1013 if (strcasecmp($3, "latest") == 0 ||
1014 strcasecmp($3, "newest") == 0 ||
1015 strcasecmp($3, "recent") == 0 ||
1016 strcasecmp($3, "last") == 0) {
1017 current_match.urgent = U_LATEST;
1018 } else if (strcasecmp($3, "oldest") == 0 ||
1019 strcasecmp($3, "first") == 0) {
1020 current_match.urgent = U_OLDEST;
1028 | NUMBER { sasprintf(&$$, "%d", $1); }
1035 sasprintf(&$$, "%d", $1);
1040 TOKMODE QUOTEDSTRING '{' modelines '}'
1042 if (strcasecmp($2, "default") == 0) {
1043 printf("You cannot use the name \"default\" for your mode\n");
1046 printf("\t now in mode %s\n", $2);
1047 printf("\t current bindings = %p\n", current_bindings);
1049 TAILQ_FOREACH(binding, current_bindings, bindings) {
1050 printf("got binding on mods %d, keycode %d, symbol %s, command %s\n",
1051 binding->mods, binding->keycode, binding->symbol, binding->command);
1054 struct Mode *mode = scalloc(sizeof(struct Mode));
1056 mode->bindings = current_bindings;
1057 current_bindings = NULL;
1058 SLIST_INSERT_HEAD(&modes, mode, modes);
1065 | modelines modeline
1072 if (current_bindings == NULL) {
1073 current_bindings = scalloc(sizeof(struct bindings_head));
1074 TAILQ_INIT(current_bindings);
1077 TAILQ_INSERT_TAIL(current_bindings, $1, bindings);
1082 TOK_BAR '{' barlines '}'
1084 printf("\t new bar configuration finished, saving.\n");
1085 /* Generate a unique ID for this bar */
1086 current_bar.id = sstrdup("bar-XXXXXX");
1087 /* This works similar to mktemp in that it replaces the last six X with
1088 * random letters, but without the restriction that the given buffer
1089 * has to contain a valid path name. */
1090 char *x = current_bar.id + strlen("bar-");
1091 while (*x != '\0') {
1092 *(x++) = (rand() % 26) + 'a';
1095 /* If no font was explicitly set, we use the i3 font as default */
1096 if (!current_bar.font && font_pattern)
1097 current_bar.font = sstrdup(font_pattern);
1099 /* Copy the current (static) structure into a dynamically allocated
1100 * one, then cleanup our static one. */
1101 Barconfig *bar_config = scalloc(sizeof(Barconfig));
1102 memcpy(bar_config, ¤t_bar, sizeof(Barconfig));
1103 TAILQ_INSERT_TAIL(&barconfigs, bar_config, configs);
1105 memset(¤t_bar, '\0', sizeof(Barconfig));
1116 | bar_status_command
1124 | bar_workspace_buttons
1128 | bar_color_background
1129 | bar_color_statusline
1130 | bar_color_focused_workspace
1131 | bar_color_active_workspace
1132 | bar_color_inactive_workspace
1133 | bar_color_urgent_workspace
1137 TOK_BAR_STATUS_COMMAND STR
1139 DLOG("should add status command %s\n", $2);
1140 FREE(current_bar.status_command);
1141 current_bar.status_command = $2;
1146 TOK_BAR_I3BAR_COMMAND STR
1148 DLOG("should add i3bar_command %s\n", $2);
1149 FREE(current_bar.i3bar_command);
1150 current_bar.i3bar_command = $2;
1157 DLOG("bar output %s\n", $2);
1158 int new_outputs = current_bar.num_outputs + 1;
1159 current_bar.outputs = srealloc(current_bar.outputs, sizeof(char*) * new_outputs);
1160 current_bar.outputs[current_bar.num_outputs] = $2;
1161 current_bar.num_outputs = new_outputs;
1166 TOK_BAR_TRAY_OUTPUT STR
1168 DLOG("tray %s\n", $2);
1169 FREE(current_bar.tray_output);
1170 current_bar.tray_output = $2;
1175 TOK_BAR_POSITION bar_position_position
1177 DLOG("position %d\n", $2);
1178 current_bar.position = $2;
1182 bar_position_position:
1183 TOK_BAR_TOP { $$ = P_TOP; }
1184 | TOK_BAR_BOTTOM { $$ = P_BOTTOM; }
1188 TOK_BAR_MODE bar_mode_mode
1190 DLOG("mode %d\n", $2);
1191 current_bar.mode = $2;
1196 TOK_BAR_HIDE { $$ = M_HIDE; }
1197 | TOK_BAR_DOCK { $$ = M_DOCK; }
1201 TOK_BAR_MODIFIER bar_modifier_modifier
1203 DLOG("modifier %d\n", $2);
1204 current_bar.modifier = $2;
1207 bar_modifier_modifier:
1208 TOK_BAR_CONTROL { $$ = M_CONTROL; }
1209 | TOK_BAR_SHIFT { $$ = M_SHIFT; }
1210 | TOK_BAR_MOD1 { $$ = M_MOD1; }
1211 | TOK_BAR_MOD2 { $$ = M_MOD2; }
1212 | TOK_BAR_MOD3 { $$ = M_MOD3; }
1213 | TOK_BAR_MOD4 { $$ = M_MOD4; }
1214 | TOK_BAR_MOD5 { $$ = M_MOD5; }
1220 DLOG("font %s\n", $2);
1221 FREE(current_bar.font);
1222 current_bar.font = $2;
1226 bar_workspace_buttons:
1227 TOK_BAR_WORKSPACE_BUTTONS bool
1229 DLOG("workspace_buttons = %d\n", $2);
1230 /* We store this inverted to make the default setting right when
1231 * initializing the struct with zero. */
1232 current_bar.hide_workspace_buttons = !($2);
1237 TOK_BAR_VERBOSE bool
1239 DLOG("verbose = %d\n", $2);
1240 current_bar.verbose = $2;
1245 TOK_BAR_SOCKET_PATH STR
1247 DLOG("socket_path = %s\n", $2);
1248 FREE(current_bar.socket_path);
1249 current_bar.socket_path = $2;
1254 TOK_BAR_COLORS '{' barlines '}'
1256 /* At the moment, the TOK_BAR_COLORS token is only to make the config
1257 * friendlier for humans. We might change this in the future if it gets
1262 bar_color_background:
1263 TOK_BAR_COLOR_BACKGROUND HEXCOLOR
1265 DLOG("background = %s\n", $2);
1266 current_bar.colors.background = $2;
1270 bar_color_statusline:
1271 TOK_BAR_COLOR_STATUSLINE HEXCOLOR
1273 DLOG("statusline = %s\n", $2);
1274 current_bar.colors.statusline = $2;
1278 bar_color_focused_workspace:
1279 TOK_BAR_COLOR_FOCUSED_WORKSPACE HEXCOLOR HEXCOLOR
1281 /* Old syntax: text / background */
1282 DLOG("focused_ws = %s, %s (old)\n", $2, $3);
1283 current_bar.colors.focused_workspace_bg = $3;
1284 current_bar.colors.focused_workspace_text = $2;
1286 | TOK_BAR_COLOR_FOCUSED_WORKSPACE HEXCOLOR HEXCOLOR HEXCOLOR
1288 /* New syntax: border / background / text */
1289 DLOG("focused_ws = %s, %s and %s\n", $2, $3, $4);
1290 current_bar.colors.focused_workspace_border = $2;
1291 current_bar.colors.focused_workspace_bg = $3;
1292 current_bar.colors.focused_workspace_text = $4;
1296 bar_color_active_workspace:
1297 TOK_BAR_COLOR_ACTIVE_WORKSPACE HEXCOLOR HEXCOLOR
1299 /* Old syntax: text / background */
1300 DLOG("active_ws = %s, %s (old)\n", $2, $3);
1301 current_bar.colors.active_workspace_bg = $3;
1302 current_bar.colors.active_workspace_text = $2;
1304 | TOK_BAR_COLOR_ACTIVE_WORKSPACE HEXCOLOR HEXCOLOR HEXCOLOR
1306 /* New syntax: border / background / text */
1307 DLOG("active_ws = %s, %s and %s\n", $2, $3, $4);
1308 current_bar.colors.active_workspace_border = $2;
1309 current_bar.colors.active_workspace_bg = $3;
1310 current_bar.colors.active_workspace_text = $4;
1314 bar_color_inactive_workspace:
1315 TOK_BAR_COLOR_INACTIVE_WORKSPACE HEXCOLOR HEXCOLOR
1317 /* Old syntax: text / background */
1318 DLOG("inactive_ws = %s, %s (old)\n", $2, $3);
1319 current_bar.colors.inactive_workspace_bg = $3;
1320 current_bar.colors.inactive_workspace_text = $2;
1322 | TOK_BAR_COLOR_INACTIVE_WORKSPACE HEXCOLOR HEXCOLOR HEXCOLOR
1324 DLOG("inactive_ws = %s, %s and %s\n", $2, $3, $4);
1325 current_bar.colors.inactive_workspace_border = $2;
1326 current_bar.colors.inactive_workspace_bg = $3;
1327 current_bar.colors.inactive_workspace_text = $4;
1331 bar_color_urgent_workspace:
1332 TOK_BAR_COLOR_URGENT_WORKSPACE HEXCOLOR HEXCOLOR
1334 /* Old syntax: text / background */
1335 DLOG("urgent_ws = %s, %s (old)\n", $2, $3);
1336 current_bar.colors.urgent_workspace_bg = $3;
1337 current_bar.colors.urgent_workspace_text = $2;
1339 | TOK_BAR_COLOR_URGENT_WORKSPACE HEXCOLOR HEXCOLOR HEXCOLOR
1341 DLOG("urgent_ws = %s, %s and %s\n", $2, $3, $4);
1342 current_bar.colors.urgent_workspace_border = $2;
1343 current_bar.colors.urgent_workspace_bg = $3;
1344 current_bar.colors.urgent_workspace_text = $4;
1348 floating_maximum_size:
1349 TOKFLOATING_MAXIMUM_SIZE NUMBER WORD NUMBER
1351 printf("floating_maximum_width = %d\n", $2);
1352 printf("floating_maximum_height = %d\n", $4);
1353 config.floating_maximum_width = $2;
1354 config.floating_maximum_height = $4;
1358 floating_minimum_size:
1359 TOKFLOATING_MINIMUM_SIZE NUMBER WORD NUMBER
1361 printf("floating_minimum_width = %d\n", $2);
1362 printf("floating_minimum_height = %d\n", $4);
1363 config.floating_minimum_width = $2;
1364 config.floating_minimum_height = $4;
1369 TOKFLOATING_MODIFIER binding_modifiers
1371 DLOG("floating modifier = %d\n", $2);
1372 config.floating_modifier = $2;
1377 TOK_ORIENTATION direction
1379 DLOG("New containers should start with split direction %d\n", $2);
1380 config.default_orientation = $2;
1385 TOK_HORIZ { $$ = HORIZ; }
1386 | TOK_VERT { $$ = VERT; }
1387 | TOK_AUTO { $$ = NO_ORIENTATION; }
1391 TOK_WORKSPACE_LAYOUT layout_mode
1393 DLOG("new containers will be in mode %d\n", $2);
1394 config.default_layout = $2;
1397 /* We also need to change the layout of the already existing
1398 * workspaces here. Workspaces may exist at this point because
1399 * of the other directives which are modifying workspaces
1400 * (setting the preferred screen or name). While the workspace
1401 * objects are already created, they have never been used.
1402 * Thus, the user very likely awaits the default container mode
1403 * to trigger in this case, regardless of where it is inside
1404 * his configuration file. */
1406 TAILQ_FOREACH(ws, workspaces, workspaces) {
1407 if (ws->table == NULL)
1409 switch_layout_mode(global_conn,
1411 config.container_mode);
1415 | TOK_WORKSPACE_LAYOUT TOKSTACKLIMIT TOKSTACKLIMIT NUMBER
1417 DLOG("stack-limit %d with val %d\n", $3, $4);
1418 config.container_stack_limit = $3;
1419 config.container_stack_limit_value = $4;
1422 /* See the comment above */
1424 TAILQ_FOREACH(ws, workspaces, workspaces) {
1425 if (ws->table == NULL)
1427 Container *con = ws->table[0][0];
1428 con->stack_limit = config.container_stack_limit;
1429 con->stack_limit_value = config.container_stack_limit_value;
1436 TOK_DEFAULT { $$ = L_DEFAULT; }
1437 | TOK_STACKING { $$ = L_STACKED; }
1438 | TOK_TABBED { $$ = L_TABBED; }
1442 TOKNEWWINDOW border_style
1444 DLOG("new windows should start with border style %d\n", $2);
1445 config.default_border = $2;
1450 TOKNEWFLOAT border_style
1452 DLOG("new floating windows should start with border style %d\n", $2);
1453 config.default_floating_border = $2;
1458 TOK_NORMAL { $$ = BS_NORMAL; }
1459 | TOK_NONE { $$ = BS_NONE; }
1460 | TOK_1PIXEL { $$ = BS_1PIXEL; }
1470 DLOG("checking word \"%s\"\n", $1);
1471 $$ = (strcasecmp($1, "yes") == 0 ||
1472 strcasecmp($1, "true") == 0 ||
1473 strcasecmp($1, "on") == 0 ||
1474 strcasecmp($1, "enable") == 0 ||
1475 strcasecmp($1, "active") == 0);
1480 TOK_HIDE_EDGE_BORDERS bool
1482 DLOG("hide edge borders = %d\n", $2);
1483 config.hide_edge_borders = $2;
1487 focus_follows_mouse:
1488 TOKFOCUSFOLLOWSMOUSE bool
1490 DLOG("focus follows mouse = %d\n", $2);
1491 config.disable_focus_follows_mouse = !($2);
1495 force_focus_wrapping:
1496 TOK_FORCE_FOCUS_WRAPPING bool
1498 DLOG("force focus wrapping = %d\n", $2);
1499 config.force_focus_wrapping = $2;
1504 TOK_FORCE_XINERAMA bool
1506 DLOG("force xinerama = %d\n", $2);
1507 config.force_xinerama = $2;
1512 TOK_FAKE_OUTPUTS STR
1514 DLOG("fake outputs = %s\n", $2);
1515 config.fake_outputs = $2;
1519 workspace_back_and_forth:
1520 TOK_WORKSPACE_AUTO_BAF bool
1522 DLOG("automatic workspace back-and-forth = %d\n", $2);
1523 config.workspace_auto_back_and_forth = $2;
1528 TOKWORKSPACEBAR bool
1530 DLOG("workspace bar = %d\n", $2);
1531 config.disable_workspace_bar = !($2);
1536 TOKWORKSPACE qstring_or_number TOKOUTPUT OUTPUT optional_workspace_name
1541 ELOG("The old (v3) syntax workspace <number> output <output> <name> is deprecated.\n");
1542 ELOG("Please use the new syntax: workspace \"<workspace>\" output <output>\n");
1543 ELOG("In your case, the following should work:\n");
1544 ELOG(" workspace \"%s\" output %s\n", $5, $4);
1546 context->has_warnings = true;
1549 DLOG("Assigning workspace \"%s\" to output \"%s\"\n", ws_name, $4);
1550 /* Check for earlier assignments of the same workspace so that we
1551 * don’t have assignments of a single workspace to different
1553 struct Workspace_Assignment *assignment;
1554 bool duplicate = false;
1555 TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
1556 if (strcasecmp(assignment->name, ws_name) == 0) {
1557 ELOG("You have a duplicate workspace assignment for workspace \"%s\"\n",
1559 assignment->output = $4;
1564 assignment = scalloc(sizeof(struct Workspace_Assignment));
1565 assignment->name = ws_name;
1566 assignment->output = $4;
1567 TAILQ_INSERT_TAIL(&ws_assignments, assignment, ws_assignments);
1570 | TOKWORKSPACE NUMBER workspace_name
1574 DLOG("Invalid workspace assignment, workspace number %d out of range\n", ws_num);
1576 DLOG("workspace name to: %s\n", $3);
1578 if ($<string>3 != NULL) {
1579 workspace_set_name(workspace_get(ws_num - 1), $<string>3);
1587 optional_workspace_name:
1588 /* empty */ { $$ = NULL; }
1589 | workspace_name { $$ = $1; }
1593 QUOTEDSTRING { $$ = $1; }
1599 TOKASSIGN window_class STR
1601 /* This is the old, deprecated form of assignments. It’s provided for
1602 * compatibility in version (4.1, 4.2, 4.3) and will be removed
1603 * afterwards. It triggers an i3-nagbar warning starting from 4.1. */
1604 ELOG("You are using the old assign syntax (without criteria). "
1605 "Please see the User's Guide for the new syntax and fix "
1606 "your config file.\n");
1607 context->has_warnings = true;
1608 printf("assignment of %s to *%s*\n", $2, $3);
1609 char *workspace = $3;
1610 char *criteria = $2;
1612 Assignment *assignment = scalloc(sizeof(Assignment));
1613 Match *match = &(assignment->match);
1616 char *separator = NULL;
1617 if ((separator = strchr(criteria, '/')) != NULL) {
1618 *(separator++) = '\0';
1620 sasprintf(&pattern, "(?i)%s", separator);
1621 match->title = regex_new(pattern);
1623 printf(" title = %s\n", separator);
1625 if (*criteria != '\0') {
1627 sasprintf(&pattern, "(?i)%s", criteria);
1628 match->class = regex_new(pattern);
1630 printf(" class = %s\n", criteria);
1634 /* Compatibility with older versions: If the assignment target starts
1635 * with ~, we create the equivalent of:
1637 * for_window [class="foo"] floating enable
1639 if (*workspace == '~') {
1641 if (*workspace == '\0') {
1642 /* This assignment was *only* for floating */
1643 assignment->type = A_COMMAND;
1644 assignment->dest.command = sstrdup("floating enable");
1645 TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
1648 /* Create a new assignment and continue afterwards */
1649 Assignment *floating = scalloc(sizeof(Assignment));
1650 match_copy(&(floating->match), match);
1651 floating->type = A_COMMAND;
1652 floating->dest.command = sstrdup("floating enable");
1653 TAILQ_INSERT_TAIL(&assignments, floating, assignments);
1657 assignment->type = A_TO_WORKSPACE;
1658 assignment->dest.workspace = workspace;
1659 TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
1661 | TOKASSIGN match STR
1663 if (match_is_empty(¤t_match)) {
1664 ELOG("Match is empty, ignoring this assignment\n");
1667 printf("new assignment, using above criteria, to workspace %s\n", $3);
1668 Assignment *assignment = scalloc(sizeof(Assignment));
1669 assignment->match = current_match;
1670 assignment->type = A_TO_WORKSPACE;
1671 assignment->dest.workspace = $3;
1672 TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
1684 config.ipc_socket_path = $2;
1691 config.restart_state_path = $2;
1696 TOKEXEC optional_no_startup_id STR
1698 struct Autostart *new = smalloc(sizeof(struct Autostart));
1700 new->no_startup_id = $2;
1701 TAILQ_INSERT_TAIL(&autostarts, new, autostarts);
1706 TOKEXEC_ALWAYS optional_no_startup_id STR
1708 struct Autostart *new = smalloc(sizeof(struct Autostart));
1710 new->no_startup_id = $2;
1711 TAILQ_INSERT_TAIL(&autostarts_always, new, autostarts_always);
1715 optional_no_startup_id:
1716 /* empty */ { $$ = false; }
1717 | TOK_NO_STARTUP_ID { $$ = true; }
1723 ELOG("The terminal option is DEPRECATED and has no effect. "
1724 "Please remove it from your configuration file.\n");
1731 config.font = load_font($2, true);
1732 set_font(&config.font);
1733 printf("font %s\n", $2);
1740 TOKSINGLECOLOR colorpixel
1742 uint32_t *dest = $1;
1748 TOKCOLOR colorpixel colorpixel colorpixel
1750 struct Colortriple *dest = $1;
1753 dest->background = $3;
1756 | TOKCOLOR colorpixel colorpixel colorpixel colorpixel
1758 struct Colortriple *dest = $1;
1761 dest->background = $3;
1763 dest->indicator = $5;
1770 $$ = get_colorpixel($1);
1777 /* NULL */ { $$ = 0; }
1779 | binding_modifiers '+' binding_modifier { $$ = $1 | $3; }
1780 | binding_modifiers '+' { $$ = $1; }
1784 MODIFIER { $$ = $1; }
1785 | TOKCONTROL { $$ = BIND_CONTROL; }
1786 | TOKSHIFT { $$ = BIND_SHIFT; }
1789 popup_during_fullscreen:
1790 TOK_POPUP_DURING_FULLSCREEN popup_setting
1792 DLOG("popup_during_fullscreen setting: %d\n", $2);
1793 config.popup_during_fullscreen = $2;
1798 TOK_IGNORE { $$ = PDF_IGNORE; }
1799 | TOK_LEAVE_FULLSCREEN { $$ = PDF_LEAVE_FULLSCREEN; }