Skip to content

Commit 49cca70

Browse files
authored
Merge branch 'main' into lenemter/wss-better-filter
2 parents 78d4efb + 0096d50 commit 49cca70

File tree

4 files changed

+38
-6
lines changed

4 files changed

+38
-6
lines changed

lib/Text.vala

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* SPDX-License-Identifier: LGPL-3.0-or-later
3+
* SPDX-FileCopyrightText: 2025 elementary, Inc. (https://elementary.io)
4+
*/
5+
6+
/*
7+
* Clutter.Text that automatically changes font-name to the system one
8+
*/
9+
public class Gala.Text : Clutter.Text {
10+
private static GLib.Settings gnome_interface_settings;
11+
12+
static construct {
13+
gnome_interface_settings = new GLib.Settings ("org.gnome.desktop.interface");
14+
}
15+
16+
construct {
17+
set_system_font_name ();
18+
gnome_interface_settings.changed["font-name"].connect (set_system_font_name);
19+
}
20+
21+
private void set_system_font_name () {
22+
var name = gnome_interface_settings.get_string ("font-name").split (" ");
23+
var last_element_index = name.length - 1;
24+
25+
if (int.try_parse (name[last_element_index])) { // if last element is a font-size
26+
name[last_element_index] = "12"; // hardcode size (can be changed later if needed)
27+
} else {
28+
name += "12";
29+
}
30+
31+
font_name = string.joinv (" ", name);
32+
}
33+
}

lib/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ gala_lib_sources = files(
1717
'Plugin.vala',
1818
'RoundedCornersEffect.vala',
1919
'ShadowEffect.vala',
20+
'Text.vala',
2021
'Utils.vala',
2122
'WindowIcon.vala',
2223
'WindowManager.vala',

src/Widgets/MultitaskingView/Tooltip.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class Gala.Tooltip : Clutter.Actor {
1111
/**
1212
* Actor to display the Tooltip text.
1313
*/
14-
private Clutter.Text text_actor;
14+
private Gala.Text text_actor;
1515

1616
construct {
1717
#if HAS_MUTTER47
@@ -25,7 +25,7 @@ public class Gala.Tooltip : Clutter.Actor {
2525
(uint8) Drawing.Color.TOOLTIP_TEXT_COLOR.alpha * uint8.MAX,
2626
};
2727

28-
text_actor = new Clutter.Text () {
28+
text_actor = new Gala.Text () {
2929
margin_left = 6,
3030
margin_top = 6,
3131
margin_bottom = 6,

src/Widgets/WindowSwitcher/WindowSwitcher.vala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
public class Gala.WindowSwitcher : CanvasActor, GestureTarget, RootTarget {
1111
public const int WRAPPER_PADDING = 12;
1212

13-
private const string CAPTION_FONT_NAME = "Inter";
1413
private const int MIN_OFFSET = 64;
1514
private const double GESTURE_STEP = 0.1;
1615

@@ -24,7 +23,7 @@ public class Gala.WindowSwitcher : CanvasActor, GestureTarget, RootTarget {
2423
private Gala.ModalProxy modal_proxy = null;
2524
private Drawing.StyleManager style_manager;
2625
private Clutter.Actor container;
27-
private Clutter.Text caption;
26+
private Gala.Text caption;
2827
private ShadowEffect shadow_effect;
2928
private BackgroundBlurEffect blur_effect;
3029

@@ -81,8 +80,7 @@ public class Gala.WindowSwitcher : CanvasActor, GestureTarget, RootTarget {
8180
get_accessible ().accessible_name = _("Window switcher");
8281
container.get_accessible ().accessible_role = LIST;
8382

84-
caption = new Clutter.Text () {
85-
font_name = CAPTION_FONT_NAME,
83+
caption = new Gala.Text () {
8684
ellipsize = END,
8785
line_alignment = CENTER
8886
};

0 commit comments

Comments
 (0)