Created new hover window, theming changes
This commit is contained in:
115
Services/PopUpHover.qml
Normal file
115
Services/PopUpHover.qml
Normal file
@@ -0,0 +1,115 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
// Workspaces.qml
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
|
||||
|
||||
Singleton {
|
||||
|
||||
function start(component, type) {
|
||||
HoverMediator.component = component
|
||||
HoverMediator.type = type
|
||||
hoverTimer.start()
|
||||
}
|
||||
|
||||
function exit() {
|
||||
hoverTimer.stop()
|
||||
wsPopUp.opacity=0
|
||||
}
|
||||
|
||||
PopupWindow {
|
||||
id: hoverPopUp
|
||||
|
||||
anchor.item: HoverMediator.component
|
||||
property bool initialized: false
|
||||
anchor.rect.y: HoverMediator.y
|
||||
anchor.rect.x: (HoverMediator.x - this.implicitWidth)/2
|
||||
implicitHeight: wsPopUp.implicitHeight
|
||||
implicitWidth: wsPopUp.implicitWidth
|
||||
// implicitHeight: HoverMediator.height
|
||||
// implicitWidth: HoverMediator.width
|
||||
|
||||
color:"transparent"
|
||||
visible:true
|
||||
|
||||
Component {
|
||||
id: stub
|
||||
Text {
|
||||
text: "stub"
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: audio
|
||||
Text {
|
||||
property string sinkDescription:(HoverMediator.component && HoverMediator.component.sink)? HoverMediator.component.sink.description : ""
|
||||
text: sinkDescription
|
||||
color:"white"
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: workspaceComponent
|
||||
|
||||
RowLayout {
|
||||
id: wsPopUpRow
|
||||
|
||||
property int workspaceIndexAlign: HoverMediator.component.workspaceIndexAlign || 0
|
||||
|
||||
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) : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WrapperRectangle {
|
||||
id: wsPopUp
|
||||
|
||||
leftMargin: (Theme.gaps * 2)
|
||||
rightMargin: (Theme.gaps * 2)
|
||||
topMargin: Theme.gaps
|
||||
bottomMargin: Theme.gaps
|
||||
color: Theme.backgroudColor
|
||||
radius: 25
|
||||
opacity: 0
|
||||
Behavior on opacity {
|
||||
NumberAnimation { property: "opacity"; duration: Theme.animationDuration}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: hoverLoader
|
||||
sourceComponent: {
|
||||
if(!HoverMediator.type) return stub
|
||||
if(HoverMediator.type === "workspace") return workspaceComponent
|
||||
if(HoverMediator.type === "audio") return audio
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: hoverTimer
|
||||
|
||||
interval: 300
|
||||
onTriggered: {
|
||||
wsPopUp.opacity = 1
|
||||
// hoverPopUp.visible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user