From c09871917b5ce16abdb42407ca77e4793f485dc2 Mon Sep 17 00:00:00 2001 From: Eric Edlund Date: Sat, 2 Apr 2022 09:35:32 -0400 Subject: [PATCH] Make VirtualDesktopManager update grid dimentions when only 1 desktop This is a patch to get the last two commits to work. A larger problem to fix is that when the desktop grid size is changed in the KCM by removing desktops, the internal grid dimensions are not updated until system restart. --- src/virtualdesktops.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/virtualdesktops.cpp b/src/virtualdesktops.cpp index 58c17621c5..10e5d00b1c 100644 --- a/src/virtualdesktops.cpp +++ b/src/virtualdesktops.cpp @@ -502,9 +502,9 @@ void VirtualDesktopManager::removeVirtualDesktop(VirtualDesktop *desktop) Q_EMIT currentChanged(oldCurrent, newCurrent); } + updateRootInfo(); save(); - updateRootInfo(); Q_EMIT desktopRemoved(desktop); Q_EMIT countChanged(m_desktops.count() + 1, m_desktops.count()); @@ -661,6 +661,13 @@ void VirtualDesktopManager::updateLayout() m_rows = count() == 1u ? 1 : 2; columns = count() / m_rows; } + + // Patch to make desktop grid size equal 1 when 1 desktop for desktop switching animations + if (m_desktops.size() == 1) { + m_rows = 1; + columns = 1; + } + setNETDesktopLayout(orientation, columns, m_rows, 0 // rootInfo->desktopLayoutCorner() // Not really worth implementing right now. );