diff options
| author | bh <qn+git@epicurus.dev> | 2026-04-17 23:27:29 +0800 |
|---|---|---|
| committer | bh <qn+git@epicurus.dev> | 2026-04-17 23:28:35 +0800 |
| commit | 4b3c69834ba263ff527f323cd988959d791fd74a (patch) | |
| tree | 9686dea9d4c9f011e71e91c8a22e39ec14963a7b /quickshell/.config | |
| parent | 52a055967080efcf17032840baa0192cfed7efa8 (diff) | |
quickshell: stop hardcoding the window name clamping logic
Diffstat (limited to 'quickshell/.config')
| -rw-r--r-- | quickshell/.config/quickshell/shell.qml | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/quickshell/.config/quickshell/shell.qml b/quickshell/.config/quickshell/shell.qml index 1281878..a64a472 100644 --- a/quickshell/.config/quickshell/shell.qml +++ b/quickshell/.config/quickshell/shell.qml @@ -62,6 +62,7 @@ PanelWindow { // ║ 🏢 CENTER: WORKSPACES ║ // ╚══════════════════════════════════════════════════════════════╝ RowLayout { + id: workspacesRow anchors.centerIn: parent spacing: 12 @@ -257,6 +258,7 @@ PanelWindow { // ── 🪟 Window Title ─────────────────────────────────────── Rectangle { + id: windowModule color: root.bg2 Layout.fillHeight: true implicitWidth: windowRow.implicitWidth + 16 @@ -278,11 +280,9 @@ PanelWindow { color: root.fg font.family: "Source Code Pro" font.pixelSize: 14 - text: { - var title = Hyprland.activeToplevel?.title ?? "" - if (title.length > 50) return title.substring(0, 47) + "..." - return title - } + property string fullTitle: Hyprland.activeToplevel?.title ?? "" + property int maxChars: Math.max(5, Math.floor((workspacesRow.x - windowModule.x - 80) / 8)) + text: fullTitle.length > maxChars ? fullTitle.substring(0, maxChars - 3) + "..." : fullTitle } } } |
