From e7d6e8b217e2960805343bf4b200b7b3eb5b7882 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 5 Feb 2024 11:00:17 +0200 Subject: [PATCH] kcms/options: Hide "active mouse screen" option In the late Plasma 5 times we agreed that it would be better to drop "active mouse screen" option and stick with last interacted screen approach instead. However, it was forgotten and nobody has pursued this goal, so let's hide the option in the system settings ui at least. The option is not completely removed because some parts of kwin would need adjustments. --- kconf_update/CMakeLists.txt | 5 ++++ .../kwin-6.0-reset-active-mouse-screen.cpp | 26 +++++++++++++++++++ kconf_update/kwin.upd | 4 +++ src/kcms/options/focus.ui | 10 ------- src/kcms/options/kwinoptions_settings.kcfg | 4 --- src/kcms/options/windows.cpp | 1 - 6 files changed, 35 insertions(+), 15 deletions(-) create mode 100644 kconf_update/kwin-6.0-reset-active-mouse-screen.cpp diff --git a/kconf_update/CMakeLists.txt b/kconf_update/CMakeLists.txt index 00e06f3108..5b7fbf6ad7 100644 --- a/kconf_update/CMakeLists.txt +++ b/kconf_update/CMakeLists.txt @@ -6,6 +6,11 @@ target_sources(kwin-6.0-delete-desktop-switching-shortcuts PRIVATE kwin-6.0-dele target_link_libraries(kwin-6.0-delete-desktop-switching-shortcuts PRIVATE KF6::GlobalAccel) install(TARGETS kwin-6.0-delete-desktop-switching-shortcuts DESTINATION ${KDE_INSTALL_LIBDIR}/kconf_update_bin/) +add_executable(kwin-6.0-reset-active-mouse-screen) +target_sources(kwin-6.0-reset-active-mouse-screen PRIVATE kwin-6.0-reset-active-mouse-screen.cpp) +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/) + install(FILES kwin.upd DESTINATION ${KDE_INSTALL_KCONFUPDATEDIR}) install(PROGRAMS kwin-6.0-overview-activities-shortcuts.py diff --git a/kconf_update/kwin-6.0-reset-active-mouse-screen.cpp b/kconf_update/kwin-6.0-reset-active-mouse-screen.cpp new file mode 100644 index 0000000000..0efcc1dd60 --- /dev/null +++ b/kconf_update/kwin-6.0-reset-active-mouse-screen.cpp @@ -0,0 +1,26 @@ +/* + SPDX-FileCopyrightText: 2024 Vlad Zahorodnii + + SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include +#include + +int main() +{ + auto config = KSharedConfig::openConfig(QStringLiteral("kwinrc")); + + KConfigGroup windows = config->group(QStringLiteral("Windows")); + if (!windows.exists()) { + return EXIT_SUCCESS; + } + + if (!windows.hasKey(QStringLiteral("ActiveMouseScreen"))) { + return EXIT_SUCCESS; + } + + windows.deleteEntry(QStringLiteral("ActiveMouseScreen")); + + return windows.sync() ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/kconf_update/kwin.upd b/kconf_update/kwin.upd index 0b295de745..6d48bce821 100644 --- a/kconf_update/kwin.upd +++ b/kconf_update/kwin.upd @@ -3,6 +3,10 @@ Version=6 +# Reset ActiveMouseScreen config option. +Id=kwin-6.0-reset-active-mouse-screen +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 diff --git a/src/kcms/options/focus.ui b/src/kcms/options/focus.ui index eaef6270af..cbb6760864 100644 --- a/src/kcms/options/focus.ui +++ b/src/kcms/options/focus.ui @@ -198,16 +198,6 @@ - - - When this option is enabled, the active screen (where new windows appear, for example) is the screen containing the mouse pointer. When disabled, the active screen is the screen containing the focused window. - - - Active screen follows &mouse - - - - When this option is enabled, focus operations are limited only to the active screen diff --git a/src/kcms/options/kwinoptions_settings.kcfg b/src/kcms/options/kwinoptions_settings.kcfg index bc54b52092..1ff796a759 100644 --- a/src/kcms/options/kwinoptions_settings.kcfg +++ b/src/kcms/options/kwinoptions_settings.kcfg @@ -139,10 +139,6 @@ false - - true - - 1 0 diff --git a/src/kcms/options/windows.cpp b/src/kcms/options/windows.cpp index 59408ce833..e9660c1d91 100644 --- a/src/kcms/options/windows.cpp +++ b/src/kcms/options/windows.cpp @@ -74,7 +74,6 @@ void KFocusConfig::initialize(KWinOptionsSettings *settings) void KFocusConfig::updateMultiScreen() { m_ui->multiscreenBehaviorLabel->setVisible(QApplication::screens().count() > 1); - m_ui->kcfg_ActiveMouseScreen->setVisible(QApplication::screens().count() > 1); m_ui->kcfg_SeparateScreenFocus->setVisible(QApplication::screens().count() > 1); }