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": {
|
"font": {
|
||||||
"scale": 1,
|
"scale": 1,
|
||||||
"clock": "Rubik",
|
"clock": "Rubik",
|
||||||
|
"workspaces": "Rubik",
|
||||||
"headline": {
|
"headline": {
|
||||||
"family": "GoogleSansFlex",
|
"family": "GoogleSansFlex",
|
||||||
"large": { "size": 32, "weight": 500, "italic": false, "vaxes": { "ROND": 25 } },
|
"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)
|
color: Config.bar.workspaces.occupiedBg || root.isOccupied || root.activeWsId === root.ws ? Colours.palette.m3onSurface : Colours.layer(Colours.palette.m3outlineVariant, 2)
|
||||||
verticalAlignment: Qt.AlignVCenter
|
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 {
|
Loader {
|
||||||
|
|
|
||||||
|
|
@ -188,6 +188,8 @@ class AppearanceFont : public ConfigObject {
|
||||||
CONFIG_SUBOBJECT(FontStyleConfig, mono)
|
CONFIG_SUBOBJECT(FontStyleConfig, mono)
|
||||||
CONFIG_SUBOBJECT(IconFontStyleConfig, icon)
|
CONFIG_SUBOBJECT(IconFontStyleConfig, icon)
|
||||||
CONFIG_PROPERTY(QString, clock, QStringLiteral("Rubik"))
|
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:
|
public:
|
||||||
explicit AppearanceFont(QObject* parent = nullptr)
|
explicit AppearanceFont(QObject* parent = nullptr)
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,10 @@ FontBuilder FontTokens::clock() const {
|
||||||
return FontBuilder(m_clock);
|
return FontBuilder(m_clock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString FontTokens::workspaces() const {
|
||||||
|
return m_font ? m_font->workspaces() : QString();
|
||||||
|
}
|
||||||
|
|
||||||
void FontTokens::bindFont(AppearanceFont* font) {
|
void FontTokens::bindFont(AppearanceFont* font) {
|
||||||
if (m_font == font)
|
if (m_font == font)
|
||||||
return;
|
return;
|
||||||
|
|
@ -229,6 +233,7 @@ void FontTokens::bindFont(AppearanceFont* font) {
|
||||||
|
|
||||||
connect(font, &AppearanceFont::clockChanged, this, &FontTokens::rebuildClock);
|
connect(font, &AppearanceFont::clockChanged, this, &FontTokens::rebuildClock);
|
||||||
connect(font, &AppearanceFont::scaleChanged, this, &FontTokens::rebuildScale);
|
connect(font, &AppearanceFont::scaleChanged, this, &FontTokens::rebuildScale);
|
||||||
|
connect(font, &AppearanceFont::workspacesChanged, this, &FontTokens::workspacesChanged);
|
||||||
} else {
|
} else {
|
||||||
rebuildScale();
|
rebuildScale();
|
||||||
m_headline->bind(nullptr);
|
m_headline->bind(nullptr);
|
||||||
|
|
@ -240,6 +245,7 @@ void FontTokens::bindFont(AppearanceFont* font) {
|
||||||
}
|
}
|
||||||
|
|
||||||
rebuildClock();
|
rebuildClock();
|
||||||
|
emit workspacesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FontTokens::rebuildScale() {
|
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::FontStyle* mono READ mono CONSTANT FINAL)
|
||||||
Q_PROPERTY(caelestia::config::IconFontStyle* icon READ icon 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(caelestia::config::FontBuilder clock READ clock NOTIFY clockChanged FINAL)
|
||||||
|
Q_PROPERTY(QString workspaces READ workspaces NOTIFY workspacesChanged FINAL)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FontTokens(QObject* parent = nullptr);
|
explicit FontTokens(QObject* parent = nullptr);
|
||||||
|
|
@ -144,9 +145,11 @@ public:
|
||||||
[[nodiscard]] FontStyle* mono() const;
|
[[nodiscard]] FontStyle* mono() const;
|
||||||
[[nodiscard]] IconFontStyle* icon() const;
|
[[nodiscard]] IconFontStyle* icon() const;
|
||||||
[[nodiscard]] FontBuilder clock() const;
|
[[nodiscard]] FontBuilder clock() const;
|
||||||
|
[[nodiscard]] QString workspaces() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void clockChanged();
|
void clockChanged();
|
||||||
|
void workspacesChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void rebuildClock();
|
void rebuildClock();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue