Compare commits

..

No commits in common. "85dbc986afa55bb6615b2793ea26c61a1e262435" and "622d9fe7a781b14db193fdc8aa30ffdaac3781e5" have entirely different histories.

4 changed files with 104 additions and 133 deletions

View file

@ -1,21 +1,45 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Effects
import Quickshell.Hyprland
import "../../../../config"
import "../../../../styled/"
Loader {
Item {
id: workspace
required property HyprlandWorkspace modelData
active: modelData.id > 0
sourceComponent: workspace
property Component workspace: Clickable {
id: clickable
visible: modelData.id > 0
width: Dimensions.workspace.width
height: Dimensions.workspace.height
onClicked: modelData.activate()
Rectangle {
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 {
id: icon
@ -27,11 +51,11 @@ Loader {
states: State {
name: "active"
when: modelData.active
when: workspace.modelData.active
PropertyChanges {
icon {
rotation: 180
color: clickable.hovered ? Theme.palette.basecontent : Theme.palette.primary
color: mouseArea.containsMouse ? Theme.palette.basecontent : Theme.palette.primary
}
}
}
@ -52,5 +76,14 @@ Loader {
}
}
}
MouseArea {
id: mouseArea
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onClicked: workspace.modelData.activate()
}
}

View file

@ -1,34 +1,22 @@
import Quickshell
import Quickshell.Services.Mpris
import QtQuick
import "../../../../styled/"
import "../../../../config/"
Loader {
Item {
required property MprisPlayer modelData
required property int index
signal nextPlayer
signal previousPlayer
sourceComponent: player
property Component player: Clickable {
id: clickable
implicitWidth: text.width
implicitHeight: Dimensions.mpris.height
onClicked: {
if (!modelData.canTogglePlaying) {
return;
StyledLabel {
anchors.fill: text
}
if (modelData.isPlaying) {
modelData.pause();
} else {
modelData.play();
}
}
onScrolledUp: parent.nextPlayer()
onScrolledDown: parent.previousPlayer()
StyledText {
id: text
@ -41,25 +29,28 @@ Loader {
rightPadding: Dimensions.mpris.horizontalPadding
font.pixelSize: Dimensions.mpris.fontSize
}
states: State {
name: "hovered"
when: clickable.hovered
PropertyChanges {
text {
color: Theme.palette.base300
MouseArea {
anchors.fill: text
cursorShape: Qt.PointingHandCursor
onClicked: {
if (!modelData.canTogglePlaying) {
return;
}
if (modelData.isPlaying) {
modelData.pause();
} else {
modelData.play();
}
}
}
transitions: Transition {
from: ""
to: "hovered"
reversible: true
ColorAnimation {
properties: "color"
duration: 200
easing.type: Easing.InOutCubic
}
onWheel: event => {
if (event.angleDelta.y > 0) {
parent.nextPlayer();
} else if (event.angleDelta.y < 0) {
parent.previousPlayer();
}
}
}

View file

@ -1,53 +0,0 @@
import QtQuick
import "../config/"
Item {
id: root
property bool disabled: false
property alias hovered: mouseArea.containsMouse
signal clicked
signal scrolledUp
signal scrolledDown
StyledLabel {
id: background
anchors.fill: parent
states: State {
name: "hovered"
when: mouseArea.containsMouse
PropertyChanges {
background {
color: Theme.palette.primary
}
}
}
transitions: Transition {
from: ""
to: "hovered"
reversible: true
ColorAnimation {
properties: "color"
duration: 200
easing.type: Easing.InOutCubic
}
}
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: !disabled
cursorShape: Qt.PointingHandCursor
onClicked: root.clicked()
onWheel: event => {
if (event.angleDelta.y > 0) {
root.scrolledUp();
} else if (event.angleDelta.y < 0) {
root.scrolledDown();
}
}
}
}