Skip to content

Commit 40f1455

Browse files
committed
Use wvkbd keymap to generate keyboard
1 parent cc3dddc commit 40f1455

File tree

8 files changed

+2098
-138
lines changed

8 files changed

+2098
-138
lines changed

COPYING

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Copyright © 2024 ProgAndy
2+
3+
keyboard.h and layout.mobintl.h are licensed by John Sullivan
4+
<[email protected]> under the GPL v3.0 license as part of wvkbd.
5+
Unused elements have been removed from keyboard.h
6+
7+
The framework for the gtklock plugin has been copied from the
8+
gtklock-playerctl-module by Jovan Lanik which is also licensed under
9+
the GPL v3.0 license.
10+
11+
All code in this repository falls under the terms of the GPL v3.0 license,
12+
which can be found in LICENSE.

Makefile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# gtklock-virtkb-module
2+
# Copyright (c) 2024 ProgAndy
3+
4+
# Makefile
5+
6+
NAME := virtkb-module.so
7+
8+
PREFIX = /usr/local
9+
LIBDIR = $(PREFIX)/lib
10+
INSTALL = install
11+
12+
LIBS := gtk+-3.0 gmodule-export-2.0
13+
CFLAGS += -std=c11 -fPIC $(shell pkg-config --cflags $(LIBS))
14+
LDLIBS += $(shell pkg-config --libs $(LIBS))
15+
16+
SRC = $(wildcard *.c)
17+
OBJ = $(SRC:%.c=%.o)
18+
19+
TRASH = $(OBJ) $(NAME)
20+
21+
.PHONY: all clean install uninstall
22+
23+
all: $(NAME)
24+
25+
clean:
26+
@rm $(TRASH) | true
27+
28+
install:
29+
$(INSTALL) -d $(DESTDIR)$(LIBDIR)/gtklock
30+
$(INSTALL) $(NAME) $(DESTDIR)$(LIBDIR)/gtklock/$(NAME)
31+
32+
uninstall:
33+
rm -f $(DESTDIR)$(LIBDIR)/gtklock/$(NAME)
34+
35+
$(NAME): $(OBJ)
36+
$(LINK.c) -shared $^ $(LDLIBS) -o $@
37+

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
11
# gtklock-virtkb-module
2-
Provides a virtual keyboard for touchscreens on the lockscreen
2+
gtklock module adding a keyboard to the lockscreen
3+
4+
## About
5+
Adds a keyboard for password entry to the lockscreen
6+
7+
__⚠️ Module version matches the compatible gtklock version. Other versions might or might not work.__
8+
## Dependencies
9+
- GNU Make (build-time)
10+
- pkg-config (build-time)
11+
- gtk+3.0

build.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

keyboard.h

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#include <stdbool.h>
2+
#define MAX_LAYERS 25
3+
4+
enum key_type;
5+
enum key_modifier_type;
6+
struct key;
7+
struct layout;
8+
struct kbd;
9+
10+
enum key_type {
11+
Pad = 0, // Padding, not a pressable key
12+
Code, // A normal key emitting a keycode
13+
Mod, // A modifier key
14+
Copy, // Copy key, copies the unicode value specified in code (creates and
15+
// activates temporary keymap)
16+
// used for keys that are not part of the keymap
17+
Layout, // Layout switch to a specific layout
18+
BackLayer, // Layout switch to the layout that was previously active
19+
NextLayer, // Layout switch to the next layout in the layers sequence
20+
Compose, // Compose modifier key, switches to a specific associated layout
21+
// upon next keypress
22+
EndRow, // Incidates the end of a key row
23+
Last, // Indicated the end of a layout
24+
};
25+
26+
/* Modifiers passed to the virtual_keyboard protocol. They are based on
27+
* wayland's wl_keyboard, which doesn't document them.
28+
*/
29+
enum key_modifier_type {
30+
NoMod = 0,
31+
Shift = 1,
32+
CapsLock = 2,
33+
Ctrl = 4,
34+
Alt = 8,
35+
Super = 64,
36+
AltGr = 128,
37+
};
38+
39+
struct key {
40+
const char *label; // primary label
41+
const char *shift_label; // secondary label
42+
const double width; // relative width (1.0)
43+
const enum key_type type;
44+
45+
const uint32_t
46+
code; /* code: key scancode or modifier name (see
47+
* `/usr/include/linux/input-event-codes.h` for scancode names, and
48+
* `keyboard.h` for modifiers)
49+
* XKB keycodes are +8 */
50+
struct layout *layout; // pointer back to the parent layout that holds this
51+
// key
52+
const uint32_t code_mod; /* modifier to force when this key is pressed */
53+
uint8_t scheme; // index of the scheme to use
54+
bool reset_mod; /* reset modifiers when clicked */
55+
56+
// actual coordinates on the surface (pixels), will be computed automatically
57+
// for all keys
58+
uint32_t x, y, w, h;
59+
};
60+
61+
struct layout {
62+
struct key *keys;
63+
const char *keymap_name;
64+
const char *name;
65+
bool abc; //is this an alphabetical/abjad layout or not? (i.e. something that is a primary input layout)
66+
uint32_t keyheight; // absolute height (pixels)
67+
};

keyboard_module.c

Lines changed: 0 additions & 135 deletions
This file was deleted.

0 commit comments

Comments
 (0)