feat: add workspace font config
No Rubik hardcoding
This commit is contained in:
parent
ac13eec68c
commit
4684e8a24f
5 changed files with 13 additions and 1 deletions
|
|
@ -279,6 +279,7 @@ For example, to disable the bar on DP-1:
|
|||
"font": {
|
||||
"scale": 1,
|
||||
"clock": "Rubik",
|
||||
"workspaces": "Rubik",
|
||||
"headline": {
|
||||
"family": "GoogleSansFlex",
|
||||
"large": { "size": 32, "weight": 500, "italic": false, "vaxes": { "ROND": 25 } },
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ ColumnLayout {
|
|||
}
|
||||
color: Config.bar.workspaces.occupiedBg || root.isOccupied || root.activeWsId === root.ws ? Colours.palette.m3onSurface : Colours.layer(Colours.palette.m3outlineVariant, 2)
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
font.family: "Rubik" // Hard code rubik for now since google sans doesn't play well with certain unicode symbols apparently
|
||||
font.family: Tokens.font.workspaces
|
||||
}
|
||||
|
||||
Loader {
|
||||
|
|
|
|||
|
|
@ -188,6 +188,8 @@ class AppearanceFont : public ConfigObject {
|
|||
CONFIG_SUBOBJECT(FontStyleConfig, mono)
|
||||
CONFIG_SUBOBJECT(IconFontStyleConfig, icon)
|
||||
CONFIG_PROPERTY(QString, clock, QStringLiteral("Rubik"))
|
||||
// Google Sans Flex doesn't play well with unicode symbols apparently, so use Rubik instead
|
||||
CONFIG_PROPERTY(QString, workspaces, QStringLiteral("Rubik"))
|
||||
|
||||
public:
|
||||
explicit AppearanceFont(QObject* parent = nullptr)
|
||||
|
|
|
|||
|
|
@ -209,6 +209,10 @@ FontBuilder FontTokens::clock() const {
|
|||
return FontBuilder(m_clock);
|
||||
}
|
||||
|
||||
QString FontTokens::workspaces() const {
|
||||
return m_font ? m_font->workspaces() : QString();
|
||||
}
|
||||
|
||||
void FontTokens::bindFont(AppearanceFont* font) {
|
||||
if (m_font == font)
|
||||
return;
|
||||
|
|
@ -229,6 +233,7 @@ void FontTokens::bindFont(AppearanceFont* font) {
|
|||
|
||||
connect(font, &AppearanceFont::clockChanged, this, &FontTokens::rebuildClock);
|
||||
connect(font, &AppearanceFont::scaleChanged, this, &FontTokens::rebuildScale);
|
||||
connect(font, &AppearanceFont::workspacesChanged, this, &FontTokens::workspacesChanged);
|
||||
} else {
|
||||
rebuildScale();
|
||||
m_headline->bind(nullptr);
|
||||
|
|
@ -240,6 +245,7 @@ void FontTokens::bindFont(AppearanceFont* font) {
|
|||
}
|
||||
|
||||
rebuildClock();
|
||||
emit workspacesChanged();
|
||||
}
|
||||
|
||||
void FontTokens::rebuildScale() {
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ class FontTokens : public QObject {
|
|||
Q_PROPERTY(caelestia::config::FontStyle* mono READ mono CONSTANT FINAL)
|
||||
Q_PROPERTY(caelestia::config::IconFontStyle* icon READ icon CONSTANT FINAL)
|
||||
Q_PROPERTY(caelestia::config::FontBuilder clock READ clock NOTIFY clockChanged FINAL)
|
||||
Q_PROPERTY(QString workspaces READ workspaces NOTIFY workspacesChanged FINAL)
|
||||
|
||||
public:
|
||||
explicit FontTokens(QObject* parent = nullptr);
|
||||
|
|
@ -144,9 +145,11 @@ public:
|
|||
[[nodiscard]] FontStyle* mono() const;
|
||||
[[nodiscard]] IconFontStyle* icon() const;
|
||||
[[nodiscard]] FontBuilder clock() const;
|
||||
[[nodiscard]] QString workspaces() const;
|
||||
|
||||
signals:
|
||||
void clockChanged();
|
||||
void workspacesChanged();
|
||||
|
||||
private:
|
||||
void rebuildClock();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue