]> git.sur5r.net Git - i3/i3/blobdiff - src/cfgparse.y
Merge branch 'master' into next
[i3/i3] / src / cfgparse.y
index 9bce2f376b726be6758db00adc5e94fb7d4ba96d..0d2c69771814c2ad0ced926efe26d12648e1b6a2 100644 (file)
@@ -715,6 +715,7 @@ void parse_file(const char *f) {
 %token                  TOK_BAR_COLOR_ACTIVE_WORKSPACE "active_workspace"
 %token                  TOK_BAR_COLOR_INACTIVE_WORKSPACE "inactive_workspace"
 %token                  TOK_BAR_COLOR_URGENT_WORKSPACE "urgent_workspace"
+%token                  TOK_NO_STARTUP_ID           "--no-startup-id"
 
 %token              TOK_MARK            "mark"
 %token              TOK_CLASS           "class"
@@ -739,6 +740,7 @@ void parse_file(const char *f) {
 %type   <number>        popup_setting
 %type   <number>        bar_position_position
 %type   <number>        bar_mode_mode
+%type   <number>        optional_no_startup_id
 %type   <string>        command
 %type   <string>        word_or_number
 %type   <string>        qstring_or_number
@@ -1508,45 +1510,30 @@ restart_state:
     ;
 
 exec:
-    TOKEXEC STR
+    TOKEXEC optional_no_startup_id STR
     {
-        char *command = $2;
-        bool no_startup_id = false;
-        if (strncasecmp($2, "--no-startup-id ", strlen("--no-startup-id ")) == 0) {
-            no_startup_id = true;
-            /* We need to make a copy here, otherwise we leak the
-             * --no-startup-id bytes in the beginning of the string */
-            command = sstrdup(command + strlen("--no-startup-id "));
-            free($2);
-        }
-
         struct Autostart *new = smalloc(sizeof(struct Autostart));
-        new->command = command;
-        new->no_startup_id = no_startup_id;
+        new->command = $3;
+        new->no_startup_id = $2;
         TAILQ_INSERT_TAIL(&autostarts, new, autostarts);
     }
     ;
 
 exec_always:
-    TOKEXEC_ALWAYS STR
+    TOKEXEC_ALWAYS optional_no_startup_id STR
     {
-        char *command = $2;
-        bool no_startup_id = false;
-        if (strncasecmp($2, "--no-startup-id ", strlen("--no-startup-id ")) == 0) {
-            no_startup_id = true;
-            /* We need to make a copy here, otherwise we leak the
-             * --no-startup-id bytes in the beginning of the string */
-            command = sstrdup(command + strlen("--no-startup-id "));
-            free($2);
-        }
-
         struct Autostart *new = smalloc(sizeof(struct Autostart));
-        new->command = command;
-        new->no_startup_id = no_startup_id;
+        new->command = $3;
+        new->no_startup_id = $2;
         TAILQ_INSERT_TAIL(&autostarts_always, new, autostarts_always);
     }
     ;
 
+optional_no_startup_id:
+    /* empty */ { $$ = false; }
+    | TOK_NO_STARTUP_ID  { $$ = true; }
+    ;
+
 terminal:
     TOKTERMINAL STR
     {
@@ -1559,6 +1546,7 @@ font:
     TOKFONT STR
     {
         config.font = load_font($2, true);
+        set_font(&config.font);
         printf("font %s\n", $2);
         FREE(font_pattern);
         font_pattern = $2;