mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-05 21:15:38 -05:00
barmask: fix multi-screen handling
This commit is contained in:
@@ -12,7 +12,9 @@ Singleton {
|
||||
if (!modal.allowStacking) {
|
||||
closeAllModalsExcept(modal)
|
||||
}
|
||||
PopoutManager.closeAllPopouts()
|
||||
if (!modal.keepPopoutsOpen) {
|
||||
PopoutManager.closeAllPopouts()
|
||||
}
|
||||
TrayMenuManager.closeAllMenus()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,15 +13,17 @@ Singleton {
|
||||
if (!popout || !popout.screen) return
|
||||
|
||||
const screenName = popout.screen.name
|
||||
const currentPopout = currentPopoutsByScreen[screenName]
|
||||
|
||||
if (currentPopout && currentPopout !== popout) {
|
||||
if (currentPopout.dashVisible !== undefined) {
|
||||
currentPopout.dashVisible = false
|
||||
} else if (currentPopout.notificationHistoryVisible !== undefined) {
|
||||
currentPopout.notificationHistoryVisible = false
|
||||
for (const otherScreenName in currentPopoutsByScreen) {
|
||||
const otherPopout = currentPopoutsByScreen[otherScreenName]
|
||||
if (!otherPopout || otherPopout === popout) continue
|
||||
|
||||
if (otherPopout.dashVisible !== undefined) {
|
||||
otherPopout.dashVisible = false
|
||||
} else if (otherPopout.notificationHistoryVisible !== undefined) {
|
||||
otherPopout.notificationHistoryVisible = false
|
||||
} else {
|
||||
currentPopout.close()
|
||||
otherPopout.close()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +70,35 @@ Singleton {
|
||||
const currentPopout = currentPopoutsByScreen[screenName]
|
||||
const triggerId = triggerSource !== undefined ? triggerSource : tabIndex
|
||||
|
||||
let justClosedSamePopout = false
|
||||
for (const otherScreenName in currentPopoutsByScreen) {
|
||||
if (otherScreenName === screenName) continue
|
||||
const otherPopout = currentPopoutsByScreen[otherScreenName]
|
||||
if (!otherPopout) continue
|
||||
|
||||
if (otherPopout === popout) {
|
||||
justClosedSamePopout = true
|
||||
}
|
||||
|
||||
if (otherPopout.dashVisible !== undefined) {
|
||||
otherPopout.dashVisible = false
|
||||
} else if (otherPopout.notificationHistoryVisible !== undefined) {
|
||||
otherPopout.notificationHistoryVisible = false
|
||||
} else {
|
||||
otherPopout.close()
|
||||
}
|
||||
}
|
||||
|
||||
if (currentPopout && currentPopout !== popout) {
|
||||
if (currentPopout.dashVisible !== undefined) {
|
||||
currentPopout.dashVisible = false
|
||||
} else if (currentPopout.notificationHistoryVisible !== undefined) {
|
||||
currentPopout.notificationHistoryVisible = false
|
||||
} else {
|
||||
currentPopout.close()
|
||||
}
|
||||
}
|
||||
|
||||
if (currentPopout === popout && popout.shouldBeVisible) {
|
||||
if (triggerId !== undefined && currentPopoutTriggers[screenName] === triggerId) {
|
||||
if (popout.dashVisible !== undefined) {
|
||||
@@ -99,15 +130,33 @@ Singleton {
|
||||
}
|
||||
|
||||
currentPopoutTriggers[screenName] = triggerId
|
||||
currentPopoutsByScreen[screenName] = popout
|
||||
|
||||
if (tabIndex !== undefined && popout.currentTabIndex !== undefined) {
|
||||
popout.currentTabIndex = tabIndex
|
||||
}
|
||||
|
||||
if (popout.dashVisible !== undefined) {
|
||||
popout.dashVisible = true
|
||||
ModalManager.closeAllModalsExcept(null)
|
||||
TrayMenuManager.closeAllMenus()
|
||||
|
||||
if (justClosedSamePopout) {
|
||||
Qt.callLater(() => {
|
||||
if (popout.dashVisible !== undefined) {
|
||||
popout.dashVisible = true
|
||||
} else if (popout.notificationHistoryVisible !== undefined) {
|
||||
popout.notificationHistoryVisible = true
|
||||
} else {
|
||||
popout.open()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
popout.open()
|
||||
if (popout.dashVisible !== undefined) {
|
||||
popout.dashVisible = true
|
||||
} else if (popout.notificationHistoryVisible !== undefined) {
|
||||
popout.notificationHistoryVisible = true
|
||||
} else {
|
||||
popout.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ PanelWindow {
|
||||
property bool allowFocusOverride: false
|
||||
property bool allowStacking: false
|
||||
property bool keepContentLoaded: false
|
||||
property bool keepPopoutsOpen: false
|
||||
|
||||
signal opened
|
||||
signal dialogClosed
|
||||
@@ -90,7 +91,8 @@ PanelWindow {
|
||||
WlrLayershell.exclusiveZone: -1
|
||||
WlrLayershell.keyboardFocus: {
|
||||
if (!shouldHaveFocus) return WlrKeyboardFocus.None
|
||||
return CompositorService.isHyprland ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.Exclusive
|
||||
if (CompositorService.isHyprland) return WlrKeyboardFocus.OnDemand
|
||||
return WlrKeyboardFocus.Exclusive
|
||||
}
|
||||
|
||||
HyprlandFocusGrab {
|
||||
|
||||
@@ -33,7 +33,9 @@ DankModal {
|
||||
parentBounds = bounds
|
||||
parentScreen = targetScreen
|
||||
backgroundOpacity = 0
|
||||
keepPopoutsOpen = true
|
||||
open()
|
||||
keepPopoutsOpen = false
|
||||
}
|
||||
|
||||
function updateVisibleActions() {
|
||||
|
||||
@@ -1058,7 +1058,9 @@ Item {
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barWindow.effectiveBarThickness, launcherButton.visualWidth)
|
||||
appDrawerLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, launcherButton.section, currentScreen)
|
||||
}
|
||||
appDrawerLoader.item?.toggle()
|
||||
if (appDrawerLoader.item) {
|
||||
PopoutManager.requestPopout(appDrawerLoader.item, undefined, "appDrawer")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1127,6 +1129,13 @@ Item {
|
||||
onClockClicked: {
|
||||
dankDashPopoutLoader.active = true
|
||||
if (dankDashPopoutLoader.item) {
|
||||
if (dankDashPopoutLoader.item.setTriggerPosition) {
|
||||
const globalPos = visualContent.mapToGlobal(0, 0)
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, visualWidth)
|
||||
dankDashPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, section, barWindow.screen)
|
||||
} else {
|
||||
dankDashPopoutLoader.item.triggerScreen = barWindow.screen
|
||||
}
|
||||
PopoutManager.requestPopout(dankDashPopoutLoader.item, 0)
|
||||
}
|
||||
}
|
||||
@@ -1150,6 +1159,13 @@ Item {
|
||||
onClicked: {
|
||||
dankDashPopoutLoader.active = true
|
||||
if (dankDashPopoutLoader.item) {
|
||||
if (dankDashPopoutLoader.item.setTriggerPosition) {
|
||||
const globalPos = visualContent.mapToGlobal(0, 0)
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, visualWidth)
|
||||
dankDashPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, section, barWindow.screen)
|
||||
} else {
|
||||
dankDashPopoutLoader.item.triggerScreen = barWindow.screen
|
||||
}
|
||||
PopoutManager.requestPopout(dankDashPopoutLoader.item, 1)
|
||||
}
|
||||
}
|
||||
@@ -1172,6 +1188,13 @@ Item {
|
||||
onClicked: {
|
||||
dankDashPopoutLoader.active = true
|
||||
if (dankDashPopoutLoader.item) {
|
||||
if (dankDashPopoutLoader.item.setTriggerPosition) {
|
||||
const globalPos = visualContent.mapToGlobal(0, 0)
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, visualWidth)
|
||||
dankDashPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, section, barWindow.screen)
|
||||
} else {
|
||||
dankDashPopoutLoader.item.triggerScreen = barWindow.screen
|
||||
}
|
||||
PopoutManager.requestPopout(dankDashPopoutLoader.item, 3)
|
||||
}
|
||||
}
|
||||
@@ -1317,7 +1340,9 @@ Item {
|
||||
parentScreen: barWindow.screen
|
||||
onClicked: {
|
||||
notificationCenterLoader.active = true
|
||||
notificationCenterLoader.item?.toggle()
|
||||
if (notificationCenterLoader.item) {
|
||||
PopoutManager.requestPopout(notificationCenterLoader.item, undefined, "notifications")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1338,7 +1363,9 @@ Item {
|
||||
parentScreen: barWindow.screen
|
||||
onToggleBatteryPopup: {
|
||||
batteryPopoutLoader.active = true
|
||||
batteryPopoutLoader.item?.toggle()
|
||||
if (batteryPopoutLoader.item) {
|
||||
PopoutManager.requestPopout(batteryPopoutLoader.item, undefined, "battery")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1359,7 +1386,9 @@ Item {
|
||||
parentScreen: barWindow.screen
|
||||
onToggleLayoutPopup: {
|
||||
layoutPopoutLoader.active = true
|
||||
layoutPopoutLoader.item?.toggle()
|
||||
if (layoutPopoutLoader.item) {
|
||||
PopoutManager.requestPopout(layoutPopoutLoader.item, undefined, "layout")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1379,7 +1408,9 @@ Item {
|
||||
parentScreen: barWindow.screen
|
||||
onToggleVpnPopup: {
|
||||
vpnPopoutLoader.active = true
|
||||
vpnPopoutLoader.item?.toggle()
|
||||
if (vpnPopoutLoader.item) {
|
||||
PopoutManager.requestPopout(vpnPopoutLoader.item, undefined, "vpn")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1416,7 +1447,7 @@ Item {
|
||||
return
|
||||
}
|
||||
controlCenterLoader.item.triggerScreen = barWindow.screen
|
||||
controlCenterLoader.item.toggle()
|
||||
PopoutManager.requestPopout(controlCenterLoader.item, undefined, "controlCenter")
|
||||
if (controlCenterLoader.item.shouldBeVisible && NetworkService.wifiEnabled) {
|
||||
NetworkService.scanWifi()
|
||||
}
|
||||
|
||||
@@ -369,7 +369,8 @@ Item {
|
||||
WlrLayershell.exclusiveZone: -1
|
||||
WlrLayershell.keyboardFocus: {
|
||||
if (!root.menuOpen) return WlrKeyboardFocus.None
|
||||
return CompositorService.isHyprland ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.Exclusive
|
||||
if (CompositorService.isHyprland) return WlrKeyboardFocus.OnDemand
|
||||
return WlrKeyboardFocus.Exclusive
|
||||
}
|
||||
WlrLayershell.namespace: "dms:tray-overflow-menu"
|
||||
color: "transparent"
|
||||
@@ -822,7 +823,8 @@ Item {
|
||||
WlrLayershell.exclusiveZone: -1
|
||||
WlrLayershell.keyboardFocus: {
|
||||
if (!menuRoot.showMenu) return WlrKeyboardFocus.None
|
||||
return CompositorService.isHyprland ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.Exclusive
|
||||
if (CompositorService.isHyprland) return WlrKeyboardFocus.OnDemand
|
||||
return WlrKeyboardFocus.Exclusive
|
||||
}
|
||||
color: "transparent"
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ DankPopout {
|
||||
triggerX: Screen.width - 620 - Theme.spacingL
|
||||
triggerY: Math.max(26 + SettingsData.dankBarInnerPadding + 4, Theme.barHeight - 4 - (8 - SettingsData.dankBarInnerPadding)) + SettingsData.dankBarSpacing + SettingsData.dankBarBottomGap - 2
|
||||
triggerWidth: 80
|
||||
screen: triggerScreen
|
||||
shouldBeVisible: dashVisible
|
||||
|
||||
property bool __focusArmed: false
|
||||
|
||||
@@ -98,7 +98,8 @@ PanelWindow {
|
||||
WlrLayershell.exclusiveZone: -1
|
||||
WlrLayershell.keyboardFocus: {
|
||||
if (!shouldBeVisible) return WlrKeyboardFocus.None
|
||||
return CompositorService.isHyprland ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.Exclusive
|
||||
if (CompositorService.isHyprland) return WlrKeyboardFocus.OnDemand
|
||||
return WlrKeyboardFocus.Exclusive
|
||||
}
|
||||
|
||||
HyprlandFocusGrab {
|
||||
@@ -345,6 +346,7 @@ PanelWindow {
|
||||
}
|
||||
|
||||
Item {
|
||||
id: focusHelper
|
||||
parent: contentContainer
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
@@ -354,7 +356,5 @@ PanelWindow {
|
||||
event.accepted = true
|
||||
}
|
||||
}
|
||||
Component.onCompleted: forceActiveFocus()
|
||||
onVisibleChanged: if (visible) forceActiveFocus()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user