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