This commit is contained in:
2026-05-09 18:38:24 +07:00
parent fe011cb26b
commit 04ddc6bd31
8 changed files with 178 additions and 71 deletions
+17
View File
@@ -0,0 +1,17 @@
#ifndef __KEYBINDS_CALLBACKS_H
#define __KEYBINDS_CALLBACKS_H
#include "types.h"
void run(absn_server *server, const absn_arg *arg);
void kill_focus(absn_server *server, const absn_arg *arg);
void cycle_focus(absn_server *server, const absn_arg *arg);
void toggle_fullscreen(absn_server *server, const absn_arg *arg);
void increase_master_width(absn_server *server, const absn_arg *arg);
void increase_master_count(absn_server *server, const absn_arg *arg);
void quit(absn_server *server, const absn_arg *arg);
#endif
+21
View File
@@ -1,6 +1,9 @@
#ifndef __CONFIG_H_
#define __CONFIG_H_
#include "callbacks.h"
#include "types.h"
#define CURSOR_MOD WLR_MODIFIER_ALT
#define CURSOR_MOVE_BUTTON BTN_LEFT
#define CURSOR_RESIZE_BUTTON BTN_RIGHT
@@ -17,4 +20,22 @@ static const float unfocused_bc[4] = { 0.28, 0.28, 0.28, 1.0 };
#define OUTPUT_GAP 0
#define LAYOUT_GAP 0
#define ALT WLR_MODIFIER_ALT
#define CTRL WLR_MODIFIER_CTRL
#define SHIFT WLR_MODIFIER_SHIFT
#define LOGO WLR_MODIFIER_LOGO
static const absn_keybind keybinds[] = {
{ ALT, XKB_KEY_Return, &run, { .v = "alacritty" } },
{ ALT, XKB_KEY_q, kill_focus, { 0 } },
{ ALT, XKB_KEY_j, cycle_focus, { .i = +1 } },
{ ALT, XKB_KEY_k, cycle_focus, { .i = -1 } },
{ ALT, XKB_KEY_f, toggle_fullscreen, { 0 } },
{ ALT, XKB_KEY_h, increase_master_count, { .i = +1 } },
{ ALT, XKB_KEY_l, increase_master_count, { .i = -1 } },
{ ALT | SHIFT, XKB_KEY_h, increase_master_width, { .f = -0.05 } },
{ ALT | SHIFT, XKB_KEY_l, increase_master_width, { .f = +0.05 } },
{ ALT, XKB_KEY_E, quit, { 0 } },
};
#endif
-4
View File
@@ -4,10 +4,6 @@
#include "types.h"
void focus_toplevel(absn_toplevel *toplevel);
absn_toplevel *focus_get_topmost(absn_server *server);
void focus_next(absn_server *server);
void focus_prev(absn_server *server);
#endif
-4
View File
@@ -1,4 +0,0 @@
#ifndef __KEYBINDS_CALLBACKS_H
#define __KEYBINDS_CALLBACKS_H
#endif
+15 -1
View File
@@ -33,7 +33,8 @@
(L).notify = (C); \
wl_signal_add(&(E), &(L)); \
} while (0);
#define UNUSED(X) (void)(X)
#define UNUSED(X) (void)(X)
#define CLEANMASK(M) (M & ~WLR_MODIFIER_CAPS)
/* cursor mode */
enum {
@@ -224,4 +225,17 @@ typedef struct {
struct wl_listener destroy;
} absn_keyboard;
typedef struct {
int i;
float f;
const void *v;
} absn_arg;
typedef struct {
uint32_t mods;
xkb_keysym_t keysym;
void (*cb)(absn_server *, const absn_arg *);
const absn_arg arg;
} absn_keybind;
#endif /* __TYPES_H_ */