mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-10 07:25:37 -05:00
dankbar/mask: extra polish for Hyprland maybe
This commit is contained in:
@@ -6,49 +6,27 @@ import QtQuick
|
|||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var activeOverflowMenus: ({})
|
property var activeTrayBars: ({})
|
||||||
property var activeTrayMenus: ({})
|
|
||||||
|
|
||||||
function registerOverflowMenu(screenName, menuOpenBinding) {
|
function register(screenName, trayBar) {
|
||||||
|
if (!screenName || !trayBar) return
|
||||||
|
activeTrayBars[screenName] = trayBar
|
||||||
|
}
|
||||||
|
|
||||||
|
function unregister(screenName) {
|
||||||
if (!screenName) return
|
if (!screenName) return
|
||||||
activeOverflowMenus[screenName] = menuOpenBinding
|
delete activeTrayBars[screenName]
|
||||||
}
|
|
||||||
|
|
||||||
function unregisterOverflowMenu(screenName) {
|
|
||||||
if (!screenName) return
|
|
||||||
delete activeOverflowMenus[screenName]
|
|
||||||
}
|
|
||||||
|
|
||||||
function registerTrayMenu(screenName, closeCallback) {
|
|
||||||
if (!screenName) return
|
|
||||||
activeTrayMenus[screenName] = closeCallback
|
|
||||||
}
|
|
||||||
|
|
||||||
function unregisterTrayMenu(screenName) {
|
|
||||||
if (!screenName) return
|
|
||||||
delete activeTrayMenus[screenName]
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeOverflowMenus() {
|
|
||||||
for (const screenName in activeOverflowMenus) {
|
|
||||||
const menuBinding = activeOverflowMenus[screenName]
|
|
||||||
if (menuBinding && menuBinding.close) {
|
|
||||||
menuBinding.close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeTrayMenus() {
|
|
||||||
for (const screenName in activeTrayMenus) {
|
|
||||||
const closeCallback = activeTrayMenus[screenName]
|
|
||||||
if (closeCallback) {
|
|
||||||
closeCallback()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeAllMenus() {
|
function closeAllMenus() {
|
||||||
closeOverflowMenus()
|
for (const screenName in activeTrayBars) {
|
||||||
closeTrayMenus()
|
const trayBar = activeTrayBars[screenName]
|
||||||
|
if (!trayBar) continue
|
||||||
|
|
||||||
|
trayBar.menuOpen = false
|
||||||
|
if (trayBar.currentTrayMenu) {
|
||||||
|
trayBar.currentTrayMenu.showMenu = false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,10 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
WlrLayershell.exclusiveZone: -1
|
WlrLayershell.exclusiveZone: -1
|
||||||
WlrLayershell.keyboardFocus: shouldHaveFocus ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
WlrLayershell.keyboardFocus: {
|
||||||
|
if (!shouldHaveFocus) return WlrKeyboardFocus.None
|
||||||
|
return CompositorService.isHyprland ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.Exclusive
|
||||||
|
}
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (root.visible) {
|
if (root.visible) {
|
||||||
opened()
|
opened()
|
||||||
|
|||||||
@@ -17,9 +17,6 @@ DankPopout {
|
|||||||
|
|
||||||
property var triggerScreen: null
|
property var triggerScreen: null
|
||||||
|
|
||||||
// Setting to Exclusive, so virtual keyboards can send input to app drawer
|
|
||||||
WlrLayershell.keyboardFocus: shouldBeVisible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
|
||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
open()
|
open()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,21 +49,16 @@ Item {
|
|||||||
visible: allTrayItems.length > 0
|
visible: allTrayItems.length > 0
|
||||||
|
|
||||||
property bool menuOpen: false
|
property bool menuOpen: false
|
||||||
property bool overflowWasOpenBeforeTrayMenu: false
|
property var currentTrayMenu: null
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (parentScreen) {
|
if (!parentScreen) return
|
||||||
TrayMenuManager.registerOverflowMenu(parentScreen.name, {
|
TrayMenuManager.register(parentScreen.name, root)
|
||||||
close: () => { root.menuOpen = false }
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
if (parentScreen) {
|
if (!parentScreen) return
|
||||||
TrayMenuManager.unregisterOverflowMenu(parentScreen.name)
|
TrayMenuManager.unregister(parentScreen.name)
|
||||||
TrayMenuManager.unregisterTrayMenu(parentScreen.name)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
@@ -186,7 +181,7 @@ Item {
|
|||||||
|
|
||||||
if (!delegateRoot.trayItem.hasMenu) return
|
if (!delegateRoot.trayItem.hasMenu) return
|
||||||
|
|
||||||
root.overflowWasOpenBeforeTrayMenu = root.menuOpen
|
root.menuOpen = false
|
||||||
root.showForTrayItem(delegateRoot.trayItem, visualContent, parentScreen, root.isAtBottom, root.isVertical, root.axis)
|
root.showForTrayItem(delegateRoot.trayItem, visualContent, parentScreen, root.isAtBottom, root.isVertical, root.axis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -319,7 +314,7 @@ Item {
|
|||||||
|
|
||||||
if (!delegateRoot.trayItem.hasMenu) return
|
if (!delegateRoot.trayItem.hasMenu) return
|
||||||
|
|
||||||
root.overflowWasOpenBeforeTrayMenu = root.menuOpen
|
root.menuOpen = false
|
||||||
root.showForTrayItem(delegateRoot.trayItem, visualContent, parentScreen, root.isAtBottom, root.isVertical, root.axis)
|
root.showForTrayItem(delegateRoot.trayItem, visualContent, parentScreen, root.isAtBottom, root.isVertical, root.axis)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -722,7 +717,6 @@ Item {
|
|||||||
|
|
||||||
if (!trayItem.hasMenu) return
|
if (!trayItem.hasMenu) return
|
||||||
|
|
||||||
root.overflowWasOpenBeforeTrayMenu = true
|
|
||||||
root.menuOpen = false
|
root.menuOpen = false
|
||||||
root.showForTrayItem(trayItem, parent, parentScreen, root.isAtBottom, root.isVertical, root.axis)
|
root.showForTrayItem(trayItem, parent, parentScreen, root.isAtBottom, root.isVertical, root.axis)
|
||||||
}
|
}
|
||||||
@@ -784,7 +778,6 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function closeWithAction() {
|
function closeWithAction() {
|
||||||
root.overflowWasOpenBeforeTrayMenu = false
|
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1329,39 +1322,19 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property var currentTrayMenu: null
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: currentTrayMenu
|
|
||||||
enabled: currentTrayMenu !== null
|
|
||||||
function onShowMenuChanged() {
|
|
||||||
if (parentWindow && typeof parentWindow.systemTrayMenuOpen !== "undefined") {
|
|
||||||
parentWindow.systemTrayMenuOpen = currentTrayMenu.showMenu
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function showForTrayItem(item, anchor, screen, atBottom, vertical, axisObj) {
|
function showForTrayItem(item, anchor, screen, atBottom, vertical, axisObj) {
|
||||||
if (parentWindow && typeof parentWindow.systemTrayMenuOpen !== "undefined") {
|
if (!screen) return
|
||||||
parentWindow.systemTrayMenuOpen = true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentTrayMenu) {
|
if (currentTrayMenu) {
|
||||||
root.overflowWasOpenBeforeTrayMenu = false
|
|
||||||
currentTrayMenu.showMenu = false
|
currentTrayMenu.showMenu = false
|
||||||
currentTrayMenu.destroy()
|
currentTrayMenu.destroy()
|
||||||
currentTrayMenu = null
|
currentTrayMenu = null
|
||||||
}
|
}
|
||||||
|
|
||||||
currentTrayMenu = trayMenuComponent.createObject(null)
|
currentTrayMenu = trayMenuComponent.createObject(null)
|
||||||
if (currentTrayMenu && screen) {
|
if (!currentTrayMenu) return
|
||||||
currentTrayMenu.showForTrayItem(item, anchor, screen, atBottom, vertical ?? false, axisObj)
|
|
||||||
TrayMenuManager.registerTrayMenu(screen.name, () => {
|
currentTrayMenu.showForTrayItem(item, anchor, screen, atBottom, vertical ?? false, axisObj)
|
||||||
if (currentTrayMenu) {
|
|
||||||
currentTrayMenu.close()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ DankPopout {
|
|||||||
property var triggerScreen: null
|
property var triggerScreen: null
|
||||||
property int currentTabIndex: 0
|
property int currentTabIndex: 0
|
||||||
|
|
||||||
keyboardFocusMode: WlrKeyboardFocus.Exclusive
|
|
||||||
|
|
||||||
function setTriggerPosition(x, y, width, section, screen) {
|
function setTriggerPosition(x, y, width, section, screen) {
|
||||||
triggerSection = section
|
triggerSection = section
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ Scope {
|
|||||||
WlrLayershell.namespace: "dms:workspace-overview"
|
WlrLayershell.namespace: "dms:workspace-overview"
|
||||||
WlrLayershell.layer: WlrLayer.Overlay
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
WlrLayershell.exclusiveZone: -1
|
WlrLayershell.exclusiveZone: -1
|
||||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
|
WlrLayershell.keyboardFocus: overviewScope.overviewOpen ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: true
|
top: true
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ DankPopout {
|
|||||||
|
|
||||||
layerNamespace: "dms-plugin:" + layerNamespacePlugin
|
layerNamespace: "dms-plugin:" + layerNamespacePlugin
|
||||||
|
|
||||||
WlrLayershell.keyboardFocus: shouldBeVisible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
|
||||||
|
|
||||||
property var triggerScreen: null
|
property var triggerScreen: null
|
||||||
property Component pluginContent: null
|
property Component pluginContent: null
|
||||||
property real contentWidth: 400
|
property real contentWidth: 400
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ PanelWindow {
|
|||||||
property list<real> animationEnterCurve: Theme.expressiveCurves.expressiveDefaultSpatial
|
property list<real> animationEnterCurve: Theme.expressiveCurves.expressiveDefaultSpatial
|
||||||
property list<real> animationExitCurve: Theme.expressiveCurves.emphasized
|
property list<real> animationExitCurve: Theme.expressiveCurves.emphasized
|
||||||
property bool shouldBeVisible: false
|
property bool shouldBeVisible: false
|
||||||
property int keyboardFocusMode: WlrKeyboardFocus.Exclusive
|
|
||||||
|
|
||||||
visible: false
|
visible: false
|
||||||
|
|
||||||
@@ -97,7 +96,10 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
WlrLayershell.exclusiveZone: -1
|
WlrLayershell.exclusiveZone: -1
|
||||||
WlrLayershell.keyboardFocus: shouldBeVisible ? keyboardFocusMode : WlrKeyboardFocus.None
|
WlrLayershell.keyboardFocus: {
|
||||||
|
if (!shouldBeVisible) return WlrKeyboardFocus.None
|
||||||
|
return CompositorService.isHyprland ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.Exclusive
|
||||||
|
}
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: true
|
top: true
|
||||||
|
|||||||
Reference in New Issue
Block a user