Default laptop key set to capslock. Keys that can be set to fenrir key or script key selectable via checkbox.
This commit is contained in:
1 parent
47f18fdd28
commit
15e04aa8f8
47 files changed
+1560
-351
No files matched your search
@@ -37,6 +37,13 @@ static int console_state(int fd, int *mode, unsigned char *leds) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int toggle_caps_lock(int fd) {
|
||||
unsigned char leds;
|
||||
if (ioctl(fd, KDGKBLED, &leds) < 0) return -errno;
|
||||
if (ioctl(fd, KDSKBLED, (unsigned long)(leds ^ LED_CAP)) < 0) return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int console_usage(int fd, unsigned short *mask) {
|
||||
struct vt_stat state;
|
||||
if (ioctl(fd, VT_GETSTATE, &state) < 0) return -errno;
|
||||
@@ -398,6 +405,16 @@ func (k *Keyboards) drain(device *Device, numLock bool, handle func(input.Decisi
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
if decision.ToggleCapsLock {
|
||||
file, err := os.OpenFile("/dev/tty0", os.O_RDONLY|syscall.O_NOCTTY, 0)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
toggleErr := kernel_error(C.toggle_caps_lock(C.int(file.Fd())))
|
||||
if err := errors.Join(toggleErr, file.Close()); err != nil {
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
if decision.Forward {
|
||||
if err := device.forward(uint16(event._type), uint16(event.code), int32(event.value)); err != nil {
|
||||
return false, err
|
||||
|
||||
Reference in new issue
Block a user