mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
qs/dankbar/meta: add a mask region to the bar
- Allows bar items to be clickable evn when popouts open - Add state machines to manage state across monitors - change focuses to ondemand on hyprland
This commit is contained in:
@@ -12,5 +12,9 @@ Singleton {
|
||||
if (!modal.allowStacking) {
|
||||
closeAllModalsExcept(modal)
|
||||
}
|
||||
if (!modal.keepPopoutsOpen) {
|
||||
PopoutManager.closeAllPopouts()
|
||||
}
|
||||
TrayMenuManager.closeAllMenus()
|
||||
}
|
||||
}
|
||||
|
||||
162
quickshell/Common/PopoutManager.qml
Normal file
162
quickshell/Common/PopoutManager.qml
Normal file
@@ -0,0 +1,162 @@
|
||||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
property var currentPopoutsByScreen: ({})
|
||||
property var currentPopoutTriggers: ({})
|
||||
|
||||
function showPopout(popout) {
|
||||
if (!popout || !popout.screen) return
|
||||
|
||||
const screenName = popout.screen.name
|
||||
|
||||
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 {
|
||||
otherPopout.close()
|
||||
}
|
||||
}
|
||||
|
||||
currentPopoutsByScreen[screenName] = popout
|
||||
ModalManager.closeAllModalsExcept(null)
|
||||
TrayMenuManager.closeAllMenus()
|
||||
}
|
||||
|
||||
function hidePopout(popout) {
|
||||
if (!popout || !popout.screen) return
|
||||
|
||||
const screenName = popout.screen.name
|
||||
if (currentPopoutsByScreen[screenName] === popout) {
|
||||
currentPopoutsByScreen[screenName] = null
|
||||
currentPopoutTriggers[screenName] = null
|
||||
}
|
||||
}
|
||||
|
||||
function closeAllPopouts() {
|
||||
for (const screenName in currentPopoutsByScreen) {
|
||||
const popout = currentPopoutsByScreen[screenName]
|
||||
if (!popout) continue
|
||||
|
||||
if (popout.dashVisible !== undefined) {
|
||||
popout.dashVisible = false
|
||||
} else if (popout.notificationHistoryVisible !== undefined) {
|
||||
popout.notificationHistoryVisible = false
|
||||
} else {
|
||||
popout.close()
|
||||
}
|
||||
}
|
||||
currentPopoutsByScreen = {}
|
||||
}
|
||||
|
||||
function getActivePopout(screen) {
|
||||
if (!screen) return null
|
||||
return currentPopoutsByScreen[screen.name] || null
|
||||
}
|
||||
|
||||
function requestPopout(popout, tabIndex, triggerSource) {
|
||||
if (!popout || !popout.screen) return
|
||||
|
||||
const screenName = popout.screen.name
|
||||
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) {
|
||||
popout.dashVisible = false
|
||||
} else if (popout.notificationHistoryVisible !== undefined) {
|
||||
popout.notificationHistoryVisible = false
|
||||
} else {
|
||||
popout.close()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (triggerId === undefined) {
|
||||
if (popout.dashVisible !== undefined) {
|
||||
popout.dashVisible = false
|
||||
} else if (popout.notificationHistoryVisible !== undefined) {
|
||||
popout.notificationHistoryVisible = false
|
||||
} else {
|
||||
popout.close()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (tabIndex !== undefined && popout.currentTabIndex !== undefined) {
|
||||
popout.currentTabIndex = tabIndex
|
||||
}
|
||||
currentPopoutTriggers[screenName] = triggerId
|
||||
return
|
||||
}
|
||||
|
||||
currentPopoutTriggers[screenName] = triggerId
|
||||
currentPopoutsByScreen[screenName] = popout
|
||||
|
||||
if (tabIndex !== undefined && popout.currentTabIndex !== undefined) {
|
||||
popout.currentTabIndex = tabIndex
|
||||
}
|
||||
|
||||
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 {
|
||||
if (popout.dashVisible !== undefined) {
|
||||
popout.dashVisible = true
|
||||
} else if (popout.notificationHistoryVisible !== undefined) {
|
||||
popout.notificationHistoryVisible = true
|
||||
} else {
|
||||
popout.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -590,6 +590,53 @@ rm -rf '${home}'/.cache/icon-cache '${home}'/.cache/thumbnails 2>/dev/null || tr
|
||||
}
|
||||
}
|
||||
|
||||
function getBarBounds(screen, barThickness) {
|
||||
if (!screen) {
|
||||
return { "x": 0, "y": 0, "width": 0, "height": 0, "wingSize": 0 }
|
||||
}
|
||||
|
||||
const wingRadius = dankBarGothCornerRadiusOverride ? dankBarGothCornerRadiusValue : Theme.cornerRadius
|
||||
const wingSize = dankBarGothCornersEnabled ? Math.max(0, wingRadius) : 0
|
||||
const screenWidth = screen.width
|
||||
const screenHeight = screen.height
|
||||
|
||||
if (dankBarPosition === SettingsData.Position.Top) {
|
||||
return {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"width": screenWidth,
|
||||
"height": barThickness + dankBarSpacing + wingSize,
|
||||
"wingSize": wingSize
|
||||
}
|
||||
} else if (dankBarPosition === SettingsData.Position.Bottom) {
|
||||
return {
|
||||
"x": 0,
|
||||
"y": screenHeight - barThickness - dankBarSpacing - wingSize,
|
||||
"width": screenWidth,
|
||||
"height": barThickness + dankBarSpacing + wingSize,
|
||||
"wingSize": wingSize
|
||||
}
|
||||
} else if (dankBarPosition === SettingsData.Position.Left) {
|
||||
return {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"width": barThickness + dankBarSpacing + wingSize,
|
||||
"height": screenHeight,
|
||||
"wingSize": wingSize
|
||||
}
|
||||
} else if (dankBarPosition === SettingsData.Position.Right) {
|
||||
return {
|
||||
"x": screenWidth - barThickness - dankBarSpacing - wingSize,
|
||||
"y": 0,
|
||||
"width": barThickness + dankBarSpacing + wingSize,
|
||||
"height": screenHeight,
|
||||
"wingSize": wingSize
|
||||
}
|
||||
}
|
||||
|
||||
return { "x": 0, "y": 0, "width": 0, "height": 0, "wingSize": 0 }
|
||||
}
|
||||
|
||||
function getFilteredScreens(componentId) {
|
||||
var prefs = screenPreferences && screenPreferences[componentId] || ["all"]
|
||||
if (prefs.includes("all")) {
|
||||
|
||||
32
quickshell/Common/TrayMenuManager.qml
Normal file
32
quickshell/Common/TrayMenuManager.qml
Normal file
@@ -0,0 +1,32 @@
|
||||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
property var activeTrayBars: ({})
|
||||
|
||||
function register(screenName, trayBar) {
|
||||
if (!screenName || !trayBar) return
|
||||
activeTrayBars[screenName] = trayBar
|
||||
}
|
||||
|
||||
function unregister(screenName) {
|
||||
if (!screenName) return
|
||||
delete activeTrayBars[screenName]
|
||||
}
|
||||
|
||||
function closeAllMenus() {
|
||||
for (const screenName in activeTrayBars) {
|
||||
const trayBar = activeTrayBars[screenName]
|
||||
if (!trayBar) continue
|
||||
|
||||
trayBar.menuOpen = false
|
||||
if (trayBar.currentTrayMenu) {
|
||||
trayBar.currentTrayMenu.showMenu = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user