116 lines
4.5 KiB
QML
116 lines
4.5 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
// Workspaces.qml
|
|
import Quickshell
|
|
import Quickshell.Hyprland
|
|
import Quickshell.Wayland
|
|
import Quickshell.Widgets
|
|
import qs.Common
|
|
|
|
WrapperMouseArea {
|
|
property var monitor: "black"
|
|
|
|
onWheel: (wheel) => {
|
|
if (wheel.angleDelta.y > 0) {
|
|
if ((Hyprland.focusedWorkspace.id) % 5 === 0)
|
|
return ;
|
|
|
|
Hyprland.dispatch("workspace " + (Hyprland.focusedWorkspace.id + 1));
|
|
} else if (wheel.angleDelta.y < 0) {
|
|
if (Hyprland.focusedWorkspace.id === 1 || Hyprland.focusedWorkspace.id === 6)
|
|
return ;
|
|
|
|
Hyprland.dispatch("workspace " + (Hyprland.focusedWorkspace.id - 1));
|
|
}
|
|
}
|
|
|
|
RowLayout {
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
|
|
|
Repeater {
|
|
model: 5
|
|
|
|
delegate: Rectangle {
|
|
property var index: modelData // Get the workspace data from the model
|
|
property var workspace: {
|
|
monitor === "DP-2" ? Hyprland.workspaces.values[index + 5] : Hyprland.workspaces.values[index];
|
|
}
|
|
|
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
|
implicitHeight: Theme.heightGaps
|
|
implicitWidth: workspace.id === Hyprland.focusedWorkspace.id ? root.implicitHeight * 1.5 : root.implicitHeight
|
|
radius: 25
|
|
color: workspace.id === Hyprland.focusedWorkspace.id ? "#4444FF" : "#44475A"
|
|
|
|
// PopupWindow {
|
|
// id: workspacesPopUp
|
|
// anchor.window: root
|
|
// anchor.rect.x: barArea.x
|
|
// anchor.rect.y: root.implicitHeight
|
|
// implicitWidth: 500
|
|
// implicitHeight: 500
|
|
// Item {
|
|
// anchors.fill: parent
|
|
// ScreencopyView {
|
|
// anchors.fill : parent
|
|
// live:true
|
|
//// captureSource: Quickshell.screens.filter(screen => screen.name == monitor)[0]
|
|
// captureSource: workspace.toplevels
|
|
// }
|
|
// MouseArea {
|
|
// anchors.fill: parent
|
|
// hoverEnabled: true
|
|
// onExited: {
|
|
// workspacesPopUp.visible = false
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
// Timer {
|
|
// id: workspacesTimer
|
|
// interval: 1000
|
|
// onTriggered: { workspacesPopUp.visible = true }
|
|
// }
|
|
Text {
|
|
anchors.centerIn: parent
|
|
text: monitor === "DP-2" ? workspace.id - 5 : workspace.id
|
|
font.bold: true
|
|
font.pixelSize: 14
|
|
font.family: root.fontFamily
|
|
color: "#F8F8F2"
|
|
}
|
|
|
|
MouseArea {
|
|
// hoverEnabled: true
|
|
// onEntered: {
|
|
// console.log(JSON.stringify(workspace.toplevels.values[0].lastIpcObject))
|
|
// workspacesTimer.start()
|
|
// }
|
|
// onExited: {
|
|
// workspacesTimer.stop()
|
|
// workspacesPopUp.visible = false
|
|
// }
|
|
|
|
anchors.fill: parent
|
|
onClicked: {
|
|
if(workspace.id === Hyprland.focusedWorkspace.id) {return} ;
|
|
Hyprland.dispatch("workspace " + workspace.id);
|
|
}
|
|
}
|
|
|
|
Behavior on implicitWidth {
|
|
NumberAnimation {
|
|
duration: 100
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|