mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
rcxml: refactor load_default_key_bindings()
This commit is contained in:
parent
b5acf387b8
commit
39b9133cec
1 changed files with 25 additions and 27 deletions
|
|
@ -342,37 +342,35 @@ rcxml_init()
|
||||||
rc.doubleclick_time = 500;
|
rc.doubleclick_time = 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct {
|
||||||
bind(const char *binding, const char *action, const char *command)
|
const char *binding, *action, *command;
|
||||||
{
|
} key_combos[] = {
|
||||||
if (!binding || !action) {
|
{ "A-Tab", "NextWindow", NULL },
|
||||||
return;
|
{ "A-Escape", "Exit", NULL },
|
||||||
}
|
{ "W-Return", "Execute", "alacritty" },
|
||||||
struct keybind *k = keybind_create(binding);
|
{ "A-F3", "Execute", "bemenu-run" },
|
||||||
if (!k) {
|
{ "A-F4", "Close", NULL },
|
||||||
return;
|
{ "W-a", "ToggleMaximize", NULL },
|
||||||
}
|
{ "A-Left", "MoveToEdge", "left" },
|
||||||
if (action) {
|
{ "A-Right", "MoveToEdge", "right" },
|
||||||
k->action = strdup(action);
|
{ "A-Up", "MoveToEdge", "up" },
|
||||||
}
|
{ "A-Down", "MoveToEdge", "down" },
|
||||||
if (command) {
|
{ NULL, NULL, NULL },
|
||||||
k->command = strdup(command);
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
load_default_key_bindings(void)
|
load_default_key_bindings(void)
|
||||||
{
|
{
|
||||||
bind("A-Tab", "NextWindow", NULL);
|
for (int i = 0; key_combos[i].binding; i++) {
|
||||||
bind("A-Escape", "Exit", NULL);
|
struct keybind *k = keybind_create(key_combos[i].binding);
|
||||||
bind("W-Return", "Execute", "alacritty");
|
if (!k) {
|
||||||
bind("A-F3", "Execute", "bemenu-run");
|
continue;
|
||||||
bind("A-F4", "Close", NULL);
|
}
|
||||||
bind("W-a", "ToggleMaximize", NULL);
|
k->action = strdup(key_combos[i].action);
|
||||||
bind("A-Left", "MoveToEdge", "left");
|
if (key_combos[i].command) {
|
||||||
bind("A-Right", "MoveToEdge", "right");
|
k->command = strdup(key_combos[i].command);
|
||||||
bind("A-Up", "MoveToEdge", "up");
|
}
|
||||||
bind("A-Down", "MoveToEdge", "down");
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue