Skip to content

Commit c08adc4

Browse files
committed
Update various style details to be consistent with design
1 parent 8871dbe commit c08adc4

File tree

5 files changed

+46
-14
lines changed

5 files changed

+46
-14
lines changed

src/keyboard.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ impl Keyboard {
211211
..add(&cascade! {
212212
gtk::Label::new(Some(&fl!("stack-keymap-desc")));
213213
..set_line_wrap(true);
214+
..set_justify(gtk::Justification::Center);
214215
..set_max_width_chars(100);
215216
..set_halign(gtk::Align::Center);
216217
});

src/picker/group_box/group/ansi.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@ use gtk::prelude::*;
22

33
use super::{PickerGroup, PickerKey};
44

5-
// TODO: somehow acount for spacing in widths?
5+
const KEY_WIDTH: f64 = 48.0;
6+
const KEY_SPACE: f64 = 4.0;
7+
8+
// A 2U key takes same space as 2 1U including spacing
9+
// 2 1.5U keys take same space as 3 1U
10+
// Space bar is the same as 3 1U + 1 1.5U to line up with previous row
611
static KEY_WIDTHS: &[(f64, &[&str])] = &[
712
(
8-
1.5,
13+
1.5 * KEY_WIDTH + 0.5 * KEY_SPACE,
914
&[
1015
"DEL",
1116
"BKSP",
@@ -18,8 +23,11 @@ static KEY_WIDTHS: &[(f64, &[&str])] = &[
1823
"RIGHT_CTRL",
1924
],
2025
),
21-
(2.0, &["LEFT_SHIFT", "RIGHT_SHIFT", "ENTER"]),
22-
(4.5, &["SPACE"]),
26+
(
27+
2.0 * KEY_WIDTH + KEY_SPACE,
28+
&["LEFT_SHIFT", "RIGHT_SHIFT", "ENTER"],
29+
),
30+
(4.5 * KEY_WIDTH + 3.5 * KEY_SPACE, &["SPACE"]),
2331
];
2432

2533
static ROWS: &[&[&str]] = &[
@@ -111,13 +119,13 @@ impl PickerAnsiGroup {
111119
None
112120
}
113121
})
114-
.unwrap_or(1.0);
115-
let key = PickerKey::new(name, width);
122+
.unwrap_or(KEY_WIDTH);
123+
let key = PickerKey::new(name, width / KEY_WIDTH);
116124
fixed.put(&key, x, y);
117125
keys.push(key);
118-
x += (48.0 * width) as i32 + 4
126+
x += width as i32 + 4
119127
}
120-
y += 48 + 4;
128+
y += KEY_WIDTH as i32 + 4;
121129
}
122130

123131
PickerAnsiGroup {

src/picker/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ impl ObjectImpl for PickerInner {
9090

9191
let stack_switcher = cascade! {
9292
gtk::StackSwitcher::new();
93+
..style_context().add_class("picker-stack-switcher");
9394
..set_stack(Some(&stack));
9495
};
9596

@@ -98,7 +99,12 @@ impl ObjectImpl for PickerInner {
9899
..set_spacing(8);
99100
..set_orientation(gtk::Orientation::Vertical);
100101
..set_halign(gtk::Align::Center);
101-
..add(&stack_switcher);
102+
..add(&cascade! {
103+
gtk::Box::new(gtk::Orientation::Vertical, 0);
104+
..add(&gtk::Separator::new(gtk::Orientation::Horizontal));
105+
..add(&stack_switcher);
106+
..add(&gtk::Separator::new(gtk::Orientation::Horizontal));
107+
});
102108
..add(&stack);
103109
..show_all();
104110
};

src/picker/tap_hold.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use gtk::{
88
use once_cell::sync::Lazy;
99
use std::cell::{Cell, RefCell};
1010

11-
use super::{group_box::PickerBasicGroup, PickerGroupBox, PickerKey};
11+
use super::{group_box::PickerBasicGroup, PickerGroupBox};
1212
use backend::{is_qmk_basic, DerefCell, Keycode, Mods};
1313

1414
#[derive(Clone, Copy, PartialEq)]
@@ -80,13 +80,13 @@ impl ObjectImpl for TapHoldInner {
8080
let hold_group_box = cascade! {
8181
PickerGroupBox::new(vec![
8282
Box::new(PickerBasicGroup::new(
83-
"Standard Modifiers".to_string(),
83+
"Modifiers".to_string(),
8484
4,
8585
1.5,
8686
MODIFIERS,
8787
)),
8888
Box::new(PickerBasicGroup::new(
89-
"Access Layer Modifiers".to_string(),
89+
"Layer Keys".to_string(),
9090
4,
9191
1.5,
9292
LAYERS,
@@ -122,9 +122,12 @@ impl ObjectImpl for TapHoldInner {
122122
}));
123123
..set_halign(gtk::Align::Start);
124124
});
125-
// TODO label groups? Use group box?
126125
..add(&hold_group_box);
127-
// TODO shift click label
126+
..add(&cascade! {
127+
gtk::Label::new(Some("Shift + click to select multiple modifiers."));
128+
..set_halign(gtk::Align::Start);
129+
});
130+
// XXX grey?
128131
..add(&cascade! {
129132
gtk::Label::new(Some("2. Select an action to use when the key is tapped."));
130133
..set_attributes(Some(&cascade! {

src/style.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,17 @@
77
border-color: #fbb86c;
88
border-width: 4px;
99
}
10+
11+
.picker-stack-switcher button {
12+
border: none;
13+
box-shadow: none;
14+
background: none;
15+
}
16+
17+
.picker-stack-switcher button:checked {
18+
border-bottom: 2px solid #fbb86c;
19+
}
20+
21+
.picker-stack-switcher button:selected {
22+
background: black;
23+
}

0 commit comments

Comments
 (0)