]> git.sur5r.net Git - i3/i3/blobdiff - src/cfgparse.y
Merge branch 'tree' into next
[i3/i3] / src / cfgparse.y
index 227471089571270a1de619490ad2d63e3dd9d277..ecfa665859c51520d8bbe557633192e561a03266 100644 (file)
@@ -19,6 +19,7 @@ static Match current_match;
 typedef struct yy_buffer_state *YY_BUFFER_STATE;
 extern int yylex(struct context *context);
 extern int yyparse(void);
+extern int yylex_destroy(void);
 extern FILE *yyin;
 YY_BUFFER_STATE yy_scan_string(const char *);
 
@@ -258,9 +259,9 @@ static void start_configerror_nagbar(const char *config_path) {
     if (configerror_pid == 0) {
         char *editaction,
              *pageraction;
-        if (asprintf(&editaction, TERM_EMU " -e $EDITOR \"%s\"", config_path) == -1)
+        if (asprintf(&editaction, TERM_EMU " -e sh -c \"${EDITOR:-vi} \"%s\" && i3-msg reload\"", config_path) == -1)
             exit(1);
-        if (asprintf(&pageraction, TERM_EMU " -e $PAGER \"%s\"", errorfilename) == -1)
+        if (asprintf(&pageraction, TERM_EMU " -e sh -c \"${PAGER:-less} \"%s\"\"", errorfilename) == -1)
             exit(1);
         char *argv[] = {
             NULL, /* will be replaced by the executable path */
@@ -467,6 +468,7 @@ void parse_file(const char *f) {
         start_configerror_nagbar(f);
     }
 
+    yylex_destroy();
     FREE(context->line_copy);
     free(context);
     free(new);
@@ -518,6 +520,7 @@ void parse_file(const char *f) {
 %token                  TOKIPCSOCKET                "ipc_socket"
 %token                  TOKRESTARTSTATE             "restart_state"
 %token                  TOKEXEC                     "exec"
+%token                  TOKEXEC_ALWAYS              "exec_always"
 %token  <single_color>  TOKSINGLECOLOR
 %token  <color>         TOKCOLOR
 %token                  TOKARROW                    "→"
@@ -590,6 +593,7 @@ line:
     | ipcsocket
     | restart_state
     | exec
+    | exec_always
     | single_color
     | color
     | terminal
@@ -1036,6 +1040,15 @@ exec:
     }
     ;
 
+exec_always:
+    TOKEXEC_ALWAYS STR
+    {
+        struct Autostart *new = smalloc(sizeof(struct Autostart));
+        new->command = $2;
+        TAILQ_INSERT_TAIL(&autostarts_always, new, autostarts_always);
+    }
+    ;
+
 terminal:
     TOKTERMINAL STR
     {
@@ -1049,6 +1062,7 @@ font:
     {
         config.font = load_font($2, true);
         printf("font %s\n", $2);
+        free($2);
     }
     ;