support "launch <command>" in .xoatrc
This commit is contained in:
13
config.c
13
config.c
@@ -89,6 +89,9 @@ configure()
|
|||||||
settings.binding_count = sizeof(keys) / sizeof(Binding);
|
settings.binding_count = sizeof(keys) / sizeof(Binding);
|
||||||
settings.bindings = calloc(settings.binding_count, sizeof(Binding));
|
settings.bindings = calloc(settings.binding_count, sizeof(Binding));
|
||||||
|
|
||||||
|
settings.launchcmd_count = 0;
|
||||||
|
settings.launchcmds = calloc(1, sizeof(char*));
|
||||||
|
|
||||||
for (i = 0; i < settings.binding_count; i++)
|
for (i = 0; i < settings.binding_count; i++)
|
||||||
memmove(&settings.bindings[i], &keys[i], sizeof(Binding));
|
memmove(&settings.bindings[i], &keys[i], sizeof(Binding));
|
||||||
|
|
||||||
@@ -435,6 +438,16 @@ configure()
|
|||||||
settings.bindings[i].num = num;
|
settings.bindings[i].num = num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
if (regex_match("^launch[[:space:]]+(.+)$", tmp))
|
||||||
|
{
|
||||||
|
rtrim(regex_matches[1]);
|
||||||
|
|
||||||
|
settings.launchcmd_count++;
|
||||||
|
settings.launchcmds = realloc(settings.launchcmds, sizeof(char*) * settings.launchcmd_count);
|
||||||
|
settings.launchcmds[settings.launchcmd_count-1] = strdup(regex_matches[1]);
|
||||||
|
fprintf(stderr, "launching [%s]\n", regex_matches[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
|
|||||||
7
setup.c
7
setup.c
@@ -216,4 +216,11 @@ void setup()
|
|||||||
client_place_spot(c, c->spot, c->monitor, 0);
|
client_place_spot(c, c->spot, c->monitor, 0);
|
||||||
if (!current) client_activate(c);
|
if (!current) client_activate(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// auto launch
|
||||||
|
if (settings.launchcmd_count)
|
||||||
|
{
|
||||||
|
for (i = 0; i < settings.launchcmd_count; i++)
|
||||||
|
exec_cmd(settings.launchcmds[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
3
xoat.c
3
xoat.c
@@ -116,6 +116,9 @@ typedef struct _Settings {
|
|||||||
|
|
||||||
unsigned int binding_count;
|
unsigned int binding_count;
|
||||||
Binding *bindings;
|
Binding *bindings;
|
||||||
|
|
||||||
|
unsigned int launchcmd_count;
|
||||||
|
char **launchcmds;
|
||||||
} Settings;
|
} Settings;
|
||||||
|
|
||||||
#define have_layout(i) (settings.layout_count > (i))
|
#define have_layout(i) (settings.layout_count > (i))
|
||||||
|
|||||||
6
xoatrc
6
xoatrc
@@ -132,4 +132,8 @@ bind F4 action_find_or_start sublime-text
|
|||||||
|
|
||||||
# Also possible to bind by keysym hex value
|
# Also possible to bind by keysym hex value
|
||||||
# Eg, XF86XK_MonBrightnessUp = 0x1008FF02
|
# Eg, XF86XK_MonBrightnessUp = 0x1008FF02
|
||||||
# bind 0x1008FF02 action_command <custom_brightness_command>
|
# bind 0x1008FF02 action_command <custom_brightness_command>
|
||||||
|
|
||||||
|
# Launch apps (or any command) at startup
|
||||||
|
# launch xterm
|
||||||
|
# launch xsetroot -cursor_name left_ptr
|
||||||
Reference in New Issue
Block a user