typedef struct Config Config;
extern Config config;
+extern bool config_use_lexer;
/**
* Part of the struct Config. It makes sense to group colors for background,
Mod3 { yylval.number = BIND_MOD3; return MODIFIER; }
Mod4 { yylval.number = BIND_MOD4; return MODIFIER; }
Mod5 { yylval.number = BIND_MOD5; return MODIFIER; }
+Mode_switch { yylval.number = BIND_MODE_SWITCH; return MODIFIER; }
control { return TOKCONTROL; }
shift { return TOKSHIFT; }
→ { return TOKARROW; }
int number;
char *string;
struct Colortriple *color;
+ struct Assignment *assignment;
}
%token <number>NUMBER
;
assign:
- TOKASSIGN WHITESPACE window_class WHITESPACE optional_arrow NUMBER
+ TOKASSIGN WHITESPACE window_class WHITESPACE optional_arrow assign_target
{
- /* TODO */
printf("assignment of %s to %d\n", $<string>3, $<number>6);
+
+ struct Assignment *new = $<assignment>6;
+ new->windowclass_title = strdup($<string>3);
+ TAILQ_INSERT_TAIL(&assignments, new, assignments);
}
;
+assign_target:
+ NUMBER
+ {
+ struct Assignment *new = scalloc(sizeof(struct Assignment));
+ new->workspace = $<number>1;
+ new->floating = ASSIGN_FLOATING_NO;
+ $<assignment>$ = new;
+ }
+ | '~'
+ {
+ struct Assignment *new = scalloc(sizeof(struct Assignment));
+ new->floating = ASSIGN_FLOATING_ONLY;
+ $<assignment>$ = new;
+ }
+ | '~' NUMBER
+ {
+ struct Assignment *new = scalloc(sizeof(struct Assignment));
+ new->workspace = $<number>2;
+ new->floating = ASSIGN_FLOATING;
+ $<assignment>$ = new;
+ }
+ ;
+
window_class:
QUOTEDSTRING
| STR_NG
Config config;
+bool config_use_lexer = false;
+
/*
* This function resolves ~ in pathnames.
*
config.bar.urgent.background = get_colorpixel(conn, "#900000");
config.bar.urgent.text = get_colorpixel(conn, "#ffffff");
+ if (config_use_lexer) {
+ /* Yes, this will be cleaned up soon. */
+ if (override_configpath != NULL) {
+ parse_file(override_configpath);
+ } else {
+ FILE *handle;
+ char *globbed = glob_path("~/.i3/config");
+ if ((handle = fopen(globbed, "r")) == NULL) {
+ if ((handle = fopen("/etc/i3/config", "r")) == NULL) {
+ die("Neither \"%s\" nor /etc/i3/config could be opened\n", globbed);
+ } else {
+ parse_file("/etc/i3/config");
+ }
+ } else {
+ parse_file(globbed);
+ }
+ }
+ } else {
+
FILE *handle;
if (override_configpath != NULL) {
if ((handle = fopen(override_configpath, "r")) == NULL)
grab_all_keys(conn);
fclose(handle);
- REQUIRED_OPTION(terminal);
- REQUIRED_OPTION(font);
-
while (!SLIST_EMPTY(&variables)) {
struct Variable *v = SLIST_FIRST(&variables);
SLIST_REMOVE_HEAD(&variables, variables);
free(v->value);
free(v);
}
+ }
+
+ REQUIRED_OPTION(terminal);
+ REQUIRED_OPTION(font);
/* Set an empty name for every workspace which got no name */
for (int i = 0; i < 10; i++) {
start_argv = argv;
- while ((opt = getopt_long(argc, argv, "c:vahp", long_options, &option_index)) != -1) {
+ while ((opt = getopt_long(argc, argv, "c:vahl", long_options, &option_index)) != -1) {
switch (opt) {
case 'a':
LOG("Autostart disabled using -a\n");
case 'v':
printf("i3 version " I3_VERSION " © 2009 Michael Stapelberg and contributors\n");
exit(EXIT_SUCCESS);
- case 'p':
- {
- printf("parsing\n");
- parse_file(override_configpath);
- exit(0);
- }
+ case 'l':
+ config_use_lexer = true;
+ break;
default:
fprintf(stderr, "Usage: %s [-c configfile] [-a] [-v]\n", argv[0]);
fprintf(stderr, "\n");