diff --git a/com.github.adhec.Menu11/contents/ui/CompactRepresentation.qml b/com.github.adhec.Menu11/contents/ui/CompactRepresentation.qml index cc388de..dde7131 100644 --- a/com.github.adhec.Menu11/contents/ui/CompactRepresentation.qml +++ b/com.github.adhec.Menu11/contents/ui/CompactRepresentation.qml @@ -37,7 +37,7 @@ Item { && Plasmoid.configuration.customButtonImage.length != 0) property QtObject dashWindow: null - Plasmoid.status: dashWindow && dashWindow.visible ? PlasmaCore.Types.RequiresAttentionStatus : PlasmaCore.Types.PassiveStatus + // Plasmoid.status: dashWindow && dashWindow.visible ? PlasmaCore.Types.RequiresAttentionStatus : PlasmaCore.Types.PassiveStatus Kirigami.Icon { id: buttonIcon diff --git a/com.github.adhec.Menu11/contents/ui/MenuRepresentation.qml b/com.github.adhec.Menu11/contents/ui/MenuRepresentation.qml index d88c0c1..9c94df6 100644 --- a/com.github.adhec.Menu11/contents/ui/MenuRepresentation.qml +++ b/com.github.adhec.Menu11/contents/ui/MenuRepresentation.qml @@ -36,7 +36,7 @@ PlasmaCore.Dialog { objectName: "popupWindow" //flags: Qt.Dialog | Qt.FramelessWindowHint flags: Qt.WindowStaysOnTopHint - // location: PlasmaCore.Types.BottomEdge + location:{ if (Plasmoid.configuration.displayPosition === 1) return PlasmaCore.Types.Floating @@ -45,6 +45,7 @@ PlasmaCore.Dialog { else return Plasmoid.location } + hideOnWindowDeactivate: true property int iconSize:{ switch(Plasmoid.configuration.appsIconSize){ @@ -117,79 +118,57 @@ PlasmaCore.Dialog { } function popupPosition(width, height) { - /* var screenAvail = kicker.availableScreenRect; - var screenGeom = kicker.screenGeometry; - var screen = Qt.rect(screenAvail.x + screenGeom.x, - screenAvail.y + screenGeom.y, - screenAvail.width, - screenAvail.height); - - var offset = Kirigami.Units.smallSpacing; - - // Fall back to bottom-left of screen area when the applet is on the desktop or floating. - var x = offset; - var y = screen.height - height - offset; - var horizMidPoint; - var vertMidPoint; - - horizMidPoint = screen.x + (screen.width / 2); - vertMidPoint = screen.y + (screen.height / 2); - x = horizMidPoint - width / 2; - y = screen.y + screen.height - height - offset - panelSvg.margins.top; - - return Qt.point(x, y); - */ - var screenAvail = kicker.availableScreenRect; - var screenGeom = kicker.screenGeometry; - var screen = Qt.rect(screenAvail.x + screenGeom.x, - screenAvail.y + screenGeom.y, - screenAvail.width, - screenAvail.height); - - - var offset = Kirigami.Units.smallSpacing; - - // Fall back to bottom-left of screen area when the applet is on the desktop or floating. - var x = offset; - var y = screen.height - height - offset; - var appletTopLeft; - var horizMidPoint; - var vertMidPoint; + var screen = kicker.screenGeometry; + var panelH = kicker.height + var panelW = kicker.width + var horizMidPoint = screen.x + (screen.width / 2); + var vertMidPoint = screen.y + (screen.height / 2); + var appletTopLeft = parent.mapToGlobal(0, 0); + var offset = Kirigami.Units.smallSpacing * 2; if (Plasmoid.configuration.displayPosition === 1) { horizMidPoint = screen.x + (screen.width / 2); vertMidPoint = screen.y + (screen.height / 2); x = horizMidPoint - width / 2; y = vertMidPoint - height / 2; - } else if (Plasmoid.configuration.displayPosition === 2) { + } + + else if (Plasmoid.configuration.displayPosition === 2) { horizMidPoint = screen.x + (screen.width / 2); vertMidPoint = screen.y + (screen.height / 2); x = horizMidPoint - width / 2; - y = screen.y + screen.height - height - offset - panelSvg.margins.top; - } else if (Plasmoid.location === PlasmaCore.Types.BottomEdge) { - horizMidPoint = screen.x + (screen.width / 2); - appletTopLeft = parent.mapToGlobal(0, 0); - x = (appletTopLeft.x < horizMidPoint) ? screen.x + offset : (screen.x + screen.width) - width - offset; - y = screen.y + screen.height - height - offset - panelSvg.margins.top; - } else if (Plasmoid.location === PlasmaCore.Types.TopEdge) { - horizMidPoint = screen.x + (screen.width / 2); - var appletBottomLeft = parent.mapToGlobal(0, parent.height); - x = (appletBottomLeft.x < horizMidPoint) ? screen.x + offset : (screen.x + screen.width) - width - offset; - //y = screen.y + parent.height + panelSvg.margins.bottom + offset; - y = screen.y + panelSvg.margins.bottom + offset; - } else if (Plasmoid.location === PlasmaCore.Types.LeftEdge) { - vertMidPoint = screen.y + (screen.height / 2); - appletTopLeft = parent.mapToGlobal(0, 0); - x = appletTopLeft.x*2 + parent.width + panelSvg.margins.right + offset; - y = screen.y + (appletTopLeft.y < vertMidPoint) ? screen.y + offset : (screen.y + screen.height) - height - offset; - } else if (Plasmoid.location === PlasmaCore.Types.RightEdge) { - vertMidPoint = screen.y + (screen.height / 2); - appletTopLeft = parent.mapToGlobal(0, 0); - x = appletTopLeft.x - panelSvg.margins.left - offset - width; - y = screen.y + (appletTopLeft.y < vertMidPoint) ? screen.y + offset : (screen.y + screen.height) - height - offset; + y = screen.y + screen.height - height - offset - panelH - Kirigami.Units.gridUnit; } + + else { + switch (plasmoid.location) { + case PlasmaCore.Types.BottomEdge: + var y = appletTopLeft.y - height - offset + var x = appletTopLeft.x + break; + + case PlasmaCore.Types.TopEdge: + x = appletTopLeft.x < screen.width - width ? appletTopLeft.x + panelW - Kirigami.Units.gridUnit / 3 : screen.width - width; + y = appletTopLeft.y + kicker.height + Kirigami.Units.gridUnit + break; + + case PlasmaCore.Types.LeftEdge: + x = appletTopLeft.x + panelW + Kirigami.Units.gridUnit / 2; + y = appletTopLeft.y < screen.height - height ? appletTopLeft.y : appletTopLeft.y - height + iconUser.height / 2; + break; + + case PlasmaCore.Types.RightEdge: + x = appletTopLeft.x - width - Kirigami.Units.gridUnit / 2; + y = appletTopLeft.y < screen.height - height ? appletTopLeft.y : screen.height - height - Kirigami.Units.gridUnit / 5; + break; + + default: + return; + } + } + return Qt.point(x, y); }