forked from Shinonome/dots-hyprland
active window title + workspace fix
This commit is contained in:
@@ -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}`
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import Quickshell
|
|||||||
|
|
||||||
Scope {
|
Scope {
|
||||||
id: bar
|
id: bar
|
||||||
|
|
||||||
readonly property int barHeight: 40
|
readonly property int barHeight: 40
|
||||||
readonly property int sideCenterModuleWidth: 360
|
readonly property int sideCenterModuleWidth: 360
|
||||||
|
|
||||||
@@ -24,6 +25,12 @@ Scope {
|
|||||||
// Left section
|
// Left section
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
implicitHeight: barHeight
|
||||||
|
|
||||||
|
ActiveWindow {
|
||||||
|
bar: barRoot
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Middle section
|
// Middle section
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ Rectangle {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
font.family: Appearance.font.family.title
|
|
||||||
font.pointSize: Appearance.font.pointSize.large
|
font.pointSize: Appearance.font.pointSize.large
|
||||||
color: Appearance.colors.colOnLayer1
|
color: Appearance.colors.colOnLayer1
|
||||||
text: DateTime.time
|
text: DateTime.time
|
||||||
|
|||||||
@@ -32,9 +32,6 @@ Rectangle {
|
|||||||
workspaceOccupied = Array.from({ length: ConfigOptions.bar.workspacesShown }, (_, i) => {
|
workspaceOccupied = Array.from({ length: ConfigOptions.bar.workspacesShown }, (_, i) => {
|
||||||
return Hyprland.workspaces.values.some(ws => ws.id === workspaceGroup * ConfigOptions.bar.workspacesShown + i + 1);
|
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
|
// Initialize workspaceOccupied when the component is created
|
||||||
@@ -48,7 +45,6 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 2
|
implicitWidth: rowLayout.implicitWidth + rowLayout.spacing * 2
|
||||||
implicitHeight: 40
|
implicitHeight: 40
|
||||||
@@ -92,8 +88,8 @@ Rectangle {
|
|||||||
implicitWidth: workspaceButtonWidth
|
implicitWidth: workspaceButtonWidth
|
||||||
implicitHeight: workspaceButtonWidth
|
implicitHeight: workspaceButtonWidth
|
||||||
radius: Appearance.rounding.full
|
radius: Appearance.rounding.full
|
||||||
property var radiusLeft: 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] ? 0 : Appearance.rounding.full
|
property var radiusRight: (workspaceOccupied[index+1] && !(!activeWindow?.activated && monitor.activeWorkspace?.id === index+2)) ? 0 : Appearance.rounding.full
|
||||||
|
|
||||||
topLeftRadius: radiusLeft
|
topLeftRadius: radiusLeft
|
||||||
bottomLeftRadius: radiusLeft
|
bottomLeftRadius: radiusLeft
|
||||||
@@ -101,7 +97,7 @@ Rectangle {
|
|||||||
bottomRightRadius: radiusRight
|
bottomRightRadius: radiusRight
|
||||||
|
|
||||||
color: Appearance.colors.colLayer2
|
color: Appearance.colors.colLayer2
|
||||||
opacity: workspaceOccupied[index] ? 1 : 0
|
opacity: (workspaceOccupied[index] && !(!activeWindow?.activated && monitor.activeWorkspace?.id === index+1)) ? 1 : 0
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
colors: QtObject {
|
colors: QtObject {
|
||||||
|
property color colSubtext: m3colors.m3outline
|
||||||
property color colLayer0: m3colors.m3background
|
property color colLayer0: m3colors.m3background
|
||||||
property color colOnLayer0: m3colors.m3onBackground
|
property color colOnLayer0: m3colors.m3onBackground
|
||||||
property color colLayer0Hover: mix(colLayer0, colOnLayer0, 0.85)
|
property color colLayer0Hover: mix(colLayer0, colOnLayer0, 0.85)
|
||||||
@@ -119,6 +120,7 @@ Singleton {
|
|||||||
property int normal: 17
|
property int normal: 17
|
||||||
property int large: 25
|
property int large: 25
|
||||||
property int full: 9999
|
property int full: 9999
|
||||||
|
property int screenRounding: large
|
||||||
}
|
}
|
||||||
|
|
||||||
font: QtObject {
|
font: QtObject {
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onTrackArtUrlChanged() {
|
function onTrackArtUrlChanged() {
|
||||||
console.log("arturl:", activePlayer.trackArtUrl)
|
// console.log("arturl:", activePlayer.trackArtUrl)
|
||||||
//root.updateTrack();
|
// root.updateTrack();
|
||||||
if (root.activePlayer.uniqueId == root.activeTrack.uniqueId && root.activePlayer.trackArtUrl != root.activeTrack.artUrl) {
|
if (root.activePlayer.uniqueId == root.activeTrack.uniqueId && root.activePlayer.trackArtUrl != root.activeTrack.artUrl) {
|
||||||
// cantata likes to send cover updates *BEFORE* updating the track info.
|
// 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
|
// as such, art url changes shouldn't be able to break the reverse animation
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ Item {
|
|||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
canvas.degree = value * 360;
|
canvas.degree = value * 360;
|
||||||
}
|
}
|
||||||
|
onPrimaryColorChanged: {
|
||||||
|
canvas.requestPaint();
|
||||||
|
}
|
||||||
|
onSecondaryColorChanged: {
|
||||||
|
canvas.requestPaint();
|
||||||
|
}
|
||||||
|
|
||||||
Canvas {
|
Canvas {
|
||||||
id: canvas
|
id: canvas
|
||||||
@@ -27,9 +33,11 @@ Item {
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
|
|
||||||
onDegreeChanged: {
|
onDegreeChanged: {
|
||||||
requestPaint();
|
requestPaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
onPaint: {
|
onPaint: {
|
||||||
var ctx = getContext("2d");
|
var ctx = getContext("2d");
|
||||||
var x = root.width / 2;
|
var x = root.width / 2;
|
||||||
|
|||||||
Reference in New Issue
Block a user