lookingGlass: Stop setting font programmatically

Instead, use CSS to request a monospace font selectively where
it makes sense (the evaluator).

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7776
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3413>
This commit is contained in:
Florian Müllner 2024-07-11 19:21:05 +02:00
parent 6e0227ac3d
commit 6f2c99147c
2 changed files with 4 additions and 17 deletions

View File

@ -88,6 +88,10 @@
&:hover { border: 1px solid $fg_color; } &:hover { border: 1px solid $fg_color; }
} }
#EvalBox {
@extend %monospace;
}
// Extensions // Extensions
#lookingGlassExtensions { padding: $base_padding; } #lookingGlassExtensions { padding: $base_padding; }

View File

@ -1296,11 +1296,6 @@ class LookingGlass extends St.BoxLayout {
// Sort of magic, but...eh. // Sort of magic, but...eh.
this._maxItems = 150; this._maxItems = 150;
this._interfaceSettings = new Gio.Settings({schema_id: 'org.gnome.desktop.interface'});
this._interfaceSettings.connect('changed::monospace-font-name',
this._updateFont.bind(this));
this._updateFont();
// We want it to appear to slide out from underneath the panel // We want it to appear to slide out from underneath the panel
Main.uiGroup.add_child(this); Main.uiGroup.add_child(this);
Main.uiGroup.set_child_below_sibling(this, Main.uiGroup.set_child_below_sibling(this,
@ -1438,18 +1433,6 @@ class LookingGlass extends St.BoxLayout {
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;
} }
_updateFont() {
let fontName = this._interfaceSettings.get_string('monospace-font-name');
let fontDesc = Pango.FontDescription.from_string(fontName);
// We ignore everything but size and style; you'd be crazy to set your system-wide
// monospace font to be bold/oblique/etc. Could easily be added here.
let size = fontDesc.get_size() / 1024.;
let unit = fontDesc.get_size_is_absolute() ? 'px' : 'pt';
this.style = `
font-size: ${size}${unit};
font-family: "${fontDesc.get_family()}";`;
}
setBorderPaintTarget(obj) { setBorderPaintTarget(obj) {
if (this._borderPaintTarget != null) if (this._borderPaintTarget != null)
this._borderPaintTarget.remove_effect(this._redBorderEffect); this._borderPaintTarget.remove_effect(this._redBorderEffect);