Fix Warnings and implements Systray
This commit is contained in:
@@ -8,7 +8,8 @@ import qs.Common
|
||||
import qs.Services
|
||||
|
||||
WrapperMouseArea {
|
||||
id: workspacesRoot
|
||||
id: workspacesWidget
|
||||
|
||||
property var monitor: "black"
|
||||
|
||||
onWheel: (wheel) => {
|
||||
@@ -26,28 +27,39 @@ WrapperMouseArea {
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
||||
property var monitor: workspacesWidget.monitor
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
||||
|
||||
Repeater {
|
||||
|
||||
property var monitor: parent.monitor
|
||||
|
||||
model: 5
|
||||
|
||||
delegate: Rectangle {
|
||||
id: workspacesRectangle
|
||||
|
||||
required property var modelData
|
||||
property var index: modelData // Get the workspace data from the model
|
||||
property var workspace: {
|
||||
workspacesRoot.monitor === "DP-2" ? Hyprland.workspaces.values[index + 5] : Hyprland.workspaces.values[index];
|
||||
}
|
||||
property int workspaceIndex: parent.monitor === "DP-2" ? modelData + 5 : modelData
|
||||
property int workspaceIndexAlign: workspaceIndex+1
|
||||
property var workspace: Hyprland.workspaces.values.length > workspaceIndex ? Hyprland.workspaces.values[workspaceIndex] : null
|
||||
property var topLevels: HyprlandService.topLevelWorkspaces
|
||||
property bool workspaceActive: workspace === Hyprland.focusedWorkspace? true:false
|
||||
property var hasTopLevel: topLevels.filter(topLevelworkspace => topLevelworkspace.id === workspaceIndexAlign).length ? true:false
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
||||
implicitHeight: Theme.heightGaps
|
||||
implicitWidth: workspace.id === Hyprland.focusedWorkspace.id ? Theme.barSize* 1.5 : Theme.barSize
|
||||
implicitWidth: workspaceActive? Theme.barSize* 1.5 : Theme.barSize
|
||||
radius: 25
|
||||
color: {
|
||||
if (workspace.id === Hyprland.focusedWorkspace.id) {
|
||||
if (workspaceActive) {
|
||||
return Theme.color6
|
||||
}
|
||||
if (HyprlandService.topLevelWorkspaces.filter(topLevelworkspace => topLevelworkspace.id === workspace.id).length) {
|
||||
if (hasTopLevel) {
|
||||
|
||||
return Theme.backgroudColorBright
|
||||
}
|
||||
return Theme.backgroudColor
|
||||
@@ -55,27 +67,45 @@ WrapperMouseArea {
|
||||
|
||||
PopupWindow {
|
||||
id: workspacesPopUp
|
||||
|
||||
property int workspaceIndexAlign: workspacesRectangle.workspaceIndexAlign
|
||||
|
||||
anchor.item: workspacesRectangle
|
||||
anchor.rect.y: workspacesRectangle.implicitHeight+5
|
||||
anchor.rect.x: -implicitWidth/2 + workspacesRectangle.implicitWidth/2
|
||||
implicitWidth: wsPopUpRow.implicitWidth*1.6
|
||||
implicitHeight: 35
|
||||
implicitWidth: wsPopUp.implicitWidth
|
||||
implicitHeight: wsPopUp.implicitHeight
|
||||
color:"transparent"
|
||||
WrapperRectangle {
|
||||
id: wsPopUp
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
property int workspaceIndexAlign: workspacesPopUp.workspaceIndexAlign
|
||||
|
||||
leftMargin: Theme.gaps*2
|
||||
rightMargin: Theme.gaps*2
|
||||
topMargin: Theme.gaps
|
||||
bottomMargin: Theme.gaps
|
||||
color: Theme.backgroudColor
|
||||
radius: 25
|
||||
|
||||
RowLayout {
|
||||
id: wsPopUpRow
|
||||
|
||||
property int workspaceIndexAlign: parent.workspaceIndexAlign
|
||||
|
||||
anchors{
|
||||
horizontalCenter:parent.horizontalCenter
|
||||
verticalCenter:parent.verticalCenter
|
||||
}
|
||||
id: wsPopUpRow
|
||||
Repeater {
|
||||
model: HyprlandService.sortedDesktopApplications.get(workspacesRectangle.workspace.id)
|
||||
|
||||
property var modelo: HyprlandService.sortedDesktopApplications.get(parent.workspaceIndexAlign)
|
||||
|
||||
model: modelo
|
||||
delegate: IconImage {
|
||||
|
||||
required property var modelData
|
||||
|
||||
width:30; height:30
|
||||
source: (modelData && modelData.icon) ? Quickshell.iconPath(modelData.icon, 1) : ""
|
||||
}
|
||||
@@ -85,12 +115,16 @@ WrapperMouseArea {
|
||||
}
|
||||
Timer {
|
||||
id: workspacesTimer
|
||||
|
||||
interval: 300
|
||||
onTriggered: { workspacesPopUp.visible = true }
|
||||
}
|
||||
Text {
|
||||
|
||||
property int workspaceName: workspacesRectangle.workspaceIndexAlign > 5? workspacesRectangle.workspaceIndexAlign -5: workspacesRectangle.workspaceIndexAlign
|
||||
|
||||
anchors.centerIn: parent
|
||||
text: workspacesRoot.monitor === "DP-2" ? workspacesRectangle.workspace.id - 5 : workspacesRectangle.workspace.id
|
||||
text: workspaceName
|
||||
font.bold: true
|
||||
font.pixelSize: 14
|
||||
font.family: Theme.fontFamily
|
||||
@@ -100,7 +134,7 @@ WrapperMouseArea {
|
||||
MouseArea {
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
if (HyprlandService.sortedDesktopApplications.get(workspacesRectangle.workspace.id)){
|
||||
if (parent.hasTopLevel) {
|
||||
workspacesTimer.start()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user