Unicode: Allow setting the key used for starting Unicode input on Linux

To account for non-qwerty host-side layouts, we want to be able to easily set
the last part of the sequence used to start Unicode input on Linux. The newly
introduced `Unicode.setLinuxKey(Key_S)` function does just that.

Fixes #1063.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/1065/head
Gergely Nagy 3 years ago
parent 36938bb57b
commit a7f537cb84
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -21,17 +21,18 @@ namespace kaleidoscope {
namespace plugin { namespace plugin {
uint8_t Unicode::input_delay_; uint8_t Unicode::input_delay_;
Key Unicode::linux_key_ = Key_U;
void Unicode::start(void) { void Unicode::start(void) {
switch (::HostOS.os()) { switch (::HostOS.os()) {
case hostos::LINUX: case hostos::LINUX:
kaleidoscope::Runtime.hid().keyboard().pressRawKey(Key_LeftControl); kaleidoscope::Runtime.hid().keyboard().pressRawKey(Key_LeftControl);
kaleidoscope::Runtime.hid().keyboard().pressRawKey(Key_LeftShift); kaleidoscope::Runtime.hid().keyboard().pressRawKey(Key_LeftShift);
kaleidoscope::Runtime.hid().keyboard().pressRawKey(Key_U); kaleidoscope::Runtime.hid().keyboard().pressRawKey(linux_key_);
kaleidoscope::Runtime.hid().keyboard().sendReport(); kaleidoscope::Runtime.hid().keyboard().sendReport();
kaleidoscope::Runtime.hid().keyboard().releaseRawKey(Key_LeftControl); kaleidoscope::Runtime.hid().keyboard().releaseRawKey(Key_LeftControl);
kaleidoscope::Runtime.hid().keyboard().releaseRawKey(Key_LeftShift); kaleidoscope::Runtime.hid().keyboard().releaseRawKey(Key_LeftShift);
kaleidoscope::Runtime.hid().keyboard().releaseRawKey(Key_U); kaleidoscope::Runtime.hid().keyboard().releaseRawKey(linux_key_);
kaleidoscope::Runtime.hid().keyboard().sendReport(); kaleidoscope::Runtime.hid().keyboard().sendReport();
break; break;
case hostos::WINDOWS: case hostos::WINDOWS:

@ -39,7 +39,15 @@ class Unicode : public kaleidoscope::Plugin {
static uint8_t input_delay() { static uint8_t input_delay() {
return input_delay_; return input_delay_;
} }
static void setLinuxKey(const Key key) {
linux_key_ = key;
}
static Key getLinuxKey() {
return linux_key_;
}
private: private:
static Key linux_key_;
static uint8_t input_delay_; static uint8_t input_delay_;
}; };
} }

Loading…
Cancel
Save