suggestion picker: a persistent layer to complement virtual keyboards like wvkbd
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | config.def.h | 26 | ||||
| -rw-r--r-- | keyboard.c | 5 | ||||
| -rw-r--r-- | main.c | 10 |
4 files changed, 41 insertions, 2 deletions
@@ -9,7 +9,7 @@ PKGS = wayland-client xkbcommon pangocairo WVKBD_SOURCES += $(wildcard $(SRC)/*.c) WVKBD_HEADERS += $(wildcard $(SRC)/*.h) -CFLAGS += -std=gnu99 -Wall -g -DWITH_WAYLAND_SHM -DLAYOUT=\"layout.${LAYOUT}.h\" +CFLAGS += -std=gnu99 -Wall -g -DWITH_WAYLAND_SHM -DLAYOUT=\"layout.${LAYOUT}.h\" -DKEYMAP=\"keymap.${LAYOUT}.h\" CFLAGS += $(shell pkg-config --cflags $(PKGS)) LDFLAGS =$(shell pkg-config --libs $(PKGS)) -lm -lutil -lrt diff --git a/config.def.h b/config.def.h index 266ba81..a6227a6 100644 --- a/config.def.h +++ b/config.def.h @@ -3,5 +3,31 @@ static const char *default_font = "Monospace 15"; +struct clr_scheme scheme = { + /* colors */ + .bg = {.bgra = {15, 15, 15, 225}}, + .fg = {.bgra = {45, 45, 45, 225}}, + .high = {.bgra = {100, 100, 100, 225}}, + .text = {.color = UINT32_MAX}, +}; +struct clr_scheme scheme1 = { + /* colors */ + .bg = {.bgra = {15, 15, 15, 225}}, + .fg = {.bgra = {32, 32, 32, 225}}, + .high = {.bgra = {100, 100, 100, 225}}, + .text = {.color = UINT32_MAX}, +}; + +/* layers is an ordered list of layouts, used to cycle through */ +static enum layout_id layers[] = { + Full, //First layout is the default layout on startup + Special, + Emoji, + Simple, + Cyrillic, + Arabic, + NumLayouts //signals the last item, may not be omitted +}; + #endif // config_def_h_INCLUDED @@ -13,6 +13,11 @@ fprintf(stderr, __VA_ARGS__); \ exit(1) +#ifndef KEYMAP +#error "make sure to define KEYMAP" +#endif +#include KEYMAP + void kbd_switch_layout(struct kbd *kb, struct layout *l) { kb->prevlayout = kb->layout; @@ -8,7 +8,6 @@ #include <wayland-client.h> #include <wchar.h> -#include "drw.h" #include "keyboard.h" #include "config.h" @@ -42,6 +41,7 @@ static uint32_t anchor = ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM | /* application state */ static bool run_display = true; static int cur_x = -1, cur_y = -1; +static struct kbd keyboard; /* event handler prototypes */ static void wl_pointer_enter(void *data, struct wl_pointer *wl_pointer, @@ -333,6 +333,14 @@ main(int argc, char **argv) { if ((tmp = getenv("WVKBD_HEIGHT"))) height = atoi(tmp); + /* keyboard settings */ + keyboard.layers = (enum layout_id *) &layers; + keyboard.scheme = scheme; + keyboard.layer_index = 0; + keyboard.scheme1 = scheme1; + keyboard.scheme1 = scheme1; + + int i; for (i = 1; argv[i]; i++) { if ((!strcmp(argv[i], "-v")) || (!strcmp(argv[i], "--version"))) { |