Notification backend usable
This commit is contained in:
@@ -8,33 +8,32 @@ import Quickshell.Widgets
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
|
||||
|
||||
Singleton {
|
||||
|
||||
function start(component, type) {
|
||||
HoverMediator.component = component
|
||||
HoverMediator.type = type
|
||||
hoverPopUp.anchor.updateAnchor()
|
||||
hoverTimer.start()
|
||||
HoverMediator.component = component;
|
||||
HoverMediator.type = type;
|
||||
hoverPopUp.anchor.updateAnchor();
|
||||
hoverTimer.start();
|
||||
}
|
||||
|
||||
function exit() {
|
||||
hoverTimer.stop()
|
||||
hoverPopUp.visible = false
|
||||
hoverTimer.stop();
|
||||
hoverPopUp.visible = false;
|
||||
}
|
||||
|
||||
PopupWindow {
|
||||
id: hoverPopUp
|
||||
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
|
||||
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
|
||||
|
||||
color: "transparent"
|
||||
|
||||
color:"transparent"
|
||||
|
||||
Component {
|
||||
id: stub
|
||||
Text {
|
||||
@@ -45,15 +44,19 @@ Singleton {
|
||||
color: Theme.textColor
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Component {
|
||||
id: systray
|
||||
Text {
|
||||
text: {
|
||||
if (!HoverMediator.component.model) return ""
|
||||
if (HoverMediator.component.model.tooltipTitle) return HoverMediator.component.model.tooltipTitle
|
||||
if (HoverMediator.component.model.title) return HoverMediator.component.model.title
|
||||
else return ""
|
||||
if (!HoverMediator.component.model)
|
||||
return "";
|
||||
if (HoverMediator.component.model.tooltipTitle)
|
||||
return HoverMediator.component.model.tooltipTitle;
|
||||
if (HoverMediator.component.model.title)
|
||||
return HoverMediator.component.model.title;
|
||||
else
|
||||
return "";
|
||||
}
|
||||
font.bold: true
|
||||
font.pixelSize: Theme.pixelSize
|
||||
@@ -65,7 +68,7 @@ Singleton {
|
||||
Component {
|
||||
id: time
|
||||
Text {
|
||||
property string calendar:(HoverMediator.component.calendar)? HoverMediator.component.calendar: ""
|
||||
property string calendar: (HoverMediator.component.calendar) ? HoverMediator.component.calendar : ""
|
||||
|
||||
text: calendar
|
||||
font.bold: true
|
||||
@@ -78,7 +81,7 @@ Singleton {
|
||||
Component {
|
||||
id: audio
|
||||
Text {
|
||||
property string sinkDescription:(HoverMediator.component.sink)? HoverMediator.component.sink.description : ""
|
||||
property string sinkDescription: (HoverMediator.component.sink) ? HoverMediator.component.sink.description : ""
|
||||
text: sinkDescription
|
||||
font.bold: true
|
||||
font.pixelSize: Theme.pixelSize
|
||||
@@ -97,14 +100,15 @@ Singleton {
|
||||
|
||||
Repeater {
|
||||
|
||||
property var modelo: HyprlandService.sortedDesktopApplications.get(parent.workspaceIndexAlign)
|
||||
property var modelo: HyprlandService.sortedDesktopApplications.get(parent.workspaceIndexAlign)
|
||||
|
||||
model: modelo
|
||||
delegate: IconImage {
|
||||
|
||||
required property var modelData
|
||||
|
||||
width:30; height:30
|
||||
width: 30
|
||||
height: 30
|
||||
source: (modelData && modelData.icon) ? Quickshell.iconPath(modelData.icon, 1) : ""
|
||||
}
|
||||
}
|
||||
@@ -122,21 +126,28 @@ Singleton {
|
||||
radius: 25
|
||||
opacity: 1
|
||||
Behavior on opacity {
|
||||
NumberAnimation { property: "opacity"; duration: Theme.animationDuration}
|
||||
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
|
||||
if(HoverMediator.type === "time") return time
|
||||
if(HoverMediator.type === "systray") return systray
|
||||
if (!HoverMediator.type)
|
||||
return stub;
|
||||
if (HoverMediator.type === "workspace")
|
||||
return workspaceComponent;
|
||||
if (HoverMediator.type === "audio")
|
||||
return audio;
|
||||
if (HoverMediator.type === "time")
|
||||
return time;
|
||||
if (HoverMediator.type === "systray")
|
||||
return systray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Timer {
|
||||
@@ -145,7 +156,7 @@ Singleton {
|
||||
interval: 300
|
||||
onTriggered: {
|
||||
// wsPopUp.opacity = 1
|
||||
hoverPopUp.visible = true
|
||||
hoverPopUp.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user