pub struct KeyboardConfig {
pub name: &'static str,
pub layout: Option<&'static str>,
pub split_right_shift: Option<u8>,
}
Expand description
Keyboard layout and informations.
This struct is used to
- Defines keyboard basic informations (ex: name, cols, rows, …)
- Defines keyboard physical layout which is used by remapper (layout property)
§Coordination of the keyboard matrix
The rktk coordinate system has the top left as (0,0), and the coordinate values increase toward the bottom right.
§Split keyboard coordinates
For col
in keyboard config, specify the coordinates of the entire keyboard.
In other words, for a split keyboard with 7 columns on the left hand side and 7 columns on the right hand side, specify 14.
Internally, the key scan driver returns the coordinates of “only one hand.” In other words, in this case, x=0-6.
Therefore, it is necessary to convert the coordinates received from the key scan driver into the coordinates of both hands,
and for this purpose the split_right_shift
property is used.
Below is an example of a split keyboard with 14 columns and 4 rows.
[ Left ] [ Right ]
0 1 2 3 4 5 6 0 1 2 3 4 5 6 ← One-handed coordinates
↓ split_right_shift=7 (or None)
col=14 → 0 1 2 3 4 5 6 7 8 9 10 11 12 13 ← Two-handed coordinates
0 _ Q W E R T _ _ Y U I O P _
1 ...
2 ...
3 ...
↑ row=4
Fields§
§name: &'static str
The name of the keyboard.
layout: Option<&'static str>
Defines the layout of the keyboard used in the remapper.
This is a JSON object that represents the layout of the keyboard and compatible with via’s json layout format.
split_right_shift: Option<u8>
A number representing the row number that the right col starts on in a split keyboard.
If not set, cols / 2
will be automatically set,
so there is no need to set it if the number of columns on the right and left sides is the same.
Also, there is no need to set it in the case of a non-split keyboard, as it is not used.
Trait Implementations§
Source§impl Debug for KeyboardConfig
impl Debug for KeyboardConfig
Auto Trait Implementations§
impl Freeze for KeyboardConfig
impl RefUnwindSafe for KeyboardConfig
impl Send for KeyboardConfig
impl Sync for KeyboardConfig
impl Unpin for KeyboardConfig
impl UnwindSafe for KeyboardConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> FromColor<T> for T
impl<T> FromColor<T> for T
Source§fn from_color(color: T) -> T
fn from_color(color: T) -> T
Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more