Add LazyLoader to the hover popup, add env to wal theme folder, fix a bug in popup calendar text
This commit is contained in:
@@ -10,6 +10,9 @@ import qs.Common.Styled
|
||||
import qs.Services
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
property bool showWindow: false
|
||||
|
||||
function start(component, type) {
|
||||
HoverMediator.component = component;
|
||||
@@ -19,122 +22,7 @@ Singleton {
|
||||
|
||||
function exit() {
|
||||
hoverTimer.stop();
|
||||
hoverPopUp.visible = false;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
color: "transparent"
|
||||
|
||||
Component {
|
||||
id: stub
|
||||
StyledText {
|
||||
text: "stub"
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: systray
|
||||
StyledText {
|
||||
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 "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: time
|
||||
StyledText {
|
||||
property string calendar: (HoverMediator.component.calendar) ? HoverMediator.component.calendar : ""
|
||||
|
||||
text: calendar
|
||||
font.family: Theme.fontFamilyMono
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: audio
|
||||
StyledText {
|
||||
property string sinkDescription: (HoverMediator.component.sink) ? HoverMediator.component.sink.description : ""
|
||||
text: sinkDescription
|
||||
}
|
||||
}
|
||||
|
||||
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) : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BackgroundRectangle {
|
||||
id: wsPopUp
|
||||
|
||||
MarginWrapperManager {
|
||||
leftMargin: (Theme.gaps * 2)
|
||||
rightMargin: (Theme.gaps * 2)
|
||||
topMargin: Theme.gaps
|
||||
bottomMargin: Theme.gaps
|
||||
}
|
||||
color: Theme.backgroudColor
|
||||
radius: 25
|
||||
opacity: 1
|
||||
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;
|
||||
if (HoverMediator.type === "time")
|
||||
return time;
|
||||
if (HoverMediator.type === "systray")
|
||||
return systray;
|
||||
}
|
||||
}
|
||||
}
|
||||
root.showWindow = false;
|
||||
}
|
||||
|
||||
Timer {
|
||||
@@ -143,7 +31,129 @@ Singleton {
|
||||
interval: 300
|
||||
onTriggered: {
|
||||
// wsPopUp.opacity = 1
|
||||
hoverPopUp.visible = true;
|
||||
root.showWindow = true;
|
||||
}
|
||||
}
|
||||
|
||||
LazyLoader {
|
||||
active: root.showWindow
|
||||
component: 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
|
||||
visible: true
|
||||
|
||||
color: "transparent"
|
||||
|
||||
Component {
|
||||
id: stub
|
||||
StyledText {
|
||||
text: "stub"
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: systray
|
||||
StyledText {
|
||||
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 "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: time
|
||||
StyledText {
|
||||
property string calendar: (HoverMediator.component.calendar) ? HoverMediator.component.calendar : ""
|
||||
|
||||
text: calendar
|
||||
|
||||
textFormat: Text.AutoText
|
||||
font.family: Theme.fontFamilyMono
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: audio
|
||||
StyledText {
|
||||
property string sinkDescription: (HoverMediator.component.sink) ? HoverMediator.component.sink.description : ""
|
||||
text: sinkDescription
|
||||
}
|
||||
}
|
||||
|
||||
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) : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BackgroundRectangle {
|
||||
id: wsPopUp
|
||||
|
||||
MarginWrapperManager {
|
||||
leftMargin: (Theme.gaps * 2)
|
||||
rightMargin: (Theme.gaps * 2)
|
||||
topMargin: Theme.gaps
|
||||
bottomMargin: Theme.gaps
|
||||
}
|
||||
color: Theme.backgroudColor
|
||||
radius: 25
|
||||
opacity: 1
|
||||
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;
|
||||
if (HoverMediator.type === "time")
|
||||
return time;
|
||||
if (HoverMediator.type === "systray")
|
||||
return systray;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user