mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-12 23:32:50 -04:00
fix(FrameMode): Update logic to hide the dbar/dock upon maximized windows/apps/games
This commit is contained in:
@@ -97,11 +97,14 @@ PanelWindow {
|
|||||||
case "overlay":
|
case "overlay":
|
||||||
return WlrLayer.Overlay;
|
return WlrLayer.Overlay;
|
||||||
case "background":
|
case "background":
|
||||||
return WlrLayer.background;
|
return WlrLayer.Background;
|
||||||
|
case "top":
|
||||||
|
return WlrLayer.Top;
|
||||||
default:
|
default:
|
||||||
// Elevate to Overlay when Frame is enabled so the bar stays above
|
// Elevate to Overlay when Frame is enabled so the bar stays above
|
||||||
// the FrameWindow (WlrLayer.Top) when it is re-mapped on mode switch.
|
// the FrameWindow (WlrLayer.Top) when it is re-mapped on mode switch,
|
||||||
return SettingsData.frameEnabled ? WlrLayer.Overlay : WlrLayer.Top;
|
// but drop back to Top while a true fullscreen app owns this screen.
|
||||||
|
return SettingsData.frameEnabled && !barWindow.hasFullscreenToplevel ? WlrLayer.Overlay : WlrLayer.Top;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,22 +310,7 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _updateHasFullscreenToplevel() {
|
function _updateHasFullscreenToplevel() {
|
||||||
if (!CompositorService.isHyprland) {
|
hasFullscreenToplevel = CompositorService.hasFullscreenToplevelOnScreen(screenName);
|
||||||
hasFullscreenToplevel = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const filtered = CompositorService.filterCurrentWorkspace(CompositorService.sortedToplevels, screenName);
|
|
||||||
for (let i = 0; i < filtered.length; i++) {
|
|
||||||
if (filtered[i]?.fullscreen) {
|
|
||||||
// On niri, fullscreen windows in inactive columns should not hide the bar
|
|
||||||
if (CompositorService.isNiri && !filtered[i]?.activated)
|
|
||||||
continue;
|
|
||||||
hasFullscreenToplevel = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hasFullscreenToplevel = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _updateShouldHideForWindows() {
|
function _updateShouldHideForWindows() {
|
||||||
@@ -536,6 +524,7 @@ PanelWindow {
|
|||||||
updateGpuTempConfig();
|
updateGpuTempConfig();
|
||||||
_updateBackgroundAlpha();
|
_updateBackgroundAlpha();
|
||||||
_updateHasMaximizedToplevel();
|
_updateHasMaximizedToplevel();
|
||||||
|
_updateHasFullscreenToplevel();
|
||||||
_updateShouldHideForWindows();
|
_updateShouldHideForWindows();
|
||||||
|
|
||||||
inhibitorInitTimer.start();
|
inhibitorInitTimer.start();
|
||||||
@@ -646,6 +635,13 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: ToplevelManager
|
||||||
|
function onActiveToplevelChanged() {
|
||||||
|
barWindow._updateHasFullscreenToplevel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
function onNvidiaGpuTempEnabledChanged() {
|
function onNvidiaGpuTempEnabledChanged() {
|
||||||
barWindow.updateGpuTempConfig();
|
barWindow.updateGpuTempConfig();
|
||||||
@@ -665,7 +661,7 @@ PanelWindow {
|
|||||||
anchors.left: !isVertical ? true : (barPos === SettingsData.Position.Left)
|
anchors.left: !isVertical ? true : (barPos === SettingsData.Position.Left)
|
||||||
anchors.right: !isVertical ? true : (barPos === SettingsData.Position.Right)
|
anchors.right: !isVertical ? true : (barPos === SettingsData.Position.Right)
|
||||||
|
|
||||||
exclusiveZone: (!(barConfig?.visible ?? true) || topBarCore.autoHide) ? -1 : (barWindow.effectiveBarThickness + effectiveSpacing + (Theme.isConnectedEffect ? 0 : (barConfig?.bottomGap ?? 0)))
|
exclusiveZone: (barWindow.hasFullscreenToplevel || !(barConfig?.visible ?? true) || topBarCore.autoHide) ? -1 : (barWindow.effectiveBarThickness + effectiveSpacing + (Theme.isConnectedEffect ? 0 : (barConfig?.bottomGap ?? 0)))
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: inputMask
|
id: inputMask
|
||||||
@@ -674,9 +670,9 @@ PanelWindow {
|
|||||||
|
|
||||||
readonly property bool inOverviewWithShow: CompositorService.isNiri && NiriService.inOverview && barWindow.effectiveOpenOnOverview
|
readonly property bool inOverviewWithShow: CompositorService.isNiri && NiriService.inOverview && barWindow.effectiveOpenOnOverview
|
||||||
readonly property bool effectiveVisible: (barConfig?.visible ?? true) || inOverviewWithShow
|
readonly property bool effectiveVisible: (barConfig?.visible ?? true) || inOverviewWithShow
|
||||||
readonly property bool showing: effectiveVisible && (topBarCore.reveal || inOverviewWithShow || !topBarCore.autoHide)
|
readonly property bool showing: effectiveVisible && !barWindow.hasFullscreenToplevel && (topBarCore.reveal || inOverviewWithShow || !topBarCore.autoHide)
|
||||||
|
|
||||||
readonly property int maskThickness: showing ? barThickness : 1
|
readonly property int maskThickness: barWindow.hasFullscreenToplevel ? 0 : (showing ? barThickness : 1)
|
||||||
|
|
||||||
x: {
|
x: {
|
||||||
if (!axis.isVertical) {
|
if (!axis.isVertical) {
|
||||||
@@ -813,13 +809,13 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
property bool reveal: {
|
property bool reveal: {
|
||||||
|
if (barWindow.hasFullscreenToplevel)
|
||||||
|
return false;
|
||||||
|
|
||||||
const inOverviewWithShow = CompositorService.isNiri && NiriService.inOverview && barWindow.effectiveOpenOnOverview;
|
const inOverviewWithShow = CompositorService.isNiri && NiriService.inOverview && barWindow.effectiveOpenOnOverview;
|
||||||
if (inOverviewWithShow)
|
if (inOverviewWithShow)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (barWindow.hasFullscreenToplevel)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const showOnWindowsSetting = barConfig?.showOnWindowsOpen ?? false;
|
const showOnWindowsSetting = barConfig?.showOnWindowsOpen ?? false;
|
||||||
if (showOnWindowsSetting && autoHide && (CompositorService.isNiri || CompositorService.isHyprland)) {
|
if (showOnWindowsSetting && autoHide && (CompositorService.isNiri || CompositorService.isHyprland)) {
|
||||||
if (barWindow.shouldHideForWindows)
|
if (barWindow.shouldHideForWindows)
|
||||||
@@ -911,9 +907,9 @@ PanelWindow {
|
|||||||
bottom: barWindow.isVertical ? parent.bottom : undefined
|
bottom: barWindow.isVertical ? parent.bottom : undefined
|
||||||
}
|
}
|
||||||
readonly property bool inOverview: CompositorService.isNiri && NiriService.inOverview && barWindow.effectiveOpenOnOverview
|
readonly property bool inOverview: CompositorService.isNiri && NiriService.inOverview && barWindow.effectiveOpenOnOverview
|
||||||
hoverEnabled: (barConfig?.autoHide ?? false) && !inOverview && !topBarCore.hasActivePopout
|
hoverEnabled: (barConfig?.autoHide ?? false) && !inOverview && !barWindow.hasFullscreenToplevel && !topBarCore.hasActivePopout
|
||||||
acceptedButtons: Qt.NoButton
|
acceptedButtons: Qt.NoButton
|
||||||
enabled: (barConfig?.autoHide ?? false) && !inOverview
|
enabled: (barConfig?.autoHide ?? false) && !inOverview && !barWindow.hasFullscreenToplevel
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: topBarContainer
|
id: topBarContainer
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ Variants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WlrLayershell.namespace: "dms:dock"
|
WlrLayershell.namespace: "dms:dock"
|
||||||
WlrLayershell.layer: SettingsData.frameEnabled ? WlrLayer.Overlay : WlrLayer.Top
|
WlrLayershell.layer: SettingsData.frameEnabled && !dock.hasFullscreenToplevel ? WlrLayer.Overlay : WlrLayer.Top
|
||||||
|
|
||||||
readonly property bool isVertical: SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right
|
readonly property bool isVertical: SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right
|
||||||
|
|
||||||
@@ -163,6 +163,18 @@ Variants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
readonly property string _dockScreenName: dock.modelData ? dock.modelData.name : (dock.screen ? dock.screen.name : "")
|
readonly property string _dockScreenName: dock.modelData ? dock.modelData.name : (dock.screen ? dock.screen.name : "")
|
||||||
|
readonly property bool hasFullscreenToplevel: {
|
||||||
|
CompositorService.sortedToplevels;
|
||||||
|
ToplevelManager.activeToplevel;
|
||||||
|
if (CompositorService.isNiri) {
|
||||||
|
NiriService.currentOutput;
|
||||||
|
NiriService.windows;
|
||||||
|
NiriService.allWorkspaces;
|
||||||
|
}
|
||||||
|
if (CompositorService.isHyprland)
|
||||||
|
Hyprland.focusedWorkspace;
|
||||||
|
return CompositorService.hasFullscreenToplevelOnScreen(dock._dockScreenName);
|
||||||
|
}
|
||||||
|
|
||||||
function _syncDockChromeState() {
|
function _syncDockChromeState() {
|
||||||
if (!dock._dockScreenName)
|
if (!dock._dockScreenName)
|
||||||
@@ -353,6 +365,9 @@ Variants {
|
|||||||
if (_modalRetractActive)
|
if (_modalRetractActive)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (dock.hasFullscreenToplevel)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (CompositorService.isNiri && NiriService.inOverview && SettingsData.dockOpenOnOverview) {
|
if (CompositorService.isNiri && NiriService.inOverview && SettingsData.dockOpenOnOverview) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -384,6 +399,7 @@ Variants {
|
|||||||
onVisibleChanged: dock._syncDockChromeState()
|
onVisibleChanged: dock._syncDockChromeState()
|
||||||
onHasAppsChanged: dock._syncDockChromeState()
|
onHasAppsChanged: dock._syncDockChromeState()
|
||||||
onConnectedBarSideChanged: dock._syncDockChromeState()
|
onConnectedBarSideChanged: dock._syncDockChromeState()
|
||||||
|
onHasFullscreenToplevelChanged: dock._syncDockChromeState()
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: SettingsData
|
target: SettingsData
|
||||||
@@ -409,6 +425,8 @@ Variants {
|
|||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
exclusiveZone: {
|
exclusiveZone: {
|
||||||
|
if (dock.hasFullscreenToplevel)
|
||||||
|
return -1;
|
||||||
if (!SettingsData.showDock || autoHide)
|
if (!SettingsData.showDock || autoHide)
|
||||||
return -1;
|
return -1;
|
||||||
if (barSpacing > 0)
|
if (barSpacing > 0)
|
||||||
|
|||||||
@@ -391,6 +391,63 @@ Singleton {
|
|||||||
return toplevels;
|
return toplevels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _screenName(screenOrName) {
|
||||||
|
if (typeof screenOrName === "string")
|
||||||
|
return screenOrName;
|
||||||
|
return screenOrName?.name ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
function _toplevelOnScreen(toplevel, screenName) {
|
||||||
|
if (!toplevel || !screenName)
|
||||||
|
return false;
|
||||||
|
const screens = toplevel.screens;
|
||||||
|
if (!screens)
|
||||||
|
return false;
|
||||||
|
for (let i = 0; i < screens.length; i++) {
|
||||||
|
if (screens[i]?.name === screenName)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasFullscreenToplevelOnScreen(screenOrName) {
|
||||||
|
const screenName = _screenName(screenOrName);
|
||||||
|
if (!screenName)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (isNiri) {
|
||||||
|
const active = ToplevelManager.activeToplevel;
|
||||||
|
if (active?.fullscreen && active?.activated && NiriService.currentOutput === screenName)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
const filtered = filterCurrentWorkspace(sortedToplevels, screenName);
|
||||||
|
for (let i = 0; i < filtered.length; i++) {
|
||||||
|
const toplevel = filtered[i];
|
||||||
|
if (toplevel?.fullscreen && toplevel?.activated)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isHyprland) {
|
||||||
|
const filtered = filterCurrentWorkspace(sortedToplevels, screenName);
|
||||||
|
for (let i = 0; i < filtered.length; i++) {
|
||||||
|
if (filtered[i]?.fullscreen)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ToplevelManager.toplevels?.values)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (const toplevel of ToplevelManager.toplevels.values) {
|
||||||
|
if (toplevel?.fullscreen && _toplevelOnScreen(toplevel, screenName))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function filterHyprlandCurrentDisplaySafe(toplevels, screenName) {
|
function filterHyprlandCurrentDisplaySafe(toplevels, screenName) {
|
||||||
if (!toplevels || toplevels.length === 0 || !Hyprland.toplevels)
|
if (!toplevels || toplevels.length === 0 || !Hyprland.toplevels)
|
||||||
return toplevels;
|
return toplevels;
|
||||||
|
|||||||
Reference in New Issue
Block a user