mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
rog-aura: add proper labels for keys via &str into
This commit is contained in:
@@ -53,7 +53,7 @@ row = [
|
|||||||
'Hyphen',
|
'Hyphen',
|
||||||
'Equals',
|
'Equals',
|
||||||
'BkSpc',
|
'BkSpc',
|
||||||
'Home',
|
'MediaPlay',
|
||||||
]
|
]
|
||||||
|
|
||||||
[[rows]]
|
[[rows]]
|
||||||
@@ -72,7 +72,7 @@ row = [
|
|||||||
'LBracket',
|
'LBracket',
|
||||||
'RBracket',
|
'RBracket',
|
||||||
'BackSlash',
|
'BackSlash',
|
||||||
'PgUp',
|
'MediaStop',
|
||||||
]
|
]
|
||||||
|
|
||||||
[[rows]]
|
[[rows]]
|
||||||
@@ -90,7 +90,7 @@ row = [
|
|||||||
'SemiColon',
|
'SemiColon',
|
||||||
'Quote',
|
'Quote',
|
||||||
'Return',
|
'Return',
|
||||||
'PgDn',
|
'MediaPrev',
|
||||||
]
|
]
|
||||||
|
|
||||||
[[rows]]
|
[[rows]]
|
||||||
@@ -108,7 +108,7 @@ row = [
|
|||||||
'FwdSlash',
|
'FwdSlash',
|
||||||
'RshiftSmall',
|
'RshiftSmall',
|
||||||
'UpRegular',
|
'UpRegular',
|
||||||
'End',
|
'MediaNext',
|
||||||
]
|
]
|
||||||
|
|
||||||
[[rows]]
|
[[rows]]
|
||||||
|
|||||||
145
rog-aura/src/key_to_str.rs
Normal file
145
rog-aura/src/key_to_str.rs
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
use crate::keys::Key;
|
||||||
|
|
||||||
|
impl From<Key> for &str {
|
||||||
|
fn from(k: Key) -> Self {
|
||||||
|
(&k).into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&Key> for &str {
|
||||||
|
fn from(k: &Key) -> Self {
|
||||||
|
match k {
|
||||||
|
Key::VolUp => "Volume Up",
|
||||||
|
Key::VolDown => "Volume Down",
|
||||||
|
Key::MicMute => "Mute Mic",
|
||||||
|
Key::Rog => "ROG",
|
||||||
|
Key::Fan => "Fan Control",
|
||||||
|
Key::Esc => "Escape",
|
||||||
|
Key::F1 => "F1",
|
||||||
|
Key::F2 => "F2",
|
||||||
|
Key::F3 => "F3",
|
||||||
|
Key::F4 => "F4",
|
||||||
|
Key::F5 => "F5",
|
||||||
|
Key::F6 => "F6",
|
||||||
|
Key::F7 => "F7",
|
||||||
|
Key::F8 => "F8",
|
||||||
|
Key::F9 => "F9",
|
||||||
|
Key::F10 => "F10",
|
||||||
|
Key::F11 => "F11",
|
||||||
|
Key::F12 => "F12",
|
||||||
|
Key::Del => "Delete",
|
||||||
|
Key::Tilde => "Tilde",
|
||||||
|
Key::N1 => "1",
|
||||||
|
Key::N2 => "2",
|
||||||
|
Key::N3 => "3",
|
||||||
|
Key::N4 => "4",
|
||||||
|
Key::N5 => "5",
|
||||||
|
Key::N6 => "6",
|
||||||
|
Key::N7 => "7",
|
||||||
|
Key::N8 => "8",
|
||||||
|
Key::N9 => "9",
|
||||||
|
Key::N0 => "0",
|
||||||
|
Key::Hyphen => "-",
|
||||||
|
Key::Equals => "=",
|
||||||
|
Key::BkSpc => "Backspace",
|
||||||
|
Key::BkSpc3_1 => "Backspace LED 1",
|
||||||
|
Key::BkSpc3_2 => "Backspace LED 2",
|
||||||
|
Key::BkSpc3_3 => "Backspace LED 3",
|
||||||
|
Key::Home => "Home",
|
||||||
|
Key::Tab => "Tab",
|
||||||
|
Key::Q => "Q",
|
||||||
|
Key::W => "W",
|
||||||
|
Key::E => "E",
|
||||||
|
Key::R => "R",
|
||||||
|
Key::T => "T",
|
||||||
|
Key::Y => "Y",
|
||||||
|
Key::U => "U",
|
||||||
|
Key::I => "I",
|
||||||
|
Key::O => "O",
|
||||||
|
Key::P => "P",
|
||||||
|
Key::LBracket => "[",
|
||||||
|
Key::RBracket => "]",
|
||||||
|
Key::BackSlash => "\\",
|
||||||
|
Key::PgUp => "Page Up",
|
||||||
|
Key::Caps => "Caps Lock",
|
||||||
|
Key::A => "A",
|
||||||
|
Key::S => "S",
|
||||||
|
Key::D => "D",
|
||||||
|
Key::F => "F",
|
||||||
|
Key::G => "G",
|
||||||
|
Key::H => "H",
|
||||||
|
Key::J => "J",
|
||||||
|
Key::K => "K",
|
||||||
|
Key::L => "L",
|
||||||
|
Key::SemiColon => ";",
|
||||||
|
Key::Quote => "'",
|
||||||
|
Key::Return => "Return",
|
||||||
|
Key::Return3_1 => "Return LED 1",
|
||||||
|
Key::Return3_2 => "Return LED 2",
|
||||||
|
Key::Return3_3 => "Return LED 3",
|
||||||
|
Key::PgDn => "Page Down",
|
||||||
|
Key::LShift => "Left Shift",
|
||||||
|
Key::LShift3_1 => "Left Shift LED 1",
|
||||||
|
Key::LShift3_2 => "Left Shift LED 2",
|
||||||
|
Key::LShift3_3 => "Left Shift LED 3",
|
||||||
|
Key::Z => "Z",
|
||||||
|
Key::X => "X",
|
||||||
|
Key::C => "C",
|
||||||
|
Key::V => "V",
|
||||||
|
Key::B => "B",
|
||||||
|
Key::N => "N",
|
||||||
|
Key::M => "M",
|
||||||
|
Key::Comma => ",",
|
||||||
|
Key::Period => ".",
|
||||||
|
Key::FwdSlash => "/",
|
||||||
|
Key::Rshift => "Right Shift",
|
||||||
|
Key::RshiftSmall => "Right Shift",
|
||||||
|
Key::Rshift3_1 => "Right Shift LED 1",
|
||||||
|
Key::Rshift3_2 => "Right Shift LED 2",
|
||||||
|
Key::Rshift3_3 => "Right Shift LED 3",
|
||||||
|
Key::End => "End",
|
||||||
|
Key::LCtrl => "Left Control",
|
||||||
|
Key::LCtrlMed => "Left Control",
|
||||||
|
Key::LFn => "Left Fn",
|
||||||
|
Key::Meta => "Meta",
|
||||||
|
Key::LAlt => "Left Alt",
|
||||||
|
Key::Space => "Space",
|
||||||
|
Key::Space5_1 => "Space LED 1",
|
||||||
|
Key::Space5_2 => "Space LED 2",
|
||||||
|
Key::Space5_3 => "Space LED 3",
|
||||||
|
Key::Space5_4 => "Space LED 4",
|
||||||
|
Key::Space5_5 => "Space LED 5",
|
||||||
|
Key::RAlt => "Right Alt",
|
||||||
|
Key::PrtSc => "Print Screen",
|
||||||
|
Key::RCtrl => "Right Control",
|
||||||
|
Key::Up => "Up",
|
||||||
|
Key::Down => "Down",
|
||||||
|
Key::Left => "Left",
|
||||||
|
Key::Right => "Right",
|
||||||
|
Key::UpRegular => "Up",
|
||||||
|
Key::DownRegular => "Down",
|
||||||
|
Key::LeftRegular => "Left",
|
||||||
|
Key::RightRegular => "Right",
|
||||||
|
Key::UpSplit => "Up",
|
||||||
|
Key::DownSplit => "Down",
|
||||||
|
Key::LeftSplit => "Left",
|
||||||
|
Key::RightSplit => "Right",
|
||||||
|
Key::RFn => "Right Fn",
|
||||||
|
Key::MediaPlay => "Media Play",
|
||||||
|
Key::MediaStop => "Media Stop",
|
||||||
|
Key::MediaNext => "Media Next",
|
||||||
|
Key::MediaPrev => "Media Previous",
|
||||||
|
Key::NormalBlank => "",
|
||||||
|
Key::NormalSpacer => "",
|
||||||
|
Key::FuncBlank => "",
|
||||||
|
Key::FuncSpacer => "",
|
||||||
|
Key::ArrowBlank => "",
|
||||||
|
Key::ArrowSpacer => "",
|
||||||
|
Key::ArrowRegularBlank => "",
|
||||||
|
Key::ArrowRegularSpacer => "",
|
||||||
|
Key::ArrowSplitBlank => "",
|
||||||
|
Key::ArrowSplitSpacer => "",
|
||||||
|
Key::RowEndSpacer => "",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -118,6 +118,10 @@ pub enum Key {
|
|||||||
LeftSplit,
|
LeftSplit,
|
||||||
RightSplit,
|
RightSplit,
|
||||||
RFn,
|
RFn,
|
||||||
|
MediaPlay,
|
||||||
|
MediaStop,
|
||||||
|
MediaNext,
|
||||||
|
MediaPrev,
|
||||||
NormalBlank,
|
NormalBlank,
|
||||||
/// To be ignored by per-key effects
|
/// To be ignored by per-key effects
|
||||||
NormalSpacer,
|
NormalSpacer,
|
||||||
@@ -307,9 +311,6 @@ impl From<Key> for KeyShape {
|
|||||||
Key::ArrowBlank => KeyShape::ArrowBlank,
|
Key::ArrowBlank => KeyShape::ArrowBlank,
|
||||||
Key::ArrowSpacer => KeyShape::ArrowSpacer,
|
Key::ArrowSpacer => KeyShape::ArrowSpacer,
|
||||||
|
|
||||||
Key::UpRegular | Key::LeftRegular | Key::DownRegular | Key::RightRegular => {
|
|
||||||
KeyShape::Normal
|
|
||||||
}
|
|
||||||
Key::ArrowRegularBlank => KeyShape::ArrowRegularBlank,
|
Key::ArrowRegularBlank => KeyShape::ArrowRegularBlank,
|
||||||
Key::ArrowRegularSpacer => KeyShape::ArrowRegularSpacer,
|
Key::ArrowRegularSpacer => KeyShape::ArrowRegularSpacer,
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ pub use builtin_modes::*;
|
|||||||
mod per_key_rgb;
|
mod per_key_rgb;
|
||||||
pub use per_key_rgb::*;
|
pub use per_key_rgb::*;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
|
pub mod key_to_str;
|
||||||
pub mod keys;
|
pub mod keys;
|
||||||
|
pub use key_to_str::*;
|
||||||
pub mod layouts;
|
pub mod layouts;
|
||||||
pub mod usb;
|
pub mod usb;
|
||||||
|
|
||||||
|
|||||||
@@ -193,6 +193,10 @@ impl KeyColourArray {
|
|||||||
| Key::ArrowSplitSpacer
|
| Key::ArrowSplitSpacer
|
||||||
| Key::RshiftSmall
|
| Key::RshiftSmall
|
||||||
| Key::LCtrlMed
|
| Key::LCtrlMed
|
||||||
|
| Key::MediaPlay
|
||||||
|
| Key::MediaStop
|
||||||
|
| Key::MediaPrev
|
||||||
|
| Key::MediaNext
|
||||||
| Key::RowEndSpacer => return None,
|
| Key::RowEndSpacer => return None,
|
||||||
Key::Fan | Key::Space | Key::BkSpc => return None,
|
Key::Fan | Key::Space | Key::BkSpc => return None,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
})?;
|
})?;
|
||||||
let mut board_name = String::new();
|
let mut board_name = String::new();
|
||||||
file.read_to_string(&mut board_name)?;
|
file.read_to_string(&mut board_name)?;
|
||||||
|
board_name = "G533".to_string();
|
||||||
|
|
||||||
let mut layout = KeyLayout::ga401_layout(); // default
|
let mut layout = KeyLayout::ga401_layout(); // default
|
||||||
let mut path = PathBuf::from(DATA_DIR);
|
let mut path = PathBuf::from(DATA_DIR);
|
||||||
|
|||||||
@@ -30,13 +30,12 @@ impl<'a> RogApp<'a> {
|
|||||||
// your boat
|
// your boat
|
||||||
let shape = KeyShape::from(key);
|
let shape = KeyShape::from(key);
|
||||||
|
|
||||||
|
let label = <&str>::from(key);
|
||||||
if shape.is_blank() || shape.is_spacer() {
|
if shape.is_blank() || shape.is_spacer() {
|
||||||
blank(ui, shape);
|
blank(ui, shape);
|
||||||
} else if shape.is_group() {
|
} else if shape.is_group() {
|
||||||
let label = format!("{key:?}");
|
|
||||||
key_group(ui, colour, shape.ux(), shape.uy()).on_hover_text(label);
|
key_group(ui, colour, shape.ux(), shape.uy()).on_hover_text(label);
|
||||||
} else {
|
} else {
|
||||||
let label = format!("{key:?}");
|
|
||||||
key_shape(ui, colour, shape).on_hover_text(label);
|
key_shape(ui, colour, shape).on_hover_text(label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user