From 86ede0ecf270dd99cf1bceb36637d5fc35335cac Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 29 Feb 2024 11:14:31 +0000 Subject: [PATCH] Remove invalid tabbox configs from defaults We know that org.kde.breeze.desktop is invalid as LayoutName for the tabbox, it will break the default button in the tabbox kcm. Also the DesktopListLayout and DesktopLayout aren't valid anymore BUG:481640 --- kconf_update/CMakeLists.txt | 5 +++ .../kwin-6.0-remove-breeze-tabbox-default.cpp | 40 +++++++++++++++++++ kconf_update/kwin.upd | 4 ++ 3 files changed, 49 insertions(+) create mode 100644 kconf_update/kwin-6.0-remove-breeze-tabbox-default.cpp diff --git a/kconf_update/CMakeLists.txt b/kconf_update/CMakeLists.txt index 6ed0f50578..54bab696bb 100644 --- a/kconf_update/CMakeLists.txt +++ b/kconf_update/CMakeLists.txt @@ -11,5 +11,10 @@ target_sources(kwin-6.0-reset-active-mouse-screen PRIVATE kwin-6.0-reset-active- target_link_libraries(kwin-6.0-reset-active-mouse-screen PRIVATE KF6::ConfigCore) install(TARGETS kwin-6.0-reset-active-mouse-screen DESTINATION ${KDE_INSTALL_LIBDIR}/kconf_update_bin/) +add_executable(kwin-6.0-remove-breeze-tabbox-default) +target_sources(kwin-6.0-remove-breeze-tabbox-default PRIVATE kwin-6.0-remove-breeze-tabbox-default.cpp) +target_link_libraries(kwin-6.0-remove-breeze-tabbox-default PRIVATE KF6::ConfigCore) +install(TARGETS kwin-6.0-remove-breeze-tabbox-default DESTINATION ${KDE_INSTALL_LIBDIR}/kconf_update_bin/) + install(FILES kwin.upd DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR}) diff --git a/kconf_update/kwin-6.0-remove-breeze-tabbox-default.cpp b/kconf_update/kwin-6.0-remove-breeze-tabbox-default.cpp new file mode 100644 index 0000000000..dd536ab0b3 --- /dev/null +++ b/kconf_update/kwin-6.0-remove-breeze-tabbox-default.cpp @@ -0,0 +1,40 @@ +/* + SPDX-FileCopyrightText: 2024 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include +#include + +int main() +{ + KConfig config(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1String("/kdedefaults/kwinrc"), KConfig::SimpleConfig); + + KConfigGroup windows = config.group(QStringLiteral("TabBox")); + bool needsSync = false; + + if (!windows.exists()) { + return EXIT_SUCCESS; + } + + if (windows.hasKey(QStringLiteral("LayoutName")) && windows.readEntry(QStringLiteral("LayoutName"), QString()) == QString("org.kde.breeze.desktop")) { + windows.deleteEntry(QStringLiteral("LayoutName")); + needsSync = true; + } + + if (windows.hasKey(QStringLiteral("DesktopListLayout"))) { + windows.deleteEntry(QStringLiteral("DesktopListLayout")); + needsSync = true; + } + if (windows.hasKey(QStringLiteral("DesktopLayout"))) { + windows.deleteEntry(QStringLiteral("DesktopLayout")); + needsSync = true; + } + + if (needsSync) { + return windows.sync() ? EXIT_SUCCESS : EXIT_FAILURE; + } else { + return EXIT_SUCCESS; + } +} diff --git a/kconf_update/kwin.upd b/kconf_update/kwin.upd index e620aef65e..8b4e3d1803 100644 --- a/kconf_update/kwin.upd +++ b/kconf_update/kwin.upd @@ -10,3 +10,7 @@ Script=kwin-6.0-reset-active-mouse-screen # Delete old desktop switching shortcuts. Id=kwin-6.0-delete-desktop-switching-shortcuts Script=kwin-6.0-delete-desktop-switching-shortcuts + +# Delete old tabbox defaults +Id=kwin-6.0-remove-breeze-tabbox-default +Script=kwin-6.0-remove-breeze-tabbox-default