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 TOK_BOTH "both"
740 %token TOKFOCUSFOLLOWSMOUSE "focus_follows_mouse"
741 %token TOK_FORCE_FOCUS_WRAPPING "force_focus_wrapping"
742 %token TOK_FORCE_XINERAMA "force_xinerama"
743 %token TOK_FAKE_OUTPUTS "fake_outputs"
744 %token TOK_WORKSPACE_AUTO_BAF "workspace_auto_back_and_forth"
745 %token TOKWORKSPACEBAR "workspace_bar"
746 %token TOK_DEFAULT "default"
747 %token TOK_STACKING "stacking"
748 %token TOK_TABBED "tabbed"
749 %token <number> TOKSTACKLIMIT "stack-limit"
750 %token TOK_POPUP_DURING_FULLSCREEN "popup_during_fullscreen"
751 %token TOK_IGNORE "ignore"
752 %token TOK_LEAVE_FULLSCREEN "leave_fullscreen"
753 %token TOK_FOR_WINDOW "for_window"
755 %token TOK_BAR_OUTPUT "output (bar)"
756 %token TOK_BAR_TRAY_OUTPUT "tray_output"
757 %token TOK_BAR_SOCKET_PATH "socket_path"
758 %token TOK_BAR_MODE "mode (bar)"
759 %token TOK_BAR_HIDE "hide"
760 %token TOK_BAR_DOCK "dock"
761 %token TOK_BAR_MODIFIER "modifier (bar)"
762 %token TOK_BAR_CONTROL "shift (bar)"
763 %token TOK_BAR_SHIFT "control (bar)"
764 %token TOK_BAR_MOD1 "Mod1"
765 %token TOK_BAR_MOD2 "Mod2"
766 %token TOK_BAR_MOD3 "Mod3"
767 %token TOK_BAR_MOD4 "Mod4"
768 %token TOK_BAR_MOD5 "Mod5"
769 %token TOK_BAR_POSITION "position"
770 %token TOK_BAR_BOTTOM "bottom"
771 %token TOK_BAR_TOP "top"
772 %token TOK_BAR_STATUS_COMMAND "status_command"
773 %token TOK_BAR_I3BAR_COMMAND "i3bar_command"
774 %token TOK_BAR_FONT "font (bar)"
775 %token TOK_BAR_WORKSPACE_BUTTONS "workspace_buttons"
776 %token TOK_BAR_VERBOSE "verbose"
777 %token TOK_BAR_COLORS "colors"
778 %token TOK_BAR_COLOR_BACKGROUND "background"
779 %token TOK_BAR_COLOR_STATUSLINE "statusline"
780 %token TOK_BAR_COLOR_FOCUSED_WORKSPACE "focused_workspace"
781 %token TOK_BAR_COLOR_ACTIVE_WORKSPACE "active_workspace"
782 %token TOK_BAR_COLOR_INACTIVE_WORKSPACE "inactive_workspace"
783 %token TOK_BAR_COLOR_URGENT_WORKSPACE "urgent_workspace"
784 %token TOK_NO_STARTUP_ID "--no-startup-id"
786 %token TOK_MARK "mark"
787 %token TOK_CLASS "class"
788 %token TOK_INSTANCE "instance"
789 %token TOK_WINDOW_ROLE "window_role"
791 %token TOK_CON_ID "con_id"
792 %token TOK_TITLE "title"
793 %token TOK_URGENT "urgent"
795 %type <binding> binding
796 %type <binding> bindcode
797 %type <binding> bindsym
798 %type <number> binding_modifiers
799 %type <number> binding_modifier
800 %type <number> direction
801 %type <number> layout_mode
802 %type <number> border_style
803 %type <number> new_window
804 %type <number> hide_edge_borders
805 %type <number> edge_hiding_mode
806 %type <number> new_float
807 %type <number> colorpixel
809 %type <number> popup_setting
810 %type <number> bar_position_position
811 %type <number> bar_mode_mode
812 %type <number> bar_modifier_modifier
813 %type <number> optional_no_startup_id
814 %type <string> command
815 %type <string> word_or_number
816 %type <string> qstring_or_number
817 %type <string> optional_workspace_name
818 %type <string> workspace_name
819 %type <string> window_class
833 | floating_maximum_size
834 | floating_minimum_size
841 | focus_follows_mouse
842 | force_focus_wrapping
845 | workspace_back_and_forth
858 | popup_during_fullscreen
872 TAILQ_INSERT_TAIL(bindings, $1, bindings);
877 TOKBINDCODE bindcode { $$ = $2; }
878 | TOKBINDSYM bindsym { $$ = $2; }
882 binding_modifiers NUMBER command
884 printf("\tFound keycode binding mod%d with key %d and command %s\n", $1, $2, $3);
885 Binding *new = scalloc(sizeof(Binding));
896 binding_modifiers word_or_number command
898 printf("\tFound keysym binding mod%d with key %s and command %s\n", $1, $2, $3);
899 Binding *new = scalloc(sizeof(Binding));
910 TOK_FOR_WINDOW match command
912 if (match_is_empty(¤t_match)) {
913 ELOG("Match is empty, ignoring this for_window statement\n");
916 printf("\t should execute command %s for the criteria mentioned above\n", $3);
917 Assignment *assignment = scalloc(sizeof(Assignment));
918 assignment->type = A_COMMAND;
919 assignment->match = current_match;
920 assignment->dest.command = $3;
921 TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
926 | matchstart criteria matchend
928 printf("match parsed\n");
936 match_init(¤t_match);
943 printf("match specification finished\n");
955 printf("criteria: class = %s\n", $3);
956 current_match.class = regex_new($3);
959 | TOK_INSTANCE '=' STR
961 printf("criteria: instance = %s\n", $3);
962 current_match.instance = regex_new($3);
965 | TOK_WINDOW_ROLE '=' STR
967 printf("criteria: window_role = %s\n", $3);
968 current_match.role = regex_new($3);
973 printf("criteria: id = %s\n", $3);
975 long parsed = strtol($3, &end, 10);
976 if (parsed == LONG_MIN ||
977 parsed == LONG_MAX ||
979 (end && *end != '\0')) {
980 ELOG("Could not parse con id \"%s\"\n", $3);
982 current_match.con_id = (Con*)parsed;
983 printf("id as int = %p\n", current_match.con_id);
988 printf("criteria: window id = %s\n", $3);
990 long parsed = strtol($3, &end, 10);
991 if (parsed == LONG_MIN ||
992 parsed == LONG_MAX ||
994 (end && *end != '\0')) {
995 ELOG("Could not parse window id \"%s\"\n", $3);
997 current_match.id = parsed;
998 printf("window id as int = %d\n", current_match.id);
1003 printf("criteria: mark = %s\n", $3);
1004 current_match.mark = regex_new($3);
1009 printf("criteria: title = %s\n", $3);
1010 current_match.title = regex_new($3);
1013 | TOK_URGENT '=' STR
1015 printf("criteria: urgent = %s\n", $3);
1016 if (strcasecmp($3, "latest") == 0 ||
1017 strcasecmp($3, "newest") == 0 ||
1018 strcasecmp($3, "recent") == 0 ||
1019 strcasecmp($3, "last") == 0) {
1020 current_match.urgent = U_LATEST;
1021 } else if (strcasecmp($3, "oldest") == 0 ||
1022 strcasecmp($3, "first") == 0) {
1023 current_match.urgent = U_OLDEST;
1031 | NUMBER { sasprintf(&$$, "%d", $1); }
1038 sasprintf(&$$, "%d", $1);
1043 TOKMODE QUOTEDSTRING '{' modelines '}'
1045 if (strcasecmp($2, "default") == 0) {
1046 printf("You cannot use the name \"default\" for your mode\n");
1049 printf("\t now in mode %s\n", $2);
1050 printf("\t current bindings = %p\n", current_bindings);
1052 TAILQ_FOREACH(binding, current_bindings, bindings) {
1053 printf("got binding on mods %d, keycode %d, symbol %s, command %s\n",
1054 binding->mods, binding->keycode, binding->symbol, binding->command);
1057 struct Mode *mode = scalloc(sizeof(struct Mode));
1059 mode->bindings = current_bindings;
1060 current_bindings = NULL;
1061 SLIST_INSERT_HEAD(&modes, mode, modes);
1068 | modelines modeline
1075 if (current_bindings == NULL) {
1076 current_bindings = scalloc(sizeof(struct bindings_head));
1077 TAILQ_INIT(current_bindings);
1080 TAILQ_INSERT_TAIL(current_bindings, $1, bindings);
1085 TOK_BAR '{' barlines '}'
1087 printf("\t new bar configuration finished, saving.\n");
1088 /* Generate a unique ID for this bar */
1089 current_bar.id = sstrdup("bar-XXXXXX");
1090 /* This works similar to mktemp in that it replaces the last six X with
1091 * random letters, but without the restriction that the given buffer
1092 * has to contain a valid path name. */
1093 char *x = current_bar.id + strlen("bar-");
1094 while (*x != '\0') {
1095 *(x++) = (rand() % 26) + 'a';
1098 /* If no font was explicitly set, we use the i3 font as default */
1099 if (!current_bar.font && font_pattern)
1100 current_bar.font = sstrdup(font_pattern);
1102 /* Copy the current (static) structure into a dynamically allocated
1103 * one, then cleanup our static one. */
1104 Barconfig *bar_config = scalloc(sizeof(Barconfig));
1105 memcpy(bar_config, ¤t_bar, sizeof(Barconfig));
1106 TAILQ_INSERT_TAIL(&barconfigs, bar_config, configs);
1108 memset(¤t_bar, '\0', sizeof(Barconfig));
1119 | bar_status_command
1127 | bar_workspace_buttons
1131 | bar_color_background
1132 | bar_color_statusline
1133 | bar_color_focused_workspace
1134 | bar_color_active_workspace
1135 | bar_color_inactive_workspace
1136 | bar_color_urgent_workspace
1140 TOK_BAR_STATUS_COMMAND STR
1142 DLOG("should add status command %s\n", $2);
1143 FREE(current_bar.status_command);
1144 current_bar.status_command = $2;
1149 TOK_BAR_I3BAR_COMMAND STR
1151 DLOG("should add i3bar_command %s\n", $2);
1152 FREE(current_bar.i3bar_command);
1153 current_bar.i3bar_command = $2;
1160 DLOG("bar output %s\n", $2);
1161 int new_outputs = current_bar.num_outputs + 1;
1162 current_bar.outputs = srealloc(current_bar.outputs, sizeof(char*) * new_outputs);
1163 current_bar.outputs[current_bar.num_outputs] = $2;
1164 current_bar.num_outputs = new_outputs;
1169 TOK_BAR_TRAY_OUTPUT STR
1171 DLOG("tray %s\n", $2);
1172 FREE(current_bar.tray_output);
1173 current_bar.tray_output = $2;
1178 TOK_BAR_POSITION bar_position_position
1180 DLOG("position %d\n", $2);
1181 current_bar.position = $2;
1185 bar_position_position:
1186 TOK_BAR_TOP { $$ = P_TOP; }
1187 | TOK_BAR_BOTTOM { $$ = P_BOTTOM; }
1191 TOK_BAR_MODE bar_mode_mode
1193 DLOG("mode %d\n", $2);
1194 current_bar.mode = $2;
1199 TOK_BAR_HIDE { $$ = M_HIDE; }
1200 | TOK_BAR_DOCK { $$ = M_DOCK; }
1204 TOK_BAR_MODIFIER bar_modifier_modifier
1206 DLOG("modifier %d\n", $2);
1207 current_bar.modifier = $2;
1210 bar_modifier_modifier:
1211 TOK_BAR_CONTROL { $$ = M_CONTROL; }
1212 | TOK_BAR_SHIFT { $$ = M_SHIFT; }
1213 | TOK_BAR_MOD1 { $$ = M_MOD1; }
1214 | TOK_BAR_MOD2 { $$ = M_MOD2; }
1215 | TOK_BAR_MOD3 { $$ = M_MOD3; }
1216 | TOK_BAR_MOD4 { $$ = M_MOD4; }
1217 | TOK_BAR_MOD5 { $$ = M_MOD5; }
1223 DLOG("font %s\n", $2);
1224 FREE(current_bar.font);
1225 current_bar.font = $2;
1229 bar_workspace_buttons:
1230 TOK_BAR_WORKSPACE_BUTTONS bool
1232 DLOG("workspace_buttons = %d\n", $2);
1233 /* We store this inverted to make the default setting right when
1234 * initializing the struct with zero. */
1235 current_bar.hide_workspace_buttons = !($2);
1240 TOK_BAR_VERBOSE bool
1242 DLOG("verbose = %d\n", $2);
1243 current_bar.verbose = $2;
1248 TOK_BAR_SOCKET_PATH STR
1250 DLOG("socket_path = %s\n", $2);
1251 FREE(current_bar.socket_path);
1252 current_bar.socket_path = $2;
1257 TOK_BAR_COLORS '{' barlines '}'
1259 /* At the moment, the TOK_BAR_COLORS token is only to make the config
1260 * friendlier for humans. We might change this in the future if it gets
1265 bar_color_background:
1266 TOK_BAR_COLOR_BACKGROUND HEXCOLOR
1268 DLOG("background = %s\n", $2);
1269 current_bar.colors.background = $2;
1273 bar_color_statusline:
1274 TOK_BAR_COLOR_STATUSLINE HEXCOLOR
1276 DLOG("statusline = %s\n", $2);
1277 current_bar.colors.statusline = $2;
1281 bar_color_focused_workspace:
1282 TOK_BAR_COLOR_FOCUSED_WORKSPACE HEXCOLOR HEXCOLOR
1284 /* Old syntax: text / background */
1285 DLOG("focused_ws = %s, %s (old)\n", $2, $3);
1286 current_bar.colors.focused_workspace_bg = $3;
1287 current_bar.colors.focused_workspace_text = $2;
1289 | TOK_BAR_COLOR_FOCUSED_WORKSPACE HEXCOLOR HEXCOLOR HEXCOLOR
1291 /* New syntax: border / background / text */
1292 DLOG("focused_ws = %s, %s and %s\n", $2, $3, $4);
1293 current_bar.colors.focused_workspace_border = $2;
1294 current_bar.colors.focused_workspace_bg = $3;
1295 current_bar.colors.focused_workspace_text = $4;
1299 bar_color_active_workspace:
1300 TOK_BAR_COLOR_ACTIVE_WORKSPACE HEXCOLOR HEXCOLOR
1302 /* Old syntax: text / background */
1303 DLOG("active_ws = %s, %s (old)\n", $2, $3);
1304 current_bar.colors.active_workspace_bg = $3;
1305 current_bar.colors.active_workspace_text = $2;
1307 | TOK_BAR_COLOR_ACTIVE_WORKSPACE HEXCOLOR HEXCOLOR HEXCOLOR
1309 /* New syntax: border / background / text */
1310 DLOG("active_ws = %s, %s and %s\n", $2, $3, $4);
1311 current_bar.colors.active_workspace_border = $2;
1312 current_bar.colors.active_workspace_bg = $3;
1313 current_bar.colors.active_workspace_text = $4;
1317 bar_color_inactive_workspace:
1318 TOK_BAR_COLOR_INACTIVE_WORKSPACE HEXCOLOR HEXCOLOR
1320 /* Old syntax: text / background */
1321 DLOG("inactive_ws = %s, %s (old)\n", $2, $3);
1322 current_bar.colors.inactive_workspace_bg = $3;
1323 current_bar.colors.inactive_workspace_text = $2;
1325 | TOK_BAR_COLOR_INACTIVE_WORKSPACE HEXCOLOR HEXCOLOR HEXCOLOR
1327 DLOG("inactive_ws = %s, %s and %s\n", $2, $3, $4);
1328 current_bar.colors.inactive_workspace_border = $2;
1329 current_bar.colors.inactive_workspace_bg = $3;
1330 current_bar.colors.inactive_workspace_text = $4;
1334 bar_color_urgent_workspace:
1335 TOK_BAR_COLOR_URGENT_WORKSPACE HEXCOLOR HEXCOLOR
1337 /* Old syntax: text / background */
1338 DLOG("urgent_ws = %s, %s (old)\n", $2, $3);
1339 current_bar.colors.urgent_workspace_bg = $3;
1340 current_bar.colors.urgent_workspace_text = $2;
1342 | TOK_BAR_COLOR_URGENT_WORKSPACE HEXCOLOR HEXCOLOR HEXCOLOR
1344 DLOG("urgent_ws = %s, %s and %s\n", $2, $3, $4);
1345 current_bar.colors.urgent_workspace_border = $2;
1346 current_bar.colors.urgent_workspace_bg = $3;
1347 current_bar.colors.urgent_workspace_text = $4;
1351 floating_maximum_size:
1352 TOKFLOATING_MAXIMUM_SIZE NUMBER WORD NUMBER
1354 printf("floating_maximum_width = %d\n", $2);
1355 printf("floating_maximum_height = %d\n", $4);
1356 config.floating_maximum_width = $2;
1357 config.floating_maximum_height = $4;
1361 floating_minimum_size:
1362 TOKFLOATING_MINIMUM_SIZE NUMBER WORD NUMBER
1364 printf("floating_minimum_width = %d\n", $2);
1365 printf("floating_minimum_height = %d\n", $4);
1366 config.floating_minimum_width = $2;
1367 config.floating_minimum_height = $4;
1372 TOKFLOATING_MODIFIER binding_modifiers
1374 DLOG("floating modifier = %d\n", $2);
1375 config.floating_modifier = $2;
1380 TOK_ORIENTATION direction
1382 DLOG("New containers should start with split direction %d\n", $2);
1383 config.default_orientation = $2;
1388 TOK_HORIZ { $$ = HORIZ; }
1389 | TOK_VERT { $$ = VERT; }
1390 | TOK_AUTO { $$ = NO_ORIENTATION; }
1394 TOK_WORKSPACE_LAYOUT layout_mode
1396 DLOG("new containers will be in mode %d\n", $2);
1397 config.default_layout = $2;
1400 /* We also need to change the layout of the already existing
1401 * workspaces here. Workspaces may exist at this point because
1402 * of the other directives which are modifying workspaces
1403 * (setting the preferred screen or name). While the workspace
1404 * objects are already created, they have never been used.
1405 * Thus, the user very likely awaits the default container mode
1406 * to trigger in this case, regardless of where it is inside
1407 * his configuration file. */
1409 TAILQ_FOREACH(ws, workspaces, workspaces) {
1410 if (ws->table == NULL)
1412 switch_layout_mode(global_conn,
1414 config.container_mode);
1418 | TOK_WORKSPACE_LAYOUT TOKSTACKLIMIT TOKSTACKLIMIT NUMBER
1420 DLOG("stack-limit %d with val %d\n", $3, $4);
1421 config.container_stack_limit = $3;
1422 config.container_stack_limit_value = $4;
1425 /* See the comment above */
1427 TAILQ_FOREACH(ws, workspaces, workspaces) {
1428 if (ws->table == NULL)
1430 Container *con = ws->table[0][0];
1431 con->stack_limit = config.container_stack_limit;
1432 con->stack_limit_value = config.container_stack_limit_value;
1439 TOK_DEFAULT { $$ = L_DEFAULT; }
1440 | TOK_STACKING { $$ = L_STACKED; }
1441 | TOK_TABBED { $$ = L_TABBED; }
1445 TOKNEWWINDOW border_style
1447 DLOG("new windows should start with border style %d\n", $2);
1448 config.default_border = $2;
1453 TOKNEWFLOAT border_style
1455 DLOG("new floating windows should start with border style %d\n", $2);
1456 config.default_floating_border = $2;
1461 TOK_NORMAL { $$ = BS_NORMAL; }
1462 | TOK_NONE { $$ = BS_NONE; }
1463 | TOK_1PIXEL { $$ = BS_1PIXEL; }
1473 DLOG("checking word \"%s\"\n", $1);
1474 $$ = (strcasecmp($1, "yes") == 0 ||
1475 strcasecmp($1, "true") == 0 ||
1476 strcasecmp($1, "on") == 0 ||
1477 strcasecmp($1, "enable") == 0 ||
1478 strcasecmp($1, "active") == 0);
1483 TOK_HIDE_EDGE_BORDERS edge_hiding_mode
1485 DLOG("hide edge borders = %d\n", $2);
1486 config.hide_edge_borders = $2;
1491 TOK_NONE { $$ = ADJ_NONE; }
1492 | TOK_VERT { $$ = ADJ_LEFT_SCREEN_EDGE | ADJ_RIGHT_SCREEN_EDGE; }
1493 | TOK_HORIZ { $$ = ADJ_UPPER_SCREEN_EDGE | ADJ_LOWER_SCREEN_EDGE; }
1494 | TOK_BOTH { $$ = ADJ_LEFT_SCREEN_EDGE | ADJ_RIGHT_SCREEN_EDGE | ADJ_UPPER_SCREEN_EDGE | ADJ_LOWER_SCREEN_EDGE; }
1495 | bool { $$ = ($1 ? ADJ_LEFT_SCREEN_EDGE | ADJ_RIGHT_SCREEN_EDGE : ADJ_NONE); }
1498 focus_follows_mouse:
1499 TOKFOCUSFOLLOWSMOUSE bool
1501 DLOG("focus follows mouse = %d\n", $2);
1502 config.disable_focus_follows_mouse = !($2);
1506 force_focus_wrapping:
1507 TOK_FORCE_FOCUS_WRAPPING bool
1509 DLOG("force focus wrapping = %d\n", $2);
1510 config.force_focus_wrapping = $2;
1515 TOK_FORCE_XINERAMA bool
1517 DLOG("force xinerama = %d\n", $2);
1518 config.force_xinerama = $2;
1523 TOK_FAKE_OUTPUTS STR
1525 DLOG("fake outputs = %s\n", $2);
1526 config.fake_outputs = $2;
1530 workspace_back_and_forth:
1531 TOK_WORKSPACE_AUTO_BAF bool
1533 DLOG("automatic workspace back-and-forth = %d\n", $2);
1534 config.workspace_auto_back_and_forth = $2;
1539 TOKWORKSPACEBAR bool
1541 DLOG("workspace bar = %d\n", $2);
1542 config.disable_workspace_bar = !($2);
1547 TOKWORKSPACE qstring_or_number TOKOUTPUT OUTPUT optional_workspace_name
1552 ELOG("The old (v3) syntax workspace <number> output <output> <name> is deprecated.\n");
1553 ELOG("Please use the new syntax: workspace \"<workspace>\" output <output>\n");
1554 ELOG("In your case, the following should work:\n");
1555 ELOG(" workspace \"%s\" output %s\n", $5, $4);
1557 context->has_warnings = true;
1560 DLOG("Assigning workspace \"%s\" to output \"%s\"\n", ws_name, $4);
1561 /* Check for earlier assignments of the same workspace so that we
1562 * don’t have assignments of a single workspace to different
1564 struct Workspace_Assignment *assignment;
1565 bool duplicate = false;
1566 TAILQ_FOREACH(assignment, &ws_assignments, ws_assignments) {
1567 if (strcasecmp(assignment->name, ws_name) == 0) {
1568 ELOG("You have a duplicate workspace assignment for workspace \"%s\"\n",
1570 assignment->output = $4;
1575 assignment = scalloc(sizeof(struct Workspace_Assignment));
1576 assignment->name = ws_name;
1577 assignment->output = $4;
1578 TAILQ_INSERT_TAIL(&ws_assignments, assignment, ws_assignments);
1581 | TOKWORKSPACE NUMBER workspace_name
1585 DLOG("Invalid workspace assignment, workspace number %d out of range\n", ws_num);
1587 DLOG("workspace name to: %s\n", $3);
1589 if ($<string>3 != NULL) {
1590 workspace_set_name(workspace_get(ws_num - 1), $<string>3);
1598 optional_workspace_name:
1599 /* empty */ { $$ = NULL; }
1600 | workspace_name { $$ = $1; }
1604 QUOTEDSTRING { $$ = $1; }
1610 TOKASSIGN window_class STR
1612 /* This is the old, deprecated form of assignments. It’s provided for
1613 * compatibility in version (4.1, 4.2, 4.3) and will be removed
1614 * afterwards. It triggers an i3-nagbar warning starting from 4.1. */
1615 ELOG("You are using the old assign syntax (without criteria). "
1616 "Please see the User's Guide for the new syntax and fix "
1617 "your config file.\n");
1618 context->has_warnings = true;
1619 printf("assignment of %s to *%s*\n", $2, $3);
1620 char *workspace = $3;
1621 char *criteria = $2;
1623 Assignment *assignment = scalloc(sizeof(Assignment));
1624 Match *match = &(assignment->match);
1627 char *separator = NULL;
1628 if ((separator = strchr(criteria, '/')) != NULL) {
1629 *(separator++) = '\0';
1631 sasprintf(&pattern, "(?i)%s", separator);
1632 match->title = regex_new(pattern);
1634 printf(" title = %s\n", separator);
1636 if (*criteria != '\0') {
1638 sasprintf(&pattern, "(?i)%s", criteria);
1639 match->class = regex_new(pattern);
1641 printf(" class = %s\n", criteria);
1645 /* Compatibility with older versions: If the assignment target starts
1646 * with ~, we create the equivalent of:
1648 * for_window [class="foo"] floating enable
1650 if (*workspace == '~') {
1652 if (*workspace == '\0') {
1653 /* This assignment was *only* for floating */
1654 assignment->type = A_COMMAND;
1655 assignment->dest.command = sstrdup("floating enable");
1656 TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
1659 /* Create a new assignment and continue afterwards */
1660 Assignment *floating = scalloc(sizeof(Assignment));
1661 match_copy(&(floating->match), match);
1662 floating->type = A_COMMAND;
1663 floating->dest.command = sstrdup("floating enable");
1664 TAILQ_INSERT_TAIL(&assignments, floating, assignments);
1668 assignment->type = A_TO_WORKSPACE;
1669 assignment->dest.workspace = workspace;
1670 TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
1672 | TOKASSIGN match STR
1674 if (match_is_empty(¤t_match)) {
1675 ELOG("Match is empty, ignoring this assignment\n");
1678 printf("new assignment, using above criteria, to workspace %s\n", $3);
1679 Assignment *assignment = scalloc(sizeof(Assignment));
1680 assignment->match = current_match;
1681 assignment->type = A_TO_WORKSPACE;
1682 assignment->dest.workspace = $3;
1683 TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
1695 config.ipc_socket_path = $2;
1702 config.restart_state_path = $2;
1707 TOKEXEC optional_no_startup_id STR
1709 struct Autostart *new = smalloc(sizeof(struct Autostart));
1711 new->no_startup_id = $2;
1712 TAILQ_INSERT_TAIL(&autostarts, new, autostarts);
1717 TOKEXEC_ALWAYS optional_no_startup_id STR
1719 struct Autostart *new = smalloc(sizeof(struct Autostart));
1721 new->no_startup_id = $2;
1722 TAILQ_INSERT_TAIL(&autostarts_always, new, autostarts_always);
1726 optional_no_startup_id:
1727 /* empty */ { $$ = false; }
1728 | TOK_NO_STARTUP_ID { $$ = true; }
1734 ELOG("The terminal option is DEPRECATED and has no effect. "
1735 "Please remove it from your configuration file.\n");
1742 config.font = load_font($2, true);
1743 set_font(&config.font);
1744 printf("font %s\n", $2);
1751 TOKSINGLECOLOR colorpixel
1753 uint32_t *dest = $1;
1759 TOKCOLOR colorpixel colorpixel colorpixel
1761 struct Colortriple *dest = $1;
1764 dest->background = $3;
1767 | TOKCOLOR colorpixel colorpixel colorpixel colorpixel
1769 struct Colortriple *dest = $1;
1772 dest->background = $3;
1774 dest->indicator = $5;
1781 $$ = get_colorpixel($1);
1788 /* NULL */ { $$ = 0; }
1790 | binding_modifiers '+' binding_modifier { $$ = $1 | $3; }
1791 | binding_modifiers '+' { $$ = $1; }
1795 MODIFIER { $$ = $1; }
1796 | TOKCONTROL { $$ = BIND_CONTROL; }
1797 | TOKSHIFT { $$ = BIND_SHIFT; }
1800 popup_during_fullscreen:
1801 TOK_POPUP_DURING_FULLSCREEN popup_setting
1803 DLOG("popup_during_fullscreen setting: %d\n", $2);
1804 config.popup_during_fullscreen = $2;
1809 TOK_IGNORE { $$ = PDF_IGNORE; }
1810 | TOK_LEAVE_FULLSCREEN { $$ = PDF_LEAVE_FULLSCREEN; }