From b520eb490c7b99659bdb685995e5ad4a3507cbb3 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 13 Jul 2025 17:16:14 +0800 Subject: workspace more fix + activewindow] --- bar/ActiveWindow.qml | 40 ++++++++++++++++++++++++++-------------- bar/Bar.qml | 6 ++++-- bar/Mpris.qml | 21 +++++++++++++++++++-- bar/Workspace.qml | 4 ++-- 4 files changed, 51 insertions(+), 20 deletions(-) (limited to 'bar') diff --git a/bar/ActiveWindow.qml b/bar/ActiveWindow.qml index 25e87e2..915ee25 100644 --- a/bar/ActiveWindow.qml +++ b/bar/ActiveWindow.qml @@ -11,22 +11,34 @@ Item { property var toplevel: ToplevelManager.activeToplevel property var icon: Quickshell.iconPath(AppSearch.guessIcon(toplevel?.appId), "image-missing") - RowLayout { + Rectangle { + // use IRect + implicitWidth: rowLayout.implicitWidth + General.rectMargin * 2 + implicitHeight: rowLayout.implicitHeight + General.rectMargin * 2 anchors.centerIn: parent - spacing: Bar.resourceIconTextSpacing + color: Colors.alt + radius: Style.rounding.smaller - anchors.verticalCenter: parent.verticalCenter - IconImage { - source: root.icon - implicitWidth: Bar.appIconSize - implicitHeight: Bar.appIconSize - Layout.fillHeight: true - Layout.fillWidth: false - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - } - Text { - // TOOD: if not exist, use lazyloader or something hide this - text: root.toplevel?.title + RowLayout { + id: rowLayout + anchors.centerIn: parent + spacing: Bar.resourceIconTextSpacing + + anchors.verticalCenter: parent.verticalCenter + IconImage { + source: root.icon + implicitWidth: Bar.appIconSize + implicitHeight: Bar.appIconSize + Layout.fillHeight: true + Layout.fillWidth: false + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + } + Text { + // TOOD: if not exist, use lazyloader or something hide this + // TODO: use IText + font.pixelSize: General.fontSize + text: root.toplevel?.title + } } } } diff --git a/bar/Bar.qml b/bar/Bar.qml index 3428b06..6ec1670 100644 --- a/bar/Bar.qml +++ b/bar/Bar.qml @@ -44,7 +44,7 @@ Scope { anchors { left: parent.left } - implicitWidth: workspace.width + leftRow.anchors.leftMargin + mpris.width + implicitWidth: workspace.width + leftRow.anchors.leftMargin + leftRow.anchors.rightMargin + leftRow.spacing + mpris.width implicitHeight: leftRow.height color: Qt.rgba(Colors.r, Colors.g, Colors.b, Bar.bgTransparency) radius: Bar.moduleRadius @@ -53,9 +53,11 @@ Scope { RowLayout { id: leftRow anchors.left: parent.left - anchors.leftMargin: 20 + anchors.leftMargin: Bar.moduleLeftMargin + anchors.rightMargin: Bar.moduleRightMargin // does nothing but more consistent code style (as leftRow's right is middle but leftRow will never reach middle) implicitWidth: (child.width - centerRow.width) / 2 implicitHeight: child.height + spacing: Bar.leftModuleSpacing Workspace { id: workspace diff --git a/bar/Mpris.qml b/bar/Mpris.qml index 8d56335..5abd2d4 100644 --- a/bar/Mpris.qml +++ b/bar/Mpris.qml @@ -46,10 +46,27 @@ Item { } } - Text { + implicitWidth: rect.width + 3 // +3 cause it look better somehow + + // TODO fancy animation progress bar etc. + Rectangle { + id: rect anchors.verticalCenter: parent.verticalCenter - text: root.state + " " + root.cleanedTitle + " [" + root.progress + "]" + // TODO: move to IRect + implicitWidth: text.width + General.rectMargin * 2 + implicitHeight: parent.height + color: Colors.alt + radius: Style.rounding.smaller + Text { + id: text + // TODO: use IText + font.pixelSize: General.fontSize + anchors.centerIn: parent + anchors.verticalCenter: parent.verticalCenter + text: root.state + " " + root.cleanedTitle + " [" + root.progress + "]" + } } + // hover // Text { // text: root.activePlayer.trackTitle + " by " + root.activePlayer.trackArtist + " - " + root.activePlayer.trackAlbum + root.activePlayer.position + "/" + root.activePlayer.length diff --git a/bar/Workspace.qml b/bar/Workspace.qml index 27acf03..d9e1c0a 100644 --- a/bar/Workspace.qml +++ b/bar/Workspace.qml @@ -68,12 +68,12 @@ Item { // text: isActive(index) implicitWidth: !isActive(index) ? Config.Bar.workspaceIconSize : Config.Bar.workspaceActiveIconSize - implicitHeight: Config.Bar.workspaceIconSize - 10 + implicitHeight: Config.Bar.workspaceIconSize - Config.Bar.workspaceHorizontalSpacing radius: Config.Bar.workspaceRounding Icons { anchors.centerIn: parent text: Config.Icons.ws[index + 1] - font.pixelSize: Config.Bar.workspaceIconSize / 1.9 + font.pixelSize: Config.Bar.workspaceIconSize / 2 color: Config.Colors.foreground // TODO make IText w/ ts default color opacity: !isOccupied(index) ? 0 : 1 // less contrast // opacity: isActive(index) ? Config.Bar.workspaceActiveOpacity : isOccupied(index) ? Config.Bar.workspaceOpacity : Config.Bar.workspaceEmptyOpacity -- cgit v1.2.3