diff options
| author | Ezekiel Gonzales <141341590+notsoeazy@users.noreply.github.com> | 2026-03-15 15:55:55 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-15 18:55:55 +1100 |
| commit | b68f0bae14227a4d65303654fef4801c76f57ac0 (patch) | |
| tree | 51ccf89eb184f271c0d243d6a6e077969b68736b /modules/bar | |
| parent | bar/osicon: fix blurriness (#1271) (diff) | |
| download | caelestia-shell-b68f0bae14227a4d65303654fef4801c76f57ac0.tar.gz caelestia-shell-b68f0bae14227a4d65303654fef4801c76f57ac0.tar.bz2 caelestia-shell-b68f0bae14227a4d65303654fef4801c76f57ac0.zip | |
bar/activewindow: add compact option (#1201)
Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Diffstat (limited to 'modules/bar')
| -rw-r--r-- | modules/bar/components/ActiveWindow.qml | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/modules/bar/components/ActiveWindow.qml b/modules/bar/components/ActiveWindow.qml index 0c9b21e..b21c525 100644 --- a/modules/bar/components/ActiveWindow.qml +++ b/modules/bar/components/ActiveWindow.qml @@ -13,6 +13,18 @@ Item { required property Brightness.Monitor monitor property color colour: Colours.palette.m3primary + readonly property string windowTitle: Hypr.activeToplevel?.title ?? qsTr("Desktop") + + function getCompactName() { + if (!root.windowTitle || root.windowTitle === qsTr("Desktop")) + return qsTr("Desktop"); + // " - " (standard hyphen), " — " (em dash), " – " (en dash) + const parts = root.windowTitle.split(/\s+[\-\u2013\u2014]\s+/); + if (parts.length > 1) + return parts[parts.length - 1].trim(); + return root.windowTitle; + } + readonly property int maxHeight: { const otherModules = bar.children.filter(c => c.id && c.item !== this && c.id !== "spacer"); const otherHeight = otherModules.reduce((acc, curr) => acc + (curr.item.nonAnimHeight ?? curr.height), 0); @@ -46,7 +58,7 @@ Item { TextMetrics { id: metrics - text: Hypr.activeToplevel?.title ?? qsTr("Desktop") + text: Config.bar.activeWindow.compact ? root.getCompactName() : root.windowTitle font.pointSize: Appearance.font.size.smaller font.family: Appearance.font.family.mono elide: Qt.ElideRight |