Compare commits
2 commits
622d9fe7a7
...
85dbc986af
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85dbc986af | ||
|
|
903803bdfd |
4 changed files with 136 additions and 107 deletions
|
|
@ -1,89 +1,56 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Effects
|
||||
import Quickshell.Hyprland
|
||||
import "../../../../config"
|
||||
import "../../../../styled/"
|
||||
|
||||
Item {
|
||||
id: workspace
|
||||
|
||||
Loader {
|
||||
required property HyprlandWorkspace modelData
|
||||
|
||||
visible: modelData.id > 0
|
||||
active: modelData.id > 0
|
||||
|
||||
width: Dimensions.workspace.width
|
||||
height: Dimensions.workspace.height
|
||||
sourceComponent: workspace
|
||||
property Component workspace: Clickable {
|
||||
id: clickable
|
||||
|
||||
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
|
||||
width: Dimensions.workspace.width
|
||||
height: Dimensions.workspace.height
|
||||
|
||||
onClicked: modelData.activate()
|
||||
|
||||
Icon {
|
||||
id: icon
|
||||
|
||||
source: "/home/baobeld/dotfiles/quickshell/assets/triangle.svg"
|
||||
|
||||
anchors.centerIn: parent
|
||||
size: Dimensions.workspace.iconSize
|
||||
|
||||
states: State {
|
||||
name: "active"
|
||||
when: modelData.active
|
||||
PropertyChanges {
|
||||
icon {
|
||||
rotation: 180
|
||||
color: clickable.hovered ? Theme.palette.basecontent : Theme.palette.primary
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
transitions: Transition {
|
||||
from: ""
|
||||
to: "active"
|
||||
reversible: true
|
||||
ParallelAnimation {
|
||||
RotationAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.InOutCubic
|
||||
}
|
||||
ColorAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
transitions: Transition {
|
||||
from: ""
|
||||
to: "hovered"
|
||||
reversible: true
|
||||
ColorAnimation {
|
||||
properties: "color"
|
||||
duration: 200
|
||||
easing.type: Easing.InOutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Icon {
|
||||
id: icon
|
||||
|
||||
source: "/home/baobeld/dotfiles/quickshell/assets/triangle.svg"
|
||||
|
||||
anchors.centerIn: parent
|
||||
size: Dimensions.workspace.iconSize
|
||||
|
||||
states: State {
|
||||
name: "active"
|
||||
when: workspace.modelData.active
|
||||
PropertyChanges {
|
||||
icon {
|
||||
rotation: 180
|
||||
color: mouseArea.containsMouse ? Theme.palette.basecontent : Theme.palette.primary
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
transitions: Transition {
|
||||
from: ""
|
||||
to: "active"
|
||||
reversible: true
|
||||
ParallelAnimation {
|
||||
RotationAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.InOutCubic
|
||||
}
|
||||
ColorAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
hoverEnabled: true
|
||||
onClicked: workspace.modelData.activate()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ Item {
|
|||
|
||||
Player {
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
visible: index === root.currentIndex && modelData.canControl
|
||||
|
||||
|
|
|
|||
|
|
@ -1,40 +1,21 @@
|
|||
import Quickshell
|
||||
import Quickshell.Services.Mpris
|
||||
import QtQuick
|
||||
import "../../../../styled/"
|
||||
import "../../../../config/"
|
||||
|
||||
Item {
|
||||
Loader {
|
||||
required property MprisPlayer modelData
|
||||
required property int index
|
||||
|
||||
signal nextPlayer
|
||||
signal previousPlayer
|
||||
|
||||
implicitWidth: text.width
|
||||
implicitHeight: Dimensions.mpris.height
|
||||
sourceComponent: player
|
||||
property Component player: Clickable {
|
||||
id: clickable
|
||||
|
||||
StyledLabel {
|
||||
anchors.fill: text
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: text
|
||||
text: `${modelData.isPlaying ? "" : ""} ${modelData.trackTitle} - ${modelData.trackArtist}`
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
topPadding: Dimensions.mpris.verticalPadding
|
||||
bottomPadding: Dimensions.mpris.verticalPadding
|
||||
leftPadding: Dimensions.mpris.horizontalPadding
|
||||
rightPadding: Dimensions.mpris.horizontalPadding
|
||||
|
||||
font.pixelSize: Dimensions.mpris.fontSize
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: text
|
||||
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
implicitWidth: text.width
|
||||
implicitHeight: Dimensions.mpris.height
|
||||
|
||||
onClicked: {
|
||||
if (!modelData.canTogglePlaying) {
|
||||
|
|
@ -46,11 +27,39 @@ Item {
|
|||
modelData.play();
|
||||
}
|
||||
}
|
||||
onWheel: event => {
|
||||
if (event.angleDelta.y > 0) {
|
||||
parent.nextPlayer();
|
||||
} else if (event.angleDelta.y < 0) {
|
||||
parent.previousPlayer();
|
||||
onScrolledUp: parent.nextPlayer()
|
||||
onScrolledDown: parent.previousPlayer()
|
||||
|
||||
StyledText {
|
||||
id: text
|
||||
text: `${modelData.isPlaying ? "" : ""} ${modelData.trackTitle} - ${modelData.trackArtist}`
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
topPadding: Dimensions.mpris.verticalPadding
|
||||
bottomPadding: Dimensions.mpris.verticalPadding
|
||||
leftPadding: Dimensions.mpris.horizontalPadding
|
||||
rightPadding: Dimensions.mpris.horizontalPadding
|
||||
|
||||
font.pixelSize: Dimensions.mpris.fontSize
|
||||
|
||||
states: State {
|
||||
name: "hovered"
|
||||
when: clickable.hovered
|
||||
PropertyChanges {
|
||||
text {
|
||||
color: Theme.palette.base300
|
||||
}
|
||||
}
|
||||
}
|
||||
transitions: Transition {
|
||||
from: ""
|
||||
to: "hovered"
|
||||
reversible: true
|
||||
ColorAnimation {
|
||||
properties: "color"
|
||||
duration: 200
|
||||
easing.type: Easing.InOutCubic
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
53
styled/Clickable.qml
Normal file
53
styled/Clickable.qml
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue