From 93244cfbe19b2911822a44179f338bcb80b28210 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Sun, 22 Aug 2021 17:00:22 +0100 Subject: [PATCH] rcxml: add some default keybinds super-return - alacritty alt-F4 - close window super-a - toggle maximize alt-arrow - move window to edge --- README.md | 7 +++++-- src/config/rcxml.c | 21 ++++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a205e30d..c6fc7885 100644 --- a/README.md +++ b/README.md @@ -98,10 +98,13 @@ If you have not created an rc.xml config file, default binds will be: | ------------------- | ------ | `alt`-`tab` | activate next window | `alt`-`escape` | exit -| `alt`-`F3` | launch bemenu -| `alt`-`F4` | close active window +| `super`-`return` | alacritty +| `alt`-`F3` | bemenu +| `alt`-`F4` | close window +| `super`-`a` | toggle maximize | `alt`-`mouse-left` | move window | `alt`-`mouse-right` | resize window +| `alt`-`arrow` | move window to edge ## 6. Integrate diff --git a/src/config/rcxml.c b/src/config/rcxml.c index f21122ef..7fdc7d18 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -29,6 +29,8 @@ enum font_place { /* TODO: Add all places based on Openbox's rc.xml */ }; +static void load_default_key_bindings(void); + static void fill_keybind(char *nodename, char *content) { @@ -280,14 +282,27 @@ bind(const char *binding, const char *action, const char *command) } } +static void +load_default_key_bindings(void) +{ + bind("A-Tab", "NextWindow", NULL); + bind("A-Escape", "Exit", NULL); + bind("W-Return", "Execute", "alacritty"); + bind("A-F3", "Execute", "bemenu-run"); + bind("A-F4", "Close", NULL); + bind("W-a", "ToggleMaximize", NULL); + bind("A-Left", "MoveToEdge", "left"); + bind("A-Right", "MoveToEdge", "right"); + bind("A-Up", "MoveToEdge", "up"); + bind("A-Down", "MoveToEdge", "down"); +} + static void post_processing(void) { if (!wl_list_length(&rc.keybinds)) { wlr_log(WLR_INFO, "load default key bindings"); - bind("A-Escape", "Exit", NULL); - bind("A-Tab", "NextWindow", NULL); - bind("A-F3", "Execute", "bemenu-run"); + load_default_key_bindings(); } if (!rc.font_name_activewindow) { -- 2.52.0