switch workspace to clickable
This commit is contained in:
parent
903803bdfd
commit
85dbc986af
1 changed files with 42 additions and 75 deletions
|
|
@ -1,45 +1,21 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
|
||||||
import QtQuick.Effects
|
|
||||||
import Quickshell.Hyprland
|
import Quickshell.Hyprland
|
||||||
import "../../../../config"
|
import "../../../../config"
|
||||||
import "../../../../styled/"
|
import "../../../../styled/"
|
||||||
|
|
||||||
Item {
|
Loader {
|
||||||
id: workspace
|
|
||||||
|
|
||||||
required property HyprlandWorkspace modelData
|
required property HyprlandWorkspace modelData
|
||||||
|
|
||||||
visible: modelData.id > 0
|
active: modelData.id > 0
|
||||||
|
|
||||||
|
sourceComponent: workspace
|
||||||
|
property Component workspace: Clickable {
|
||||||
|
id: clickable
|
||||||
|
|
||||||
width: Dimensions.workspace.width
|
width: Dimensions.workspace.width
|
||||||
height: Dimensions.workspace.height
|
height: Dimensions.workspace.height
|
||||||
|
|
||||||
Rectangle {
|
onClicked: modelData.activate()
|
||||||
id: rectangle
|
|
||||||
anchors.fill: parent
|
|
||||||
color: Theme.palette.base100
|
|
||||||
radius: Dimensions.radius
|
|
||||||
states: State {
|
|
||||||
name: "hovered"
|
|
||||||
when: mouseArea.containsMouse
|
|
||||||
PropertyChanges {
|
|
||||||
rectangle {
|
|
||||||
color: Theme.palette.primary
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
transitions: Transition {
|
|
||||||
from: ""
|
|
||||||
to: "hovered"
|
|
||||||
reversible: true
|
|
||||||
ColorAnimation {
|
|
||||||
properties: "color"
|
|
||||||
duration: 200
|
|
||||||
easing.type: Easing.InOutCubic
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Icon {
|
Icon {
|
||||||
id: icon
|
id: icon
|
||||||
|
|
@ -51,11 +27,11 @@ Item {
|
||||||
|
|
||||||
states: State {
|
states: State {
|
||||||
name: "active"
|
name: "active"
|
||||||
when: workspace.modelData.active
|
when: modelData.active
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
icon {
|
icon {
|
||||||
rotation: 180
|
rotation: 180
|
||||||
color: mouseArea.containsMouse ? Theme.palette.basecontent : Theme.palette.primary
|
color: clickable.hovered ? Theme.palette.basecontent : Theme.palette.primary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -76,14 +52,5 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: mouseArea
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
|
|
||||||
hoverEnabled: true
|
|
||||||
onClicked: workspace.modelData.activate()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue