Created new hover window, theming changes
This commit is contained in:
108
Workspaces.qml
108
Workspaces.qml
@@ -1,3 +1,5 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
// Workspaces.qml
|
||||
@@ -33,6 +35,7 @@ WrapperMouseArea {
|
||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
||||
|
||||
Repeater {
|
||||
id:workspacesRepeater
|
||||
|
||||
property var monitor: parent.monitor
|
||||
|
||||
@@ -41,84 +44,49 @@ WrapperMouseArea {
|
||||
delegate: Rectangle {
|
||||
id: workspacesRectangle
|
||||
|
||||
property string type: "workspace"
|
||||
|
||||
required property var modelData
|
||||
property var index: modelData // Get the workspace data from the model
|
||||
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 topLevels: HyprlandService.topLevelWorkspaces
|
||||
property var hasTopLevel: topLevels.filter(topLevelworkspace => topLevelworkspace.id === workspaceIndexAlign).length ? true:false
|
||||
|
||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
||||
implicitHeight: Theme.heightGaps
|
||||
implicitWidth: workspaceActive? Theme.barSize* 1.5 : Theme.barSize
|
||||
radius: 25
|
||||
color: {
|
||||
if (workspaceActive) {
|
||||
return Theme.color6
|
||||
}
|
||||
if (hasTopLevel) {
|
||||
|
||||
return Theme.backgroudColorBright
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "Active"
|
||||
when: workspacesRectangle.workspaceActive
|
||||
PropertyChanges { workspacesRectangle{ color: Theme.color6; implicitWidth: Theme.barSize*1.5}}
|
||||
},
|
||||
State {
|
||||
name: "Filled"
|
||||
when: !workspacesRectangle.workspaceActive && workspacesRectangle.hasTopLevel
|
||||
PropertyChanges { workspacesRectangle{ color: Theme.backgroudColorBright; implicitWidth: Theme.barSize}}
|
||||
},
|
||||
State {
|
||||
name: "Empty"
|
||||
when: !workspacesRectangle.workspaceActive && !workspacesRectangle.hasTopLevel
|
||||
PropertyChanges { workspacesRectangle{ color: Theme.backgroudColor;implicitWidth: Theme.barSize}}
|
||||
}
|
||||
return Theme.backgroudColor
|
||||
]
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {duration: Theme.animationDuration}
|
||||
}
|
||||
|
||||
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: wsPopUp.implicitWidth
|
||||
implicitHeight: wsPopUp.implicitHeight
|
||||
color:"transparent"
|
||||
WrapperRectangle {
|
||||
id: wsPopUp
|
||||
|
||||
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
|
||||
}
|
||||
Repeater {
|
||||
|
||||
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) : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
Behavior on implicitWidth {
|
||||
NumberAnimation {
|
||||
duration: Theme.animationDuration
|
||||
}
|
||||
}
|
||||
Timer {
|
||||
id: workspacesTimer
|
||||
|
||||
interval: 300
|
||||
onTriggered: { workspacesPopUp.visible = true }
|
||||
}
|
||||
Text {
|
||||
|
||||
property int workspaceName: workspacesRectangle.workspaceIndexAlign > 5? workspacesRectangle.workspaceIndexAlign -5: workspacesRectangle.workspaceIndexAlign
|
||||
@@ -132,31 +100,25 @@ WrapperMouseArea {
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
if (parent.hasTopLevel) {
|
||||
workspacesTimer.start()
|
||||
// PopUpHover.show(workspacesRectangle)
|
||||
|
||||
PopUpHover.start(workspacesRectangle, "workspace")
|
||||
}
|
||||
}
|
||||
onExited: {
|
||||
workspacesTimer.stop()
|
||||
workspacesPopUp.visible = false
|
||||
// PopUpHover.exit()
|
||||
PopUpHover.exit()
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if(workspacesRectangle.workspace.id === Hyprland.focusedWorkspace.id) {return} ;
|
||||
Hyprland.dispatch("workspace " + workspacesRectangle.workspace.id);
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on implicitWidth {
|
||||
NumberAnimation {
|
||||
duration: 100
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user