mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 13:35:36 -05:00
Make popups relative based on top bar position
This commit is contained in:
@@ -14,6 +14,10 @@ PanelWindow {
|
|||||||
id: appDrawerPopout
|
id: appDrawerPopout
|
||||||
|
|
||||||
property bool isVisible: false
|
property bool isVisible: false
|
||||||
|
property real triggerX: Theme.spacingL
|
||||||
|
property real triggerY: Theme.barHeight + Theme.spacingXS
|
||||||
|
property real triggerWidth: 40
|
||||||
|
property string triggerSection: "left" // "left", "center", "right"
|
||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
appDrawerPopout.isVisible = true;
|
appDrawerPopout.isVisible = true;
|
||||||
@@ -31,6 +35,13 @@ PanelWindow {
|
|||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setTriggerPosition(x, y, width, section) {
|
||||||
|
triggerX = x;
|
||||||
|
triggerY = y;
|
||||||
|
triggerWidth = width;
|
||||||
|
triggerSection = section;
|
||||||
|
}
|
||||||
|
|
||||||
WlrLayershell.layer: WlrLayershell.Overlay
|
WlrLayershell.layer: WlrLayershell.Overlay
|
||||||
WlrLayershell.exclusiveZone: -1
|
WlrLayershell.exclusiveZone: -1
|
||||||
WlrLayershell.keyboardFocus: isVisible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
WlrLayershell.keyboardFocus: isVisible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
||||||
@@ -70,12 +81,36 @@ PanelWindow {
|
|||||||
Loader {
|
Loader {
|
||||||
id: launcherLoader
|
id: launcherLoader
|
||||||
|
|
||||||
|
readonly property real popupWidth: 520
|
||||||
|
readonly property real popupHeight: 600
|
||||||
|
readonly property real screenWidth: Screen.width
|
||||||
|
readonly property real screenHeight: Screen.height
|
||||||
|
readonly property real calculatedX: {
|
||||||
|
var centerX = appDrawerPopout.triggerX + (appDrawerPopout.triggerWidth / 2) - (popupWidth / 2);
|
||||||
|
|
||||||
|
if (centerX >= Theme.spacingM && centerX + popupWidth <= screenWidth - Theme.spacingM) {
|
||||||
|
return centerX;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (centerX < Theme.spacingM) {
|
||||||
|
return Theme.spacingM;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (centerX + popupWidth > screenWidth - Theme.spacingM) {
|
||||||
|
return screenWidth - popupWidth - Theme.spacingM;
|
||||||
|
}
|
||||||
|
|
||||||
|
return centerX;
|
||||||
|
}
|
||||||
|
readonly property real calculatedY: appDrawerPopout.triggerY
|
||||||
|
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
active: appDrawerPopout.isVisible
|
active: appDrawerPopout.isVisible
|
||||||
width: 520
|
width: popupWidth
|
||||||
height: 600
|
height: popupHeight
|
||||||
x: Theme.spacingL
|
x: calculatedX
|
||||||
y: Theme.barHeight + Theme.spacingXS
|
y: calculatedY
|
||||||
|
|
||||||
opacity: appDrawerPopout.isVisible ? 1 : 0
|
opacity: appDrawerPopout.isVisible ? 1 : 0
|
||||||
scale: appDrawerPopout.isVisible ? 1 : 0.9
|
scale: appDrawerPopout.isVisible ? 1 : 0.9
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,17 @@ PanelWindow {
|
|||||||
readonly property bool hasActiveMedia: MprisController.activePlayer !== null
|
readonly property bool hasActiveMedia: MprisController.activePlayer !== null
|
||||||
property bool calendarVisible: false
|
property bool calendarVisible: false
|
||||||
property bool internalVisible: false
|
property bool internalVisible: false
|
||||||
|
property real triggerX: (Screen.width - 480) / 2
|
||||||
|
property real triggerY: Theme.barHeight + 4
|
||||||
|
property real triggerWidth: 80
|
||||||
|
property string triggerSection: "center"
|
||||||
|
|
||||||
|
function setTriggerPosition(x, y, width, section) {
|
||||||
|
triggerX = x;
|
||||||
|
triggerY = y;
|
||||||
|
triggerWidth = width;
|
||||||
|
triggerSection = section;
|
||||||
|
}
|
||||||
|
|
||||||
visible: internalVisible
|
visible: internalVisible
|
||||||
onCalendarVisibleChanged: {
|
onCalendarVisibleChanged: {
|
||||||
@@ -77,6 +88,24 @@ PanelWindow {
|
|||||||
return Math.min(contentHeight, parent.height * 0.9);
|
return Math.min(contentHeight, parent.height * 0.9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readonly property real calculatedX: {
|
||||||
|
var centerX = root.triggerX + (root.triggerWidth / 2) - (targetWidth / 2);
|
||||||
|
|
||||||
|
if (centerX >= Theme.spacingM && centerX + targetWidth <= Screen.width - Theme.spacingM) {
|
||||||
|
return centerX;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (centerX < Theme.spacingM) {
|
||||||
|
return Theme.spacingM;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (centerX + targetWidth > Screen.width - Theme.spacingM) {
|
||||||
|
return Screen.width - targetWidth - Theme.spacingM;
|
||||||
|
}
|
||||||
|
|
||||||
|
return centerX;
|
||||||
|
}
|
||||||
|
|
||||||
width: targetWidth
|
width: targetWidth
|
||||||
height: calculateHeight()
|
height: calculateHeight()
|
||||||
color: Theme.surfaceContainer
|
color: Theme.surfaceContainer
|
||||||
@@ -86,8 +115,8 @@ PanelWindow {
|
|||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
opacity: calendarVisible ? 1 : 0
|
opacity: calendarVisible ? 1 : 0
|
||||||
scale: calendarVisible ? 1 : 0.9
|
scale: calendarVisible ? 1 : 0.9
|
||||||
x: (Screen.width - targetWidth) / 2
|
x: calculatedX
|
||||||
y: Theme.barHeight + 4
|
y: root.triggerY
|
||||||
onOpacityChanged: {
|
onOpacityChanged: {
|
||||||
if (opacity === 1)
|
if (opacity === 1)
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
|
|||||||
@@ -12,6 +12,17 @@ PanelWindow {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool notificationHistoryVisible: false
|
property bool notificationHistoryVisible: false
|
||||||
|
property real triggerX: Screen.width - 400 - Theme.spacingL
|
||||||
|
property real triggerY: Theme.barHeight + Theme.spacingXS
|
||||||
|
property real triggerWidth: 40
|
||||||
|
property string triggerSection: "right"
|
||||||
|
|
||||||
|
function setTriggerPosition(x, y, width, section) {
|
||||||
|
triggerX = x;
|
||||||
|
triggerY = y;
|
||||||
|
triggerWidth = width;
|
||||||
|
triggerSection = section;
|
||||||
|
}
|
||||||
|
|
||||||
visible: notificationHistoryVisible
|
visible: notificationHistoryVisible
|
||||||
onNotificationHistoryVisibleChanged: {
|
onNotificationHistoryVisibleChanged: {
|
||||||
@@ -53,10 +64,29 @@ PanelWindow {
|
|||||||
return Math.max(300, baseHeight);
|
return Math.max(300, baseHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
width: 400
|
readonly property real popupWidth: 400
|
||||||
|
readonly property real calculatedX: {
|
||||||
|
var centerX = root.triggerX + (root.triggerWidth / 2) - (popupWidth / 2);
|
||||||
|
|
||||||
|
if (centerX >= Theme.spacingM && centerX + popupWidth <= Screen.width - Theme.spacingM) {
|
||||||
|
return centerX;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (centerX < Theme.spacingM) {
|
||||||
|
return Theme.spacingM;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (centerX + popupWidth > Screen.width - Theme.spacingM) {
|
||||||
|
return Screen.width - popupWidth - Theme.spacingM;
|
||||||
|
}
|
||||||
|
|
||||||
|
return centerX;
|
||||||
|
}
|
||||||
|
|
||||||
|
width: popupWidth
|
||||||
height: calculateHeight()
|
height: calculateHeight()
|
||||||
x: Screen.width - width - Theme.spacingL
|
x: calculatedX
|
||||||
y: Theme.barHeight + Theme.spacingXS
|
y: root.triggerY
|
||||||
color: Theme.popupBackground()
|
color: Theme.popupBackground()
|
||||||
radius: Theme.cornerRadiusLarge
|
radius: Theme.cornerRadiusLarge
|
||||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
|
||||||
|
|||||||
@@ -16,6 +16,17 @@ PanelWindow {
|
|||||||
|
|
||||||
property bool isVisible: false
|
property bool isVisible: false
|
||||||
property var parentWidget: null
|
property var parentWidget: null
|
||||||
|
property real triggerX: Screen.width - 600 - Theme.spacingL
|
||||||
|
property real triggerY: Theme.barHeight + Theme.spacingXS
|
||||||
|
property real triggerWidth: 55
|
||||||
|
property string triggerSection: "right"
|
||||||
|
|
||||||
|
function setTriggerPosition(x, y, width, section) {
|
||||||
|
triggerX = x;
|
||||||
|
triggerY = y;
|
||||||
|
triggerWidth = width;
|
||||||
|
triggerSection = section;
|
||||||
|
}
|
||||||
|
|
||||||
function hide() {
|
function hide() {
|
||||||
isVisible = false;
|
isVisible = false;
|
||||||
@@ -69,13 +80,30 @@ PanelWindow {
|
|||||||
|
|
||||||
readonly property real targetWidth: Math.min(600, Screen.width - Theme.spacingL * 2)
|
readonly property real targetWidth: Math.min(600, Screen.width - Theme.spacingL * 2)
|
||||||
readonly property real targetHeight: Math.min(600, Screen.height - Theme.barHeight - Theme.spacingS * 2)
|
readonly property real targetHeight: Math.min(600, Screen.height - Theme.barHeight - Theme.spacingS * 2)
|
||||||
|
readonly property real calculatedX: {
|
||||||
|
var centerX = processListPopout.triggerX + (processListPopout.triggerWidth / 2) - (targetWidth / 2);
|
||||||
|
|
||||||
|
if (centerX >= Theme.spacingM && centerX + targetWidth <= Screen.width - Theme.spacingM) {
|
||||||
|
return centerX;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (centerX < Theme.spacingM) {
|
||||||
|
return Theme.spacingM;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (centerX + targetWidth > Screen.width - Theme.spacingM) {
|
||||||
|
return Screen.width - targetWidth - Theme.spacingM;
|
||||||
|
}
|
||||||
|
|
||||||
|
return centerX;
|
||||||
|
}
|
||||||
|
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
active: processListPopout.isVisible
|
active: processListPopout.isVisible
|
||||||
width: targetWidth
|
width: targetWidth
|
||||||
height: targetHeight
|
height: targetHeight
|
||||||
y: Theme.barHeight + Theme.spacingXS
|
y: processListPopout.triggerY
|
||||||
x: Math.max(Theme.spacingL, Screen.width - targetWidth - Theme.spacingL)
|
x: calculatedX
|
||||||
opacity: processListPopout.isVisible ? 1 : 0
|
opacity: processListPopout.isVisible ? 1 : 0
|
||||||
scale: processListPopout.isVisible ? 1 : 0.9
|
scale: processListPopout.isVisible ? 1 : 0.9
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ Rectangle {
|
|||||||
id: battery
|
id: battery
|
||||||
|
|
||||||
property bool batteryPopupVisible: false
|
property bool batteryPopupVisible: false
|
||||||
|
property string section: "right"
|
||||||
|
property var popupTarget: null
|
||||||
|
|
||||||
signal toggleBatteryPopup()
|
signal toggleBatteryPopup()
|
||||||
|
|
||||||
@@ -92,6 +94,11 @@ Rectangle {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (popupTarget && popupTarget.setTriggerPosition) {
|
||||||
|
var globalPos = mapToGlobal(0, 0);
|
||||||
|
var screenRelativeX = globalPos.x >= Screen.width ? globalPos.x % Screen.width : globalPos.x;
|
||||||
|
popupTarget.setTriggerPosition(screenRelativeX, Theme.barHeight + Theme.spacingXS, width, section);
|
||||||
|
}
|
||||||
toggleBatteryPopup();
|
toggleBatteryPopup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,17 @@ PanelWindow {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool batteryPopupVisible: false
|
property bool batteryPopupVisible: false
|
||||||
|
property real triggerX: Screen.width - 380 - Theme.spacingL
|
||||||
|
property real triggerY: Theme.barHeight + Theme.spacingS
|
||||||
|
property real triggerWidth: 70
|
||||||
|
property string triggerSection: "right"
|
||||||
|
|
||||||
|
function setTriggerPosition(x, y, width, section) {
|
||||||
|
triggerX = x;
|
||||||
|
triggerY = y;
|
||||||
|
triggerWidth = width;
|
||||||
|
triggerSection = section;
|
||||||
|
}
|
||||||
|
|
||||||
function isActiveProfile(profile) {
|
function isActiveProfile(profile) {
|
||||||
if (typeof PowerProfiles === "undefined")
|
if (typeof PowerProfiles === "undefined")
|
||||||
@@ -61,13 +72,30 @@ PanelWindow {
|
|||||||
|
|
||||||
readonly property real targetWidth: Math.min(380, Screen.width - Theme.spacingL * 2)
|
readonly property real targetWidth: Math.min(380, Screen.width - Theme.spacingL * 2)
|
||||||
readonly property real targetHeight: Math.min(450, Screen.height - Theme.barHeight - Theme.spacingS * 2)
|
readonly property real targetHeight: Math.min(450, Screen.height - Theme.barHeight - Theme.spacingS * 2)
|
||||||
|
readonly property real calculatedX: {
|
||||||
|
var centerX = root.triggerX + (root.triggerWidth / 2) - (targetWidth / 2);
|
||||||
|
|
||||||
|
if (centerX >= Theme.spacingM && centerX + targetWidth <= Screen.width - Theme.spacingM) {
|
||||||
|
return centerX;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (centerX < Theme.spacingM) {
|
||||||
|
return Theme.spacingM;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (centerX + targetWidth > Screen.width - Theme.spacingM) {
|
||||||
|
return Screen.width - targetWidth - Theme.spacingM;
|
||||||
|
}
|
||||||
|
|
||||||
|
return centerX;
|
||||||
|
}
|
||||||
|
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
active: batteryPopupVisible
|
active: batteryPopupVisible
|
||||||
width: targetWidth
|
width: targetWidth
|
||||||
height: targetHeight
|
height: targetHeight
|
||||||
x: Math.max(Theme.spacingL, Screen.width - targetWidth - Theme.spacingL)
|
x: calculatedX
|
||||||
y: Theme.barHeight + Theme.spacingS
|
y: root.triggerY
|
||||||
opacity: batteryPopupVisible ? 1 : 0
|
opacity: batteryPopupVisible ? 1 : 0
|
||||||
scale: batteryPopupVisible ? 1 : 0.9
|
scale: batteryPopupVisible ? 1 : 0.9
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ Rectangle {
|
|||||||
|
|
||||||
property date currentDate: new Date()
|
property date currentDate: new Date()
|
||||||
property bool compactMode: false
|
property bool compactMode: false
|
||||||
|
property string section: "center"
|
||||||
|
property var popupTarget: null
|
||||||
|
|
||||||
signal clockClicked()
|
signal clockClicked()
|
||||||
|
|
||||||
@@ -67,6 +69,11 @@ Rectangle {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (popupTarget && popupTarget.setTriggerPosition) {
|
||||||
|
var globalPos = mapToGlobal(0, 0);
|
||||||
|
var screenRelativeX = globalPos.x >= Screen.width ? globalPos.x % Screen.width : globalPos.x;
|
||||||
|
popupTarget.setTriggerPosition(screenRelativeX, Theme.barHeight + Theme.spacingXS, width, section);
|
||||||
|
}
|
||||||
root.clockClicked();
|
root.clockClicked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ Rectangle {
|
|||||||
property bool showPercentage: true
|
property bool showPercentage: true
|
||||||
property bool showIcon: true
|
property bool showIcon: true
|
||||||
property var toggleProcessList
|
property var toggleProcessList
|
||||||
|
property string section: "right"
|
||||||
|
property var popupTarget: null
|
||||||
|
|
||||||
width: 55
|
width: 55
|
||||||
height: 30
|
height: 30
|
||||||
@@ -32,10 +34,14 @@ Rectangle {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (popupTarget && popupTarget.setTriggerPosition) {
|
||||||
|
var globalPos = mapToGlobal(0, 0);
|
||||||
|
var screenRelativeX = globalPos.x >= Screen.width ? globalPos.x % Screen.width : globalPos.x;
|
||||||
|
popupTarget.setTriggerPosition(screenRelativeX, Theme.barHeight + Theme.spacingXS, width, section);
|
||||||
|
}
|
||||||
SysMonitorService.setSortBy("cpu");
|
SysMonitorService.setSortBy("cpu");
|
||||||
if (root.toggleProcessList)
|
if (root.toggleProcessList)
|
||||||
root.toggleProcessList();
|
root.toggleProcessList();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ Rectangle {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property bool isActive: false
|
property bool isActive: false
|
||||||
|
property string section: "left" // Which section this button is in
|
||||||
|
property var popupTarget: null // Reference to the popup to position
|
||||||
|
|
||||||
signal clicked()
|
signal clicked()
|
||||||
|
|
||||||
@@ -42,7 +44,14 @@ Rectangle {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: root.clicked()
|
onClicked: {
|
||||||
|
if (popupTarget && popupTarget.setTriggerPosition) {
|
||||||
|
var globalPos = mapToGlobal(0, 0);
|
||||||
|
var screenRelativeX = globalPos.x >= Screen.width ? globalPos.x % Screen.width : globalPos.x;
|
||||||
|
popupTarget.setTriggerPosition(screenRelativeX, Theme.barHeight + Theme.spacingXS, width, section);
|
||||||
|
}
|
||||||
|
root.clicked();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ Rectangle {
|
|||||||
readonly property int baseContentWidth: mediaRow.implicitWidth + Theme.spacingS * 2
|
readonly property int baseContentWidth: mediaRow.implicitWidth + Theme.spacingS * 2
|
||||||
readonly property int normalContentWidth: Math.min(280, baseContentWidth)
|
readonly property int normalContentWidth: Math.min(280, baseContentWidth)
|
||||||
readonly property int compactContentWidth: Math.min(120, baseContentWidth)
|
readonly property int compactContentWidth: Math.min(120, baseContentWidth)
|
||||||
|
property string section: "center"
|
||||||
|
property var popupTarget: null
|
||||||
|
|
||||||
signal clicked()
|
signal clicked()
|
||||||
|
|
||||||
@@ -127,7 +129,14 @@ Rectangle {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: root.clicked()
|
onClicked: {
|
||||||
|
if (root.popupTarget && root.popupTarget.setTriggerPosition) {
|
||||||
|
var globalPos = mapToGlobal(0, 0);
|
||||||
|
var screenRelativeX = globalPos.x >= Screen.width ? globalPos.x % Screen.width : globalPos.x;
|
||||||
|
root.popupTarget.setTriggerPosition(screenRelativeX, Theme.barHeight + Theme.spacingXS, root.width, root.section);
|
||||||
|
}
|
||||||
|
root.clicked();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ Rectangle {
|
|||||||
|
|
||||||
property bool hasUnread: false
|
property bool hasUnread: false
|
||||||
property bool isActive: false
|
property bool isActive: false
|
||||||
|
property string section: "right"
|
||||||
|
property var popupTarget: null
|
||||||
|
|
||||||
signal clicked()
|
signal clicked()
|
||||||
|
|
||||||
@@ -44,6 +46,11 @@ Rectangle {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (popupTarget && popupTarget.setTriggerPosition) {
|
||||||
|
var globalPos = mapToGlobal(0, 0);
|
||||||
|
var screenRelativeX = globalPos.x >= Screen.width ? globalPos.x % Screen.width : globalPos.x;
|
||||||
|
popupTarget.setTriggerPosition(screenRelativeX, Theme.barHeight + Theme.spacingXS, width, section);
|
||||||
|
}
|
||||||
root.clicked();
|
root.clicked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ Rectangle {
|
|||||||
property bool showPercentage: true
|
property bool showPercentage: true
|
||||||
property bool showIcon: true
|
property bool showIcon: true
|
||||||
property var toggleProcessList
|
property var toggleProcessList
|
||||||
|
property string section: "right"
|
||||||
|
property var popupTarget: null
|
||||||
|
|
||||||
width: 55
|
width: 55
|
||||||
height: 30
|
height: 30
|
||||||
@@ -32,10 +34,14 @@ Rectangle {
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (popupTarget && popupTarget.setTriggerPosition) {
|
||||||
|
var globalPos = mapToGlobal(0, 0);
|
||||||
|
var screenRelativeX = globalPos.x >= Screen.width ? globalPos.x % Screen.width : globalPos.x;
|
||||||
|
popupTarget.setTriggerPosition(screenRelativeX, Theme.barHeight + Theme.spacingXS, width, section);
|
||||||
|
}
|
||||||
SysMonitorService.setSortBy("memory");
|
SysMonitorService.setSortBy("memory");
|
||||||
if (root.toggleProcessList)
|
if (root.toggleProcessList)
|
||||||
root.toggleProcessList();
|
root.toggleProcessList();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -437,10 +437,19 @@ PanelWindow {
|
|||||||
|
|
||||||
LauncherButton {
|
LauncherButton {
|
||||||
isActive: appDrawerPopout ? appDrawerPopout.isVisible : false
|
isActive: appDrawerPopout ? appDrawerPopout.isVisible : false
|
||||||
|
section: {
|
||||||
|
// Determine which section this loader is in by checking parent
|
||||||
|
if (parent && parent.parent) {
|
||||||
|
if (parent.parent === leftSection) return "left";
|
||||||
|
if (parent.parent === rightSection) return "right";
|
||||||
|
if (parent.parent === centerSection) return "center";
|
||||||
|
}
|
||||||
|
return "left"; // default fallback
|
||||||
|
}
|
||||||
|
popupTarget: appDrawerPopout
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (appDrawerPopout)
|
if (appDrawerPopout)
|
||||||
appDrawerPopout.toggle();
|
appDrawerPopout.toggle();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -470,6 +479,13 @@ PanelWindow {
|
|||||||
|
|
||||||
Clock {
|
Clock {
|
||||||
compactMode: topBarContent.overlapping
|
compactMode: topBarContent.overlapping
|
||||||
|
section: {
|
||||||
|
if (parent && parent.parent === leftSection) return "left";
|
||||||
|
if (parent && parent.parent === rightSection) return "right";
|
||||||
|
if (parent && parent.parent === centerSection) return "center";
|
||||||
|
return "center";
|
||||||
|
}
|
||||||
|
popupTarget: centcomPopout
|
||||||
onClockClicked: {
|
onClockClicked: {
|
||||||
centcomPopout.calendarVisible = !centcomPopout.calendarVisible;
|
centcomPopout.calendarVisible = !centcomPopout.calendarVisible;
|
||||||
}
|
}
|
||||||
@@ -482,6 +498,13 @@ PanelWindow {
|
|||||||
|
|
||||||
Media {
|
Media {
|
||||||
compactMode: topBarContent.spacingTight || topBarContent.overlapping
|
compactMode: topBarContent.spacingTight || topBarContent.overlapping
|
||||||
|
section: {
|
||||||
|
if (parent && parent.parent === leftSection) return "left";
|
||||||
|
if (parent && parent.parent === rightSection) return "right";
|
||||||
|
if (parent && parent.parent === centerSection) return "center";
|
||||||
|
return "center";
|
||||||
|
}
|
||||||
|
popupTarget: centcomPopout
|
||||||
onClicked: {
|
onClicked: {
|
||||||
centcomPopout.calendarVisible = !centcomPopout.calendarVisible;
|
centcomPopout.calendarVisible = !centcomPopout.calendarVisible;
|
||||||
}
|
}
|
||||||
@@ -493,6 +516,13 @@ PanelWindow {
|
|||||||
id: weatherComponent
|
id: weatherComponent
|
||||||
|
|
||||||
Weather {
|
Weather {
|
||||||
|
section: {
|
||||||
|
if (parent && parent.parent === leftSection) return "left";
|
||||||
|
if (parent && parent.parent === rightSection) return "right";
|
||||||
|
if (parent && parent.parent === centerSection) return "center";
|
||||||
|
return "center";
|
||||||
|
}
|
||||||
|
popupTarget: centcomPopout
|
||||||
onClicked: {
|
onClicked: {
|
||||||
centcomPopout.calendarVisible = !centcomPopout.calendarVisible;
|
centcomPopout.calendarVisible = !centcomPopout.calendarVisible;
|
||||||
}
|
}
|
||||||
@@ -565,12 +595,26 @@ PanelWindow {
|
|||||||
spacing: Theme.spacingXS
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
CpuMonitor {
|
CpuMonitor {
|
||||||
|
section: {
|
||||||
|
if (parent && parent.parent && parent.parent.parent === leftSection) return "left";
|
||||||
|
if (parent && parent.parent && parent.parent.parent === rightSection) return "right";
|
||||||
|
if (parent && parent.parent && parent.parent.parent === centerSection) return "center";
|
||||||
|
return "right";
|
||||||
|
}
|
||||||
|
popupTarget: processListPopout
|
||||||
toggleProcessList: () => {
|
toggleProcessList: () => {
|
||||||
return processListPopout.toggle();
|
return processListPopout.toggle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RamMonitor {
|
RamMonitor {
|
||||||
|
section: {
|
||||||
|
if (parent && parent.parent && parent.parent.parent === leftSection) return "left";
|
||||||
|
if (parent && parent.parent && parent.parent.parent === rightSection) return "right";
|
||||||
|
if (parent && parent.parent && parent.parent.parent === centerSection) return "center";
|
||||||
|
return "right";
|
||||||
|
}
|
||||||
|
popupTarget: processListPopout
|
||||||
toggleProcessList: () => {
|
toggleProcessList: () => {
|
||||||
return processListPopout.toggle();
|
return processListPopout.toggle();
|
||||||
}
|
}
|
||||||
@@ -586,6 +630,13 @@ PanelWindow {
|
|||||||
NotificationCenterButton {
|
NotificationCenterButton {
|
||||||
hasUnread: root.notificationCount > 0
|
hasUnread: root.notificationCount > 0
|
||||||
isActive: notificationCenter.notificationHistoryVisible
|
isActive: notificationCenter.notificationHistoryVisible
|
||||||
|
section: {
|
||||||
|
if (parent && parent.parent === leftSection) return "left";
|
||||||
|
if (parent && parent.parent === rightSection) return "right";
|
||||||
|
if (parent && parent.parent === centerSection) return "center";
|
||||||
|
return "right";
|
||||||
|
}
|
||||||
|
popupTarget: notificationCenter
|
||||||
onClicked: {
|
onClicked: {
|
||||||
notificationCenter.notificationHistoryVisible = !notificationCenter.notificationHistoryVisible;
|
notificationCenter.notificationHistoryVisible = !notificationCenter.notificationHistoryVisible;
|
||||||
}
|
}
|
||||||
@@ -598,6 +649,13 @@ PanelWindow {
|
|||||||
|
|
||||||
Battery {
|
Battery {
|
||||||
batteryPopupVisible: batteryPopout.batteryPopupVisible
|
batteryPopupVisible: batteryPopout.batteryPopupVisible
|
||||||
|
section: {
|
||||||
|
if (parent && parent.parent === leftSection) return "left";
|
||||||
|
if (parent && parent.parent === rightSection) return "right";
|
||||||
|
if (parent && parent.parent === centerSection) return "center";
|
||||||
|
return "right";
|
||||||
|
}
|
||||||
|
popupTarget: batteryPopout
|
||||||
onToggleBatteryPopup: {
|
onToggleBatteryPopup: {
|
||||||
batteryPopout.batteryPopupVisible = !batteryPopout.batteryPopupVisible;
|
batteryPopout.batteryPopupVisible = !batteryPopout.batteryPopupVisible;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import qs.Widgets
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property string section: "center"
|
||||||
|
property var popupTarget: null
|
||||||
|
|
||||||
signal clicked()
|
signal clicked()
|
||||||
|
|
||||||
width: visible ? Math.min(100, weatherRow.implicitWidth + Theme.spacingS * 2) : 0
|
width: visible ? Math.min(100, weatherRow.implicitWidth + Theme.spacingS * 2) : 0
|
||||||
@@ -48,7 +51,14 @@ Rectangle {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: root.clicked()
|
onClicked: {
|
||||||
|
if (popupTarget && popupTarget.setTriggerPosition) {
|
||||||
|
var globalPos = mapToGlobal(0, 0);
|
||||||
|
var screenRelativeX = globalPos.x >= Screen.width ? globalPos.x % Screen.width : globalPos.x;
|
||||||
|
popupTarget.setTriggerPosition(screenRelativeX, Theme.barHeight + Theme.spacingXS, width, section);
|
||||||
|
}
|
||||||
|
root.clicked();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
|
|||||||
Reference in New Issue
Block a user