mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
rog-aura: adjustment of layouts and key sizes
This commit is contained in:
@@ -125,19 +125,19 @@ row = [
|
|||||||
|
|
||||||
[[rows]]
|
[[rows]]
|
||||||
row = [
|
row = [
|
||||||
'ArrowSpacer',
|
'FuncSpacer',
|
||||||
'ArrowSpacer',
|
'FuncSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'Left',
|
'Left',
|
||||||
'Down',
|
'Down',
|
||||||
'Right',
|
'Right',
|
||||||
|
|||||||
@@ -143,19 +143,19 @@ row = [
|
|||||||
|
|
||||||
[[rows]]
|
[[rows]]
|
||||||
row = [
|
row = [
|
||||||
'ArrowSpacer',
|
'FuncSpacer',
|
||||||
'ArrowSpacer',
|
'FuncSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'ArrowSpacer',
|
'NormalSpacer',
|
||||||
'Left',
|
'Left',
|
||||||
'Down',
|
'Down',
|
||||||
'Right',
|
'Right',
|
||||||
|
|||||||
@@ -205,11 +205,11 @@ impl KeyShape {
|
|||||||
Self::Space => 5.0,
|
Self::Space => 5.0,
|
||||||
Self::Space5 => 1.0,
|
Self::Space5 => 1.0,
|
||||||
Self::LCtrlMed => 1.1,
|
Self::LCtrlMed => 1.1,
|
||||||
Self::LShift => 2.1,
|
Self::LShift => 2.0,
|
||||||
Self::LShift3 => 0.67,
|
Self::LShift3 => 0.67,
|
||||||
Self::RShift => 2.7,
|
Self::RShift => 2.8,
|
||||||
Self::RshiftSmall => 1.7,
|
Self::RshiftSmall => 1.7,
|
||||||
Self::RShift3 => 0.9,
|
Self::RShift3 => 0.93,
|
||||||
Self::Return => 2.2,
|
Self::Return => 2.2,
|
||||||
Self::Return3 => 0.7333,
|
Self::Return3 => 0.7333,
|
||||||
Self::Tab => 1.4,
|
Self::Tab => 1.4,
|
||||||
@@ -217,14 +217,16 @@ impl KeyShape {
|
|||||||
Self::Backspace => 2.0,
|
Self::Backspace => 2.0,
|
||||||
Self::Backspace3 => 0.666,
|
Self::Backspace3 => 0.666,
|
||||||
Self::ArrowRegularBlank | Self::ArrowRegularSpacer => 0.7,
|
Self::ArrowRegularBlank | Self::ArrowRegularSpacer => 0.7,
|
||||||
Self::Arrow | Self::ArrowBlank | Self::ArrowSpacer => 0.93,
|
Self::Arrow => 0.8,
|
||||||
|
Self::ArrowBlank | Self::ArrowSpacer => 1.0,
|
||||||
Self::ArrowSplit | Self::ArrowSplitBlank | Self::ArrowSplitSpacer => 1.0,
|
Self::ArrowSplit | Self::ArrowSplitBlank | Self::ArrowSplitSpacer => 1.0,
|
||||||
Self::RowEndSpacer => 0.1,
|
Self::RowEndSpacer => 0.1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub const fn uy(&self) -> f32 {
|
pub const fn uy(&self) -> f32 {
|
||||||
match self {
|
match self {
|
||||||
Self::Func | Self::RowEndSpacer => 0.8,
|
Self::Func => 0.8,
|
||||||
|
Self::RowEndSpacer => 0.1,
|
||||||
Self::FuncBlank => 0.8,
|
Self::FuncBlank => 0.8,
|
||||||
Self::FuncSpacer => 0.8,
|
Self::FuncSpacer => 0.8,
|
||||||
Self::Arrow | Self::ArrowBlank | Self::ArrowSpacer => 0.6,
|
Self::Arrow | Self::ArrowBlank | Self::ArrowSpacer => 0.6,
|
||||||
@@ -266,6 +268,20 @@ impl KeyShape {
|
|||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub const fn is_arrow_cluster(&self) -> bool {
|
||||||
|
match self {
|
||||||
|
Self::Arrow | Self::ArrowBlank | Self::ArrowSpacer => true,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const fn is_arrow_splits(&self) -> bool {
|
||||||
|
match self {
|
||||||
|
Self::ArrowSplit | Self::ArrowSplitBlank | Self::ArrowSplitSpacer => true,
|
||||||
|
_ => false,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<Key> for KeyShape {
|
impl From<Key> for KeyShape {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
let mut path = PathBuf::from(DATA_DIR);
|
let mut path = PathBuf::from(DATA_DIR);
|
||||||
#[cfg(feature = "mocking")]
|
#[cfg(feature = "mocking")]
|
||||||
{
|
{
|
||||||
board_name = "GX502".to_string();
|
board_name = "G513".to_string();
|
||||||
path.pop();
|
path.pop();
|
||||||
path.push("rog-aura");
|
path.push("rog-aura");
|
||||||
path.push("data");
|
path.push("data");
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use egui::{Color32, Vec2};
|
use egui::{Align, Color32, Vec2};
|
||||||
use rog_aura::keys::KeyShape;
|
use rog_aura::keys::KeyShape;
|
||||||
|
|
||||||
use crate::{widgets::aura_modes_group, RogApp};
|
use crate::{widgets::aura_modes_group, RogApp};
|
||||||
@@ -24,14 +24,20 @@ impl<'a> RogApp<'a> {
|
|||||||
aura_modes_group(supported, states, dbus, ui);
|
aura_modes_group(supported, states, dbus, ui);
|
||||||
|
|
||||||
ui.spacing_mut().item_spacing = egui::vec2(0.0, 0.0);
|
ui.spacing_mut().item_spacing = egui::vec2(0.0, 0.0);
|
||||||
|
let mut arrows_done = false;
|
||||||
for row in states.keyboard_layout.rows() {
|
for row in states.keyboard_layout.rows() {
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal_top(|ui| {
|
||||||
for key in row.row() {
|
for key in row.row() {
|
||||||
// your boat
|
// your boat
|
||||||
let shape = KeyShape::from(key);
|
let shape = KeyShape::from(key);
|
||||||
|
|
||||||
let label = <&str>::from(key);
|
let label = <&str>::from(key);
|
||||||
if shape.is_blank() || shape.is_spacer() {
|
if shape.is_arrow_cluster() {
|
||||||
|
if !arrows_done {
|
||||||
|
arrow_cluster(ui, colour);
|
||||||
|
arrows_done = true;
|
||||||
|
}
|
||||||
|
} else if shape.is_blank() || shape.is_spacer() {
|
||||||
blank(ui, shape);
|
blank(ui, shape);
|
||||||
} else if shape.is_group() {
|
} else if shape.is_group() {
|
||||||
key_group(ui, colour, shape.ux(), shape.uy()).on_hover_text(label);
|
key_group(ui, colour, shape.ux(), shape.uy()).on_hover_text(label);
|
||||||
@@ -93,3 +99,27 @@ fn blank(ui: &mut egui::Ui, shape: KeyShape) {
|
|||||||
ui.spacing().interact_size.y * egui::vec2(2.0 * shape.ux(), 2.0 * shape.uy());
|
ui.spacing().interact_size.y * egui::vec2(2.0 * shape.ux(), 2.0 * shape.uy());
|
||||||
ui.allocate_exact_size(desired_size, egui::Sense::click());
|
ui.allocate_exact_size(desired_size, egui::Sense::click());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Draws entire arrow cluster block. This is visibly different to the split-arrows.
|
||||||
|
fn arrow_cluster(ui: &mut egui::Ui, colour: Color32) {
|
||||||
|
let space = KeyShape::ArrowSpacer;
|
||||||
|
let shape = KeyShape::Arrow;
|
||||||
|
ui.horizontal_top(|ui| {
|
||||||
|
ui.with_layout(egui::Layout::top_down(Align::LEFT), |ui| {
|
||||||
|
blank(ui, space);
|
||||||
|
ui.horizontal(|ui| {
|
||||||
|
blank(ui, KeyShape::RowEndSpacer);
|
||||||
|
blank(ui, KeyShape::RowEndSpacer);
|
||||||
|
key_shape(ui, colour, shape).on_hover_text("Left");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
ui.with_layout(egui::Layout::top_down(Align::LEFT), |ui| {
|
||||||
|
key_shape(ui, colour, shape).on_hover_text("Up");
|
||||||
|
key_shape(ui, colour, shape).on_hover_text("Down");
|
||||||
|
});
|
||||||
|
ui.with_layout(egui::Layout::top_down(Align::LEFT), |ui| {
|
||||||
|
blank(ui, space);
|
||||||
|
key_shape(ui, colour, shape).on_hover_text("Right");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user