active window title + workspace fix

This commit is contained in:
end-4
2025-04-11 17:10:19 +02:00
parent c29041aa9e
commit 06fc4baf4e
7 changed files with 61 additions and 10 deletions
@@ -0,0 +1,39 @@
import "../common"
import "../common/widgets"
import QtQuick
import QtQuick.Layouts
import Quickshell.Wayland
import Quickshell.Hyprland
Rectangle {
required property var bar
readonly property HyprlandMonitor monitor: Hyprland.monitorFor(bar.screen)
readonly property Toplevel activeWindow: ToplevelManager.activeToplevel
height: parent.height
width: colLayout.width
color: "transparent"
Layout.leftMargin: Appearance.rounding.screenRounding
ColumnLayout {
id: colLayout
anchors.centerIn: parent
spacing: -4
StyledText {
font.pointSize: Appearance.font.pointSize.smaller
color: Appearance.colors.colSubtext
text: activeWindow.activated ? activeWindow?.appId : "Desktop"
}
StyledText {
font.pointSize: Appearance.font.pointSize.small
color: Appearance.colors.colOnLayer0
text: activeWindow.activated ? activeWindow?.title : `Workspace ${monitor.activeWorkspace?.id}`
}
}
}
+7
View File
@@ -6,6 +6,7 @@ import Quickshell
Scope {
id: bar
readonly property int barHeight: 40
readonly property int sideCenterModuleWidth: 360
@@ -24,6 +25,12 @@ Scope {
// Left section
RowLayout {
anchors.left: parent.left
implicitHeight: barHeight
ActiveWindow {
bar: barRoot
}
}
// Middle section
@@ -16,7 +16,6 @@ Rectangle {
anchors.centerIn: parent
StyledText {
font.family: Appearance.font.family.title
font.pointSize: Appearance.font.pointSize.large
color: Appearance.colors.colOnLayer1
text: DateTime.time
@@ -32,9 +32,6 @@ Rectangle {
workspaceOccupied = Array.from({ length: ConfigOptions.bar.workspacesShown }, (_, i) => {
return Hyprland.workspaces.values.some(ws => ws.id === workspaceGroup * ConfigOptions.bar.workspacesShown + i + 1);
})
if(!activeWindow?.activated) {
workspaceOccupied[(monitor.activeWorkspace?.id - 1) % ConfigOptions.bar.workspacesShown] = false;
}
}
// Initialize workspaceOccupied when the component is created
@@ -48,7 +45,6 @@ Rectangle {
}
}
Layout.fillHeight: true
implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 2
implicitHeight: 40
@@ -92,8 +88,8 @@ Rectangle {
implicitWidth: workspaceButtonWidth
implicitHeight: workspaceButtonWidth
radius: Appearance.rounding.full
property var radiusLeft: workspaceOccupied[index-1] ? 0 : Appearance.rounding.full
property var radiusRight: workspaceOccupied[index+1] ? 0 : Appearance.rounding.full
property var radiusLeft: (workspaceOccupied[index-1] && !(!activeWindow?.activated && monitor.activeWorkspace?.id === index)) ? 0 : Appearance.rounding.full
property var radiusRight: (workspaceOccupied[index+1] && !(!activeWindow?.activated && monitor.activeWorkspace?.id === index+2)) ? 0 : Appearance.rounding.full
topLeftRadius: radiusLeft
bottomLeftRadius: radiusLeft
@@ -101,7 +97,7 @@ Rectangle {
bottomRightRadius: radiusRight
color: Appearance.colors.colLayer2
opacity: workspaceOccupied[index] ? 1 : 0
opacity: (workspaceOccupied[index] && !(!activeWindow?.activated && monitor.activeWorkspace?.id === index+1)) ? 1 : 0
Behavior on opacity {
NumberAnimation {
@@ -95,6 +95,7 @@ Singleton {
}
colors: QtObject {
property color colSubtext: m3colors.m3outline
property color colLayer0: m3colors.m3background
property color colOnLayer0: m3colors.m3onBackground
property color colLayer0Hover: mix(colLayer0, colOnLayer0, 0.85)
@@ -119,6 +120,7 @@ Singleton {
property int normal: 17
property int large: 25
property int full: 9999
property int screenRounding: large
}
font: QtObject {
@@ -60,8 +60,8 @@ Singleton {
}
function onTrackArtUrlChanged() {
console.log("arturl:", activePlayer.trackArtUrl)
//root.updateTrack();
// console.log("arturl:", activePlayer.trackArtUrl)
// root.updateTrack();
if (root.activePlayer.uniqueId == root.activeTrack.uniqueId && root.activePlayer.trackArtUrl != root.activeTrack.artUrl) {
// cantata likes to send cover updates *BEFORE* updating the track info.
// as such, art url changes shouldn't be able to break the reverse animation
@@ -19,6 +19,12 @@ Item {
onValueChanged: {
canvas.degree = value * 360;
}
onPrimaryColorChanged: {
canvas.requestPaint();
}
onSecondaryColorChanged: {
canvas.requestPaint();
}
Canvas {
id: canvas
@@ -27,9 +33,11 @@ Item {
anchors.fill: parent
antialiasing: true
onDegreeChanged: {
requestPaint();
}
onPaint: {
var ctx = getContext("2d");
var x = root.width / 2;