Skip to content

Commit 0275da1

Browse files
authored
virtualKeyboard.js: Fix support for OSK ctrl and alt modifier in (#13355)
the theme. What we were doing worked with the Cinnamon theme but not with out Mint themes. This gives these keys their own style class and support for it in the theme.
1 parent c7afefa commit 0275da1

2 files changed

Lines changed: 9 additions & 17 deletions

File tree

data/theme/cinnamon-sass/widgets/_keyboard.scss

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,15 @@ $shifted_key_color: $lightest_bg_color;
4444
&.shift-key-uppercase { background-color: $shifted_key_color }
4545
&.enter-key { background-color: $accent_bg_color }
4646

47-
// TODO: pseudo class latched works better for temporarily changing the color.
48-
49-
// &.modifier-key {
50-
// background-color: $non_alpha_key_color;
47+
&.modifier-key {
48+
background-color: $non_alpha_key_color;
5149

52-
// &:focus { @include button(focus); }
53-
// &:hover, &:checked { @include button(hover); }
54-
// &:active { @include button(active); }
50+
&:hover, &:checked { @include button(hover); }
5551

56-
// &:latched {
57-
// background-color: $shifted_key_color;
58-
// }
59-
// }
52+
&:latched {
53+
background-color: $shifted_key_color;
54+
}
55+
}
6056

6157
StIcon { icon-size: 1.125em; }
6258
}

js/ui/virtualKeyboard.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ const dir_keys = [{ keyval: Clutter.KEY_Left, label: '←',
4040
{ keyval: Clutter.KEY_Down, label: '↓', extraClassName: 'non-alpha-key'},
4141
{ keyval: Clutter.KEY_Right, label: '→', extraClassName: 'non-alpha-key' }];
4242
const layout_key = { action: 'next-layout', icon: 'xsi-input-keyboard-symbolic' };
43-
const ctrl_key = { keyval: Clutter.KEY_Control_L, label: 'Ctrl', width: 1.5, modifier: 'ctrl', extraClassName: 'non-alpha-key' };
44-
const alt_key = { keyval: Clutter.KEY_Alt_L, label: 'Alt', width: 1.5, modifier: 'alt', extraClassName: 'non-alpha-key' };
43+
const ctrl_key = { keyval: Clutter.KEY_Control_L, label: 'Ctrl', width: 1.5, modifier: 'ctrl', extraClassName: 'modifier-key' };
44+
const alt_key = { keyval: Clutter.KEY_Alt_L, label: 'Alt', width: 1.5, modifier: 'alt', extraClassName: 'modifier-key' };
4545

4646
const defaultKeysPre = [
4747
[[escape_key], [tab_key], [layout_key, { width: 1.5, level: 1, extraClassName: 'shift-key-lowercase', icon: 'keyboard-shift-filled-symbolic' }], [ctrl_key, _123_key, alt_key]],
@@ -482,15 +482,11 @@ var Key = GObject.registerClass({
482482
this.keyButton.add_style_pseudo_class('latched');
483483
if (is_shift && this._icon) {
484484
this._icon.icon_name = 'keyboard-caps-lock-filled-symbolic';
485-
} else {
486-
this.keyButton.add_style_class_name('shift-key-uppercase');
487485
}
488486
} else {
489487
this.keyButton.remove_style_pseudo_class('latched');
490488
if (is_shift && this._icon) {
491489
this._icon.icon_name = 'keyboard-shift-filled-symbolic';
492-
} else {
493-
this.keyButton.remove_style_class_name('shift-key-uppercase');
494490
}
495491
}
496492
}

0 commit comments

Comments
 (0)