From 77d0b48d1716abbad70d0c261372275c91ddebf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Thu, 12 Oct 2023 02:29:54 +0300 Subject: [PATCH 01/12] Require QtConcurrent in CMake MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Bidar --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8bf269..c89ca5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ include(KDECMakeSettings) include(KDECompilerSettings) find_package(KF5Plasma REQUIRED) -find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Quick) +find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Quick Concurrent) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Plasma) find_package(KF5WindowSystem) From a4153905d124294b0159024624d73486be70ed35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Thu, 12 Oct 2023 10:30:27 +0300 Subject: [PATCH 02/12] Install qml plugin to private KDE, match other plasmoids MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Bidar --- plasmoid/contents/ui/configScreens.qml | 2 +- plasmoid/contents/ui/main.qml | 2 +- src/CMakeLists.txt | 5 +++-- src/plugin.cpp | 7 +++++-- src/plugin.h | 2 +- src/qmldir | 2 +- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/plasmoid/contents/ui/configScreens.qml b/plasmoid/contents/ui/configScreens.qml index 6c4d3a9..f69844e 100644 --- a/plasmoid/contents/ui/configScreens.qml +++ b/plasmoid/contents/ui/configScreens.qml @@ -5,7 +5,7 @@ import QtQml.Models 2.1 import QtQuick.Layouts 1.3 import QtQuick.Dialogs 1.0 import org.kde.kirigami 2.10 as Kirigami -import I3Pager 1.0 +import org.kde.private.I3Pager 1.0 import "screens.js" as ScreensJS ColumnLayout { diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml index 7454489..c5e52bb 100644 --- a/plasmoid/contents/ui/main.qml +++ b/plasmoid/contents/ui/main.qml @@ -5,7 +5,7 @@ import QtQuick.Dialogs 1.3 import QtQuick.Controls.Styles 1.3 import org.kde.plasma.plasmoid 2.0 import QtQuick.Window 2.13 -import I3Pager 1.0 +import org.kde.private.I3Pager 1.0 ColumnLayout { readonly property color defaultWorkspace : "transparent" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b7a69cb..d74b637 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,5 +22,6 @@ include_directories(${I3IPCpp_INCLUDE_DIRS}) link_directories(${I3IPCpp_LIBRARY_DIRS}) target_link_libraries(plasmoidplugin Qt5::Quick Qt5::Widgets KF5::Plasma KF5::WindowSystem ${I3IPCpp_LIBRARIES}) -install(TARGETS plasmoidplugin DESTINATION ${QML_INSTALL_DIR}/I3Pager) -install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/I3Pager) +# install plugin +install(TARGETS plasmoidplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/private/I3Pager) +install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/private/I3Pager) diff --git a/src/plugin.cpp b/src/plugin.cpp index c9f7ca1..6aa4955 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -1,7 +1,10 @@ #include "plugin.h" -void Plugin::registerTypes(const char* /* uri */) { +#include + +void Plugin::registerTypes(const char *uri) { + Q_ASSERT(uri == QLatin1String("org.kde.private.I3Pager")); qRegisterMetaType(); qRegisterMetaType>(); - qmlRegisterType("I3Pager", 1, 0, "I3Pager"); + qmlRegisterType(uri, 1, 0, "I3Pager"); } diff --git a/src/plugin.h b/src/plugin.h index ae651b0..e047887 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -3,8 +3,8 @@ #include "i3pager.h" #include "workspace.h" + #include -#include class QQmlEngine; class Plugin : public QQmlExtensionPlugin { diff --git a/src/qmldir b/src/qmldir index 19312f0..f87394b 100644 --- a/src/qmldir +++ b/src/qmldir @@ -1,3 +1,3 @@ -module I3Pager +module org.kde.private.I3Pager plugin plasmoidplugin From a948648d8b505a40e5c057fdeddf123c45e66d3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Thu, 12 Oct 2023 11:38:52 +0300 Subject: [PATCH 03/12] Port from Desktop file to Json Metadata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Bidar --- plasmoid/metadata.desktop | 15 --------------- plasmoid/metadata.json | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 15 deletions(-) delete mode 100644 plasmoid/metadata.desktop create mode 100644 plasmoid/metadata.json diff --git a/plasmoid/metadata.desktop b/plasmoid/metadata.desktop deleted file mode 100644 index f14e707..0000000 --- a/plasmoid/metadata.desktop +++ /dev/null @@ -1,15 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=i3Pager -Comment=i3 Pager -ServiceTypes=Plasma/Applet -Type=Service -X-KDE-PluginInfo-Author=Christian duvholt -X-KDE-PluginInfo-Email=christian@duvholt.net -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-Name=org.kde.I3Pager -X-KDE-PluginInfo-Version=1.0 -X-KDE-PluginInfo-Website=plasma.kde.org -X-KDE-ServiceTypes=Plasma/Applet -X-Plasma-API=declarativeappletscript -X-Plasma-MainScript=ui/main.qml diff --git a/plasmoid/metadata.json b/plasmoid/metadata.json new file mode 100644 index 0000000..e76ca40 --- /dev/null +++ b/plasmoid/metadata.json @@ -0,0 +1,21 @@ +{ + "KPlugin": { + "Authors": [ + { + "Email": "christian@duvholt.net", + "Name": "Christian duvholt" + } + ], + "Description": "i3 Pager", + "Id": "org.kde.I3Pager", + "License": "GPL", + "Name": "i3Pager", + "ServiceTypes": [ + "Plasma/Applet" + ], + "Version": "1.0", + "Website": "plasma.kde.org" + }, + "X-Plasma-API": "declarativeappletscript", + "X-Plasma-MainScript": "ui/main.qml" +} From ecddfdcde1a014a3b9b08658cf16811cb2fe529a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Thu, 12 Oct 2023 02:20:36 +0300 Subject: [PATCH 04/12] Support sigcpp3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Bidar --- CMakeLists.txt | 2 ++ i3ipc++ | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c89ca5f..43a23e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,8 @@ include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings) +set(CMAKE_CXX_STANDARD 17) + find_package(KF5Plasma REQUIRED) find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Quick Concurrent) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Plasma) diff --git a/i3ipc++ b/i3ipc++ index edb1a86..50ae728 160000 --- a/i3ipc++ +++ b/i3ipc++ @@ -1 +1 @@ -Subproject commit edb1a864f04c2fdf1e83d7bd23017b62b08961ca +Subproject commit 50ae7287c2ddb57fb81381d0e0d3775b77bd5f66 From c30ddbca397bf2cc72bb492286e229d9b55fb2c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Sun, 21 Apr 2024 21:22:23 +0300 Subject: [PATCH 05/12] Raise CMake version to the minimum require by KF5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Bidar --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 43a23e3..dfb4e50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.16.0) find_package(ECM REQUIRED NO_MODULE) From ccd2c426641256796052325c636526477c4fa90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Sun, 21 Apr 2024 21:30:48 +0300 Subject: [PATCH 06/12] CMake changes for KF6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Bidar --- CMakeLists.txt | 31 ++++++++++++++++++++++++++----- src/CMakeLists.txt | 11 +++++++++-- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dfb4e50..c3c3b33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,19 +1,38 @@ cmake_minimum_required(VERSION 3.16.0) +project(I3Pager) + find_package(ECM REQUIRED NO_MODULE) +set(CMAKE_CXX_STANDARD 17) +set(QT_MAJOR_VERSION "6") +set(QT_MIN_VERSION "6.4.0") +set(KF_MIN_VERSION "6.0.0") +set(KF_MAJOR_VERSION "6") + set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_MODULE_PATH}) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings) +include(FeatureSummary) -set(CMAKE_CXX_STANDARD 17) +find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} + CONFIG REQUIRED + Quick + Concurrent + # Plugin + Widgets +) +find_package(KF${KF_MAJOR_VERSION} ${KF6_MIN_VERSION} + REQUIRED COMPONENTS + WindowSystem + # Pulled in by Plasma + Config + +) +find_package(Plasma) -find_package(KF5Plasma REQUIRED) -find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Quick Concurrent) -find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Plasma) -find_package(KF5WindowSystem) plasma_install_package(plasmoid org.kde.I3Pager) @@ -24,3 +43,5 @@ add_subdirectory(i3ipc++) target_compile_options(i3ipc++ PRIVATE -fexceptions -fPIC -Wno-deprecated-declarations) add_subdirectory(src) + +feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d74b637..f5b6582 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,7 +12,7 @@ add_library(plasmoidplugin SHARED ${plasmoidplugin_SRCS}) target_compile_options(plasmoidplugin PRIVATE -fexceptions) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g3") -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DQT_NO_DEBUG_OUTPUT") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") if (CI_ERRORS) target_compile_options(plasmoidplugin PRIVATE -Werror -Wall -Wextra -pedantic-errors) @@ -20,7 +20,14 @@ endif() include_directories(${I3IPCpp_INCLUDE_DIRS}) link_directories(${I3IPCpp_LIBRARY_DIRS}) -target_link_libraries(plasmoidplugin Qt5::Quick Qt5::Widgets KF5::Plasma KF5::WindowSystem ${I3IPCpp_LIBRARIES}) + +target_link_libraries(plasmoidplugin + Qt${QT_MAJOR_VERSION}Quick + Qt${QT_MAJOR_VERSION}::Widgets + KF${KF_MAJOR_VERSION}::WindowSystem + ${I3IPCpp_LIBRARIES} + Plasma::Plasma) + # install plugin install(TARGETS plasmoidplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/private/I3Pager) From 7ecd82a793febea61c30bbd5d2d131f16096c2fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Sun, 21 Apr 2024 21:33:25 +0300 Subject: [PATCH 07/12] Add KDE-Ci config --- .gitlab-ci.yml | 13 +++++++++++++ .kde-ci.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 .kde-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..f8d888b --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: None +# SPDX-License-Identifier: CC0-1.0 + +variables: + GIT_SUBMODULE_STRATEGY: recursive + +include: + - project: sysadmin/ci-utilities + file: + - /gitlab-templates/linux.yml + - /gitlab-templates/freebsd.yml + - /gitlab-templates/linux-qt6.yml + - /gitlab-templates/freebsd-qt6.yml diff --git a/.kde-ci.yml b/.kde-ci.yml new file mode 100644 index 0000000..5bb7894 --- /dev/null +++ b/.kde-ci.yml @@ -0,0 +1,26 @@ +Dependencies: +- 'on': ['Linux/Qt5', 'FreeBSD/Qt5'] + 'require': + 'frameworks/extra-cmake-modules': '@stable' + 'frameworks/kcoreaddons': '@stable' + 'frameworks/kconfig': '@stable' + 'frameworks/kconfigwidgets': '@stable' + 'frameworks/ki18n': '@stable' + 'frameworks/knotifications': '@stable' + 'frameworks/krunner': '@stable' + 'frameworks/kcmutils': '@stable' + 'frameworks/kguiaddons': '@stable' + 'plasma/libplasma': '@stable' + +- 'on': ['Linux/Qt6', 'FreeBSD/Qt6'] + 'require': + 'frameworks/extra-cmake-modules': '@latest-kf6' + 'frameworks/kcoreaddons': '@latest-kf6' + 'frameworks/kconfig': '@latest-kf6' + 'frameworks/kconfigwidgets': '@latest-kf6' + 'frameworks/ki18n': '@latest-kf6' + 'frameworks/knotifications': '@latest-kf6' + 'frameworks/krunner': '@latest-kf6' + 'frameworks/kcmutils': '@latest-kf6' + 'frameworks/kguiaddons': '@latest-kf6' + 'plasma/libplasma': '@latest-kf6' From b577c5539b81aa8424c387aa740102535bcccc81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Sun, 21 Apr 2024 21:37:43 +0300 Subject: [PATCH 08/12] Rename Qt plugin to be more descriptive --- src/CMakeLists.txt | 13 ++++++------- src/qmldir | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f5b6582..b42f154 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -set(plasmoidplugin_SRCS +set(I3PagerPlugin_SRCS plugin.cpp plugin.h i3pager.cpp @@ -8,27 +8,26 @@ set(plasmoidplugin_SRCS workspace.cpp workspace.h) -add_library(plasmoidplugin SHARED ${plasmoidplugin_SRCS}) -target_compile_options(plasmoidplugin PRIVATE -fexceptions) +add_library(I3PagerPlugin SHARED ${I3PagerPlugin_SRCS}) +target_compile_options(I3PagerPlugin PRIVATE -fexceptions) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g3") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") if (CI_ERRORS) - target_compile_options(plasmoidplugin PRIVATE -Werror -Wall -Wextra -pedantic-errors) + target_compile_options(I3PagerPlugin PRIVATE -Werror -Wall -Wextra -pedantic-errors) endif() include_directories(${I3IPCpp_INCLUDE_DIRS}) link_directories(${I3IPCpp_LIBRARY_DIRS}) -target_link_libraries(plasmoidplugin +target_link_libraries(I3PagerPlugin Qt${QT_MAJOR_VERSION}Quick Qt${QT_MAJOR_VERSION}::Widgets KF${KF_MAJOR_VERSION}::WindowSystem ${I3IPCpp_LIBRARIES} Plasma::Plasma) - # install plugin -install(TARGETS plasmoidplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/private/I3Pager) +install(TARGETS I3PagerPlugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/private/I3Pager) install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/private/I3Pager) diff --git a/src/qmldir b/src/qmldir index f87394b..7773f67 100644 --- a/src/qmldir +++ b/src/qmldir @@ -1,3 +1,3 @@ module org.kde.private.I3Pager -plugin plasmoidplugin +plugin I3PagerPlugin From 62f598bec1ab38296666bb2487766d25884f36ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Mon, 22 Apr 2024 01:20:32 +0300 Subject: [PATCH 09/12] Remove unused QDesktopWidget --- src/i3pager.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/i3pager.h b/src/i3pager.h index d493e21..07a40ff 100644 --- a/src/i3pager.h +++ b/src/i3pager.h @@ -5,7 +5,6 @@ #include "workspace.h" #include #include -#include #include #include #include From 4735fcb058fd1684094c747cdb4fe0e2dcfb5ce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Mon, 22 Apr 2024 07:05:37 +0300 Subject: [PATCH 10/12] KCM changes required for KF6 --- plasmoid/contents/ui/configGeneral.qml | 227 +++++++++-------- plasmoid/contents/ui/configScreens.qml | 327 ++++++++++++++----------- 2 files changed, 309 insertions(+), 245 deletions(-) diff --git a/plasmoid/contents/ui/configGeneral.qml b/plasmoid/contents/ui/configGeneral.qml index a1c091e..e17635e 100644 --- a/plasmoid/contents/ui/configGeneral.qml +++ b/plasmoid/contents/ui/configGeneral.qml @@ -1,12 +1,10 @@ import QtQuick 2.0 import QtQuick.Controls 2.5 import QtQuick.Layouts 1.12 -import org.kde.kirigami 2.4 as Kirigami +import org.kde.kirigami 2.5 as Kirigami +import org.kde.kcmutils as KCM -Kirigami.FormLayout { - id : page - width : childrenRect.width - height : childrenRect.height +KCM.SimpleKCM { property alias cfg_showWorkspaceNames : showWorkspaceNames.checked property alias cfg_filterByCurrentScreen : filterByCurrentScreen.checked @@ -14,128 +12,149 @@ Kirigami.FormLayout { property alias cfg_rounded : rounded.checked property var cfg_orderWorkspacesBy property var cfg_style + property var cfg_styleDefault property var cfg_indicatorPosition + property var cfg_colorWorkspaceByScreen + property var cfg_colorWorkspaceByScreenDefault + property var cfg_filterByCurrentScreenDefault + property var cfg_indicatorPositionDefault + property var cfg_orderWorkspacesByDefault + property var cfg_roundedDefault + property var cfg_screenColorList + property var cfg_screenColorListDefault + property var cfg_screenColorOpacity + property var cfg_screenColorOpacityDefault + property var cfg_screenNameList + property var cfg_screenNameListDefault + property var cfg_showWorkspaceNamesDefault + property var cfg_urgentColorWholeWorkspaceDefault + + Kirigami.FormLayout { + id : page + width : childrenRect.width + height : childrenRect.height + + ColumnLayout { + Kirigami.FormData.label : i18n("Basic:") + Kirigami.FormData.buddyFor : showWorkspaceNames + + CheckBox { + id : showWorkspaceNames + text : i18n("Show workspace names") + checked : plasmoid.configuration.showWorkspaceNames + onCheckedChanged : plasmoid.configuration.showWorkspaceNames = checked + } - ColumnLayout { - Kirigami.FormData.label : i18n("Basic:") - Kirigami.FormData.buddyFor : showWorkspaceNames - - CheckBox { - id : showWorkspaceNames - text : i18n("Show workspace names") - checked : plasmoid.configuration.showWorkspaceNames - onCheckedChanged : plasmoid.configuration.showWorkspaceNames = checked - } + CheckBox { + id : filterByCurrentScreen + text : i18n("Filter workspaces by current screen") + checked : plasmoid.configuration.filterByCurrentScreen + onCheckedChanged : plasmoid.configuration.filterByCurrentScreen = checked + } - CheckBox { - id : filterByCurrentScreen - text : i18n("Filter workspaces by current screen") - checked : plasmoid.configuration.filterByCurrentScreen - onCheckedChanged : plasmoid.configuration.filterByCurrentScreen = checked - } + CheckBox { + id : urgentColorWholeWorkspace + text : i18n("Color the whole workspace if urgent") + checked : plasmoid.configuration.urgentColorWholeWorkspace + onCheckedChanged : plasmoid.configuration.urgentColorWholeWorkspace = checked + } - CheckBox { - id : urgentColorWholeWorkspace - text : i18n("Color the whole workspace if urgent") - checked : plasmoid.configuration.urgentColorWholeWorkspace - onCheckedChanged : plasmoid.configuration.urgentColorWholeWorkspace = checked + CheckBox { + id : rounded + text : i18n("Rounded corners") + checked : plasmoid.configuration.rounded + onCheckedChanged : plasmoid.configuration.rounded = checked + } } - CheckBox { - id : rounded - text : i18n("Rounded corners") - checked : plasmoid.configuration.rounded - onCheckedChanged : plasmoid.configuration.rounded = checked + Item { + Kirigami.FormData.isSection : true } - } - - Item { - Kirigami.FormData.isSection : true - } - - ColumnLayout { - Kirigami.FormData.label : i18n("Order workspaces by:") - Kirigami.FormData.buddyFor : orderWorkspacesByDefaultRadio - RadioButton { - id : orderWorkspacesByDefaultRadio - text : i18n("Default") - checked : cfg_orderWorkspacesBy == "default" - onClicked : { - cfg_orderWorkspacesBy = "default" + ColumnLayout { + Kirigami.FormData.label : i18n("Order workspaces by:") + Kirigami.FormData.buddyFor : orderWorkspacesByDefaultRadio + + RadioButton { + id : orderWorkspacesByDefaultRadio + text : i18n("Default") + checked : cfg_orderWorkspacesBy == "default" + onClicked : { + cfg_orderWorkspacesBy = "default" + } } - } - RadioButton { - id : orderWorkspacesByScreenRadio - text : i18n("Screen") - checked : cfg_orderWorkspacesBy == "screen" - onClicked : { - cfg_orderWorkspacesBy = "screen" + RadioButton { + id : orderWorkspacesByScreenRadio + text : i18n("Screen") + checked : cfg_orderWorkspacesBy == "screen" + onClicked : { + cfg_orderWorkspacesBy = "screen" + } } - } - - RadioButton { - id : orderWorkspacesByName - text : i18n("Name") - checked : cfg_orderWorkspacesBy == "name" - onClicked : { - cfg_orderWorkspacesBy = "name" + + RadioButton { + id : orderWorkspacesByName + text : i18n("Name") + checked : cfg_orderWorkspacesBy == "name" + onClicked : { + cfg_orderWorkspacesBy = "name" + } } } - } - Item { - Kirigami.FormData.isSection : true - } - - ColumnLayout { - Kirigami.FormData.label : i18n("Indicator style:") - Kirigami.FormData.buddyFor : styleUnderlineRadio + Item { + Kirigami.FormData.isSection : true + } - RadioButton { - id : styleUnderlineRadio - text : i18n("Line") - checked : cfg_style == "line" - onClicked : { - cfg_style = "line" + ColumnLayout { + Kirigami.FormData.label : i18n("Indicator style:") + Kirigami.FormData.buddyFor : styleUnderlineRadio + + RadioButton { + id : styleUnderlineRadio + text : i18n("Line") + checked : cfg_style == "line" + onClicked : { + cfg_style = "line" + } } - } - RadioButton { - id : styleBorderRadio - text : i18n("Border") - checked : cfg_style == "border" - onClicked : { - cfg_style = "border" + RadioButton { + id : styleBorderRadio + text : i18n("Border") + checked : cfg_style == "border" + onClicked : { + cfg_style = "border" + } } } - } - Item { - Kirigami.FormData.isSection : true - } + Item { + Kirigami.FormData.isSection : true + } - ColumnLayout { - Kirigami.FormData.label : i18n("Indicator position:") - Kirigami.FormData.buddyFor : indicatorPositionTopRadio - visible : cfg_style == "line" - - RadioButton { - id : indicatorPositionTopRadio - text : i18n("Top") - checked : cfg_indicatorPosition == "top" - onClicked : { - cfg_indicatorPosition = "top" + ColumnLayout { + Kirigami.FormData.label : i18n("Indicator position:") + Kirigami.FormData.buddyFor : indicatorPositionTopRadio + visible : cfg_style == "line" + + RadioButton { + id : indicatorPositionTopRadio + text : i18n("Top") + checked : cfg_indicatorPosition == "top" + onClicked : { + cfg_indicatorPosition = "top" + } } - } - RadioButton { - id : indicatorPositionBottomRadio - text : i18n("Bottom") - checked : cfg_indicatorPosition == "bottom" - onClicked : { - cfg_indicatorPosition = "bottom" + RadioButton { + id : indicatorPositionBottomRadio + text : i18n("Bottom") + checked : cfg_indicatorPosition == "bottom" + onClicked : { + cfg_indicatorPosition = "bottom" + } } } } diff --git a/plasmoid/contents/ui/configScreens.qml b/plasmoid/contents/ui/configScreens.qml index f69844e..c5ad318 100644 --- a/plasmoid/contents/ui/configScreens.qml +++ b/plasmoid/contents/ui/configScreens.qml @@ -1,180 +1,225 @@ -import QtQuick 2.14 -import QtQuick.Controls 2.5 -import Qt.labs.qmlmodels 1.0 -import QtQml.Models 2.1 -import QtQuick.Layouts 1.3 -import QtQuick.Dialogs 1.0 -import org.kde.kirigami 2.10 as Kirigami -import org.kde.private.I3Pager 1.0 +import QtQuick 2.15 +import QtQuick.Controls +import QtQuick.Templates 2.4 as QQC2 +import Qt.labs.qmlmodels +import QtQml.Models +import QtQuick.Layouts +import QtQuick.Dialogs +import org.kde.kirigami as Kirigami +import org.kde.kirigami.delegates as KirigamiDelegates +import org.kde.private.I3Pager import "screens.js" as ScreensJS +import org.kde.kcmutils as KCM -ColumnLayout { - id : page +KCM.SimpleKCM { property var cfg_screenNameList property var cfg_screenColorList property var cfg_screenColorOpacity property alias cfg_colorWorkspaceByScreen : colorWorkspaceByScreen.checked + property var cfg_orderWorkspacesBy + property var cfg_style + property var cfg_styleDefault + property var cfg_indicatorPosition + property var cfg_colorWorkspaceByScreenDefault + property var cfg_filterByCurrentScreenDefault + property var cfg_indicatorPositionDefault + property var cfg_orderWorkspacesByDefault + property var cfg_roundedDefault + property var cfg_screenColorListDefault + property var cfg_filterByCurrentScreen + property var cfg_showWorkspaceNamesDefault + property var cfg_urgentColorWholeWorkspaceDefault + property var cfg_urgentColorWholeWorkspace + property var cfg_rounded + property var cfg_screenColorOpacityDefault + property var cfg_screenNameListDefault + property var cfg_showWorkspaceNames + + ColumnLayout { + id : page + + + I3Pager { + id : i3pager + } - I3Pager { - id : i3pager - } - - Kirigami.FormLayout { - CheckBox { - Kirigami.FormData.label : i18n("Color workspaces by screen:") + Kirigami.FormLayout { + CheckBox { + Kirigami.FormData.label : i18n("Color workspaces by screen:") - id : colorWorkspaceByScreen - checked : plasmoid.configuration.colorWorkspaceByScreen - onCheckedChanged : plasmoid.configuration.colorWorkspaceByScreen = checked - } + id : colorWorkspaceByScreen + checked : plasmoid.configuration.colorWorkspaceByScreen + onCheckedChanged : plasmoid.configuration.colorWorkspaceByScreen = checked + } - RowLayout { - Kirigami.FormData.label : i18n("Workspace color opacity:") - - Slider { - id : screenColorOpacity - from : 0 - to : 1 - stepSize : 0.05 - snapMode : Slider.SnapAlways - value : cfg_screenColorOpacity - onMoved : { - cfg_screenColorOpacity = value; - ScreensJS.saveConfig(); + RowLayout { + Kirigami.FormData.label : i18n("Workspace color opacity:") + + Slider { + id : screenColorOpacity + from : 0 + to : 1 + stepSize : 0.05 + snapMode : Slider.SnapAlways + value : cfg_screenColorOpacity + onMoved : { + cfg_screenColorOpacity = value; + ScreensJS.saveConfig(); + } } - } - SpinBox { - from : 0 - to : 100 - stepSize : 5 - value : cfg_screenColorOpacity * 100 - onValueModified : { - cfg_screenColorOpacity = value / 100; - ScreensJS.saveConfig(); + SpinBox { + from : 0 + to : 100 + stepSize : 5 + value : cfg_screenColorOpacity * 100 + onValueModified : { + cfg_screenColorOpacity = value / 100; + ScreensJS.saveConfig(); + } } } } - } - - ScrollView { - id : scrollView - - Layout.fillWidth : true - Layout.fillHeight : true - contentHeight : screensListView.implicitHeight - - Component.onCompleted : { - scrollView.background.visible = true; - } - ScrollBar.horizontal.policy : ScrollBar.AlwaysOff - property bool scrollBarVisible : ScrollBar.vertical && ScrollBar.vertical.visible - property var scrollBarWidth: scrollBarVisible ? ScrollBar.vertical.width : 0 + ScrollView { + id : scrollView - ListView { - id : screensListView - clip : true - - property var visibilityColumnWidth: Kirigami.Units.gridUnit + Layout.fillWidth : true + Layout.fillHeight : true + contentHeight : screensListView.implicitHeight Component.onCompleted : { - ScreensJS.loadConfig(); - ScreensJS.loadNewScreens(); - ScreensJS.saveConfig(); + scrollView.background.visible = true; } - model : ListModel { - id : screenListModel - dynamicRoles : true - } + ScrollBar.horizontal.policy : ScrollBar.AlwaysOff + property bool scrollBarVisible : ScrollBar.vertical && ScrollBar.vertical.visible + property var scrollBarWidth: scrollBarVisible ? ScrollBar.vertical.width : 0 - header : Kirigami.AbstractListItem { - hoverEnabled : false + ListView { + id : screensListView + //clip : true FIXME - RowLayout { - Kirigami.Heading { - text : i18n("Name") - level : 2 - Layout.fillWidth : true - } - Kirigami.Heading { - text : i18n("Color") - level : 2 - Layout.preferredWidth : screensListView.visibilityColumnWidth - Component.onCompleted : screensListView.visibilityColumnWidth = Math.max(implicitWidth, screensListView.visibilityColumnWidth) - } - Kirigami.Heading { - text : i18n("Actions") - level : 2 - Layout.preferredWidth : screensListView.visibilityColumnWidth - Component.onCompleted : screensListView.visibilityColumnWidth = Math.max(implicitWidth, screensListView.visibilityColumnWidth) - } + property var visibilityColumnWidth: Kirigami.Units.gridUnit + + Component.onCompleted : { + ScreensJS.loadConfig(); + ScreensJS.loadNewScreens(); + ScreensJS.saveConfig(); } - } - delegate : Kirigami.AbstractListItem { - highlighted : false - hoverEnabled : false + model : ListModel { + id : screenListModel + dynamicRoles : true + } - contentItem : RowLayout { - Label { - Layout.fillWidth : true - text : screenName - } + header : Kirigami.ListSectionHeader { + hoverEnabled : false + implicitWidth: contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : Kirigami.Units.gridUnit * 12 + width: parent && parent.width > 0 ? parent.width : implicitWidth + //Layout.fillWidth: true - MouseArea { - hoverEnabled : true - cursorShape : Qt.PointingHandCursor - Layout.fillHeight : true - property var contentWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding) - implicitWidth : Math.max(contentWidth, screensListView.visibilityColumnWidth) - Component.onCompleted : screensListView.visibilityColumnWidth = Math.max(implicitWidth, screensListView.visibilityColumnWidth) - onClicked : { - colorDialog.color = screenColor; - colorDialog.open(); + RowLayout { + Kirigami.Heading { + text : i18n("Name") + level : 2 + Layout.fillWidth : true } - - Rectangle { - id : colorRectangle - width : parent.width - height : parent.height - color : screenColor + Kirigami.Heading { + text : i18n("Color") + level : 2 + Layout.preferredWidth : screensListView.visibilityColumnWidth + Component.onCompleted : screensListView.visibilityColumnWidth = Math.max(implicitWidth, screensListView.visibilityColumnWidth) } - - ColorDialog { - id : colorDialog - title : "Please choose a screen color" - onAccepted : { - screenListModel.set(index, { - screenName: screenName, - screenColor: colorDialog.color - }); - ScreensJS.saveConfig(); - } + Kirigami.Heading { + text : i18n("Actions") + level : 2 + Layout.preferredWidth : screensListView.visibilityColumnWidth + Component.onCompleted : screensListView.visibilityColumnWidth = Math.max(implicitWidth, screensListView.visibilityColumnWidth) } } + } - RowLayout { - property var contentWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding) - implicitWidth : Math.max(contentWidth, screensListView.visibilityColumnWidth) - Component.onCompleted : screensListView.visibilityColumnWidth = Math.max(implicitWidth, screensListView.visibilityColumnWidth) + delegate : QQC2.ItemDelegate { + highlighted : false + hoverEnabled : false + implicitWidth: contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : Kirigami.Units.gridUnit * 12 + implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding + width: parent && parent.width > 0 ? parent.width : implicitWidth + Layout.fillWidth: true + opacity: 1 + + /* onVisibleChanged: { */ + /* if (visible) { */ + /* height = Qt.binding(() => implicitHeight); */ + /* } else { */ + /* if (ListView.view && ListView.view.visible) { */ + /* height = 0; */ + /* } */ + /* } */ + /* } */ + + + + contentItem : RowLayout { + Label { + Layout.fillWidth : true + text : screenName + } - Button { - enabled : index != 0 - icon.name : "up" + MouseArea { + hoverEnabled : true + cursorShape : Qt.PointingHandCursor + Layout.fillHeight : true + property var contentWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding) + implicitWidth : Math.max(contentWidth, screensListView.visibilityColumnWidth) + Component.onCompleted : screensListView.visibilityColumnWidth = Math.max(implicitWidth, screensListView.visibilityColumnWidth) onClicked : { - screenListModel.move(index, index - 1, 1); - ScreensJS.saveConfig(); + colorDialog.color = screenColor; + colorDialog.open(); + } + + Rectangle { + id : colorRectangle + width : parent.width + height : parent.height + color : screenColor + } + + ColorDialog { + id : colorDialog + title : "Please choose a screen color" + onAccepted : { + screenListModel.set(index, { + screenName: screenName, + screenColor: colorDialog.color + }); + ScreensJS.saveConfig(); + } } } - Button { - enabled : index != (screenListModel.count - 1) - icon.name : "down" - onClicked : { - screenListModel.move(index, index + 1, 1); - ScreensJS.saveConfig(); + + RowLayout { + property var contentWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding) + implicitWidth : Math.max(contentWidth, screensListView.visibilityColumnWidth) + Component.onCompleted : screensListView.visibilityColumnWidth = Math.max(implicitWidth, screensListView.visibilityColumnWidth) + + Button { + enabled : index != 0 + icon.name : "up" + onClicked : { + screenListModel.move(index, index - 1, 1); + ScreensJS.saveConfig(); + } + } + Button { + enabled : index != (screenListModel.count - 1) + icon.name : "down" + onClicked : { + screenListModel.move(index, index + 1, 1); + ScreensJS.saveConfig(); + } } } } From a4413f3013d5ea50ac359c514e2cb66e9419a062 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Mon, 22 Apr 2024 16:00:57 +0300 Subject: [PATCH 11/12] Remove versioned dependencies, port from deprecated Plasma imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As recommend by Porting Plasmoids to KF6: "Un-version your QML module imports. This is unnecessary in Qt6 and can cause bugs." https://develop.kde.org/docs/plasma/widget/porting_kf6/#porting-an-existing-plasmoid Signed-off-by: Björn Bidar --- plasmoid/contents/config/config.qml | 6 +- plasmoid/contents/ui/configGeneral.qml | 8 +- plasmoid/contents/ui/main.qml | 358 +++++++++++++------------ plasmoid/metadata.json | 1 + 4 files changed, 189 insertions(+), 184 deletions(-) diff --git a/plasmoid/contents/config/config.qml b/plasmoid/contents/config/config.qml index e2c1243..e85f9b4 100755 --- a/plasmoid/contents/config/config.qml +++ b/plasmoid/contents/config/config.qml @@ -1,5 +1,5 @@ -import QtQuick 2.0 -import org.kde.plasma.configuration 2.0 +import QtQuick 2.15 +import org.kde.plasma.configuration ConfigModel { ConfigCategory { @@ -12,4 +12,4 @@ ConfigModel { icon: "monitor" source: "configScreens.qml" } -} \ No newline at end of file +} diff --git a/plasmoid/contents/ui/configGeneral.qml b/plasmoid/contents/ui/configGeneral.qml index e17635e..28900c2 100644 --- a/plasmoid/contents/ui/configGeneral.qml +++ b/plasmoid/contents/ui/configGeneral.qml @@ -1,7 +1,7 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.5 -import QtQuick.Layouts 1.12 -import org.kde.kirigami 2.5 as Kirigami +import QtQuick 2.15 +import QtQuick.Controls +import QtQuick.Layouts +import org.kde.kirigami as Kirigami import org.kde.kcmutils as KCM KCM.SimpleKCM { diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml index c5e52bb..509f10d 100644 --- a/plasmoid/contents/ui/main.qml +++ b/plasmoid/contents/ui/main.qml @@ -1,206 +1,210 @@ -import QtQuick 2.13 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 1.3 -import QtQuick.Dialogs 1.3 -import QtQuick.Controls.Styles 1.3 -import org.kde.plasma.plasmoid 2.0 -import QtQuick.Window 2.13 -import org.kde.private.I3Pager 1.0 +import QtQuick 2.15 +import QtQuick.Layouts +import QtQuick.Controls +import QtQuick.Dialogs +import QtQuick.Window +import org.kde.plasma.plasmoid +import org.kde.kirigami as Kirigami +import org.kde.private.I3Pager -ColumnLayout { +PlasmoidItem { + id : root readonly property color defaultWorkspace : "transparent" - readonly property color focusedWorkspace : theme.positiveTextColor - readonly property color visibleWorkspace : theme.neutralTextColor - readonly property color urgentWorkspace : theme.negativeTextColor - readonly property color mouseWorkspace : theme.linkColor + readonly property color focusedWorkspace : Kirigami.Theme.positiveTextColor + readonly property color visibleWorkspace : Kirigami.Theme.neutralTextColor + readonly property color urgentWorkspace : Kirigami.Theme.negativeTextColor + readonly property color mouseWorkspace : Kirigami.Theme.linkColor - id : root - Plasmoid.preferredRepresentation : Plasmoid.fullRepresentation + preferredRepresentation : Plasmoid.fullRepresentation - I3Pager { - id : i3pager - currentScreen : Screen.name - onWorkspacesChanged : { - updateWorkspaces(); - } - function updateWorkspaces() { - var screenNameList = [] - for (var screenName of plasmoid.configuration.screenNameList) { - screenNameList.push(screenName); + ColumnLayout { + id : rootColumnLayout + + I3Pager { + id : i3pager + currentScreen : Screen.name + onWorkspacesChanged : { + updateWorkspaces(); + } + function updateWorkspaces() { + var screenNameList = [] + for (var screenName of plasmoid.configuration.screenNameList) { + screenNameList.push(screenName); + } + repeater.model = i3pager.getWorkspaces(plasmoid.configuration.filterByCurrentScreen, plasmoid.configuration.orderWorkspacesBy, screenNameList); } - repeater.model = i3pager.getWorkspaces(plasmoid.configuration.filterByCurrentScreen, plasmoid.configuration.orderWorkspacesBy, screenNameList); } - } - Connections { - target : plasmoid.configuration - onFilterByCurrentScreenChanged : { - i3pager.updateWorkspaces(); - } - onOrderWorkspacesByChanged : { - i3pager.updateWorkspaces(); - } - onScreenNameListChanged : { - i3pager.updateWorkspaces(); - } - onIndicatorPositionChanged : { - i3pager.updateWorkspaces(); + Connections { + target : plasmoid.configuration + onFilterByCurrentScreenChanged : { + i3pager.updateWorkspaces(); + } + onOrderWorkspacesByChanged : { + i3pager.updateWorkspaces(); + } + onScreenNameListChanged : { + i3pager.updateWorkspaces(); + } + onIndicatorPositionChanged : { + i3pager.updateWorkspaces(); + } } - } - // Hack to update current screen - Screen.onNameChanged : { - i3pager.currentScreen = Screen.name - } + // Hack to update current screen + Screen.onNameChanged : { + i3pager.currentScreen = Screen.name + } - Row { - id : workspaceRow - Layout.alignment : Layout.AlignVCenter | Layout.AlignHCenter - spacing : 2 + Row { + id : workspaceRow + Layout.alignment : Layout.AlignVCenter | Layout.AlignHCenter + spacing : 2 - Repeater { - id : repeater + Repeater { + id : repeater - MouseArea { - id : mouseArea - hoverEnabled : true - cursorShape : Qt.PointingHandCursor - onClicked : { - i3pager.activateWorkspace(modelData.id) - } - width : textRow.width - height : root.height - function getIndicatorColor() { - if (mouseArea.containsMouse) { - return mouseWorkspace; - } else if (modelData.urgent && !plasmoid.configuration.urgentColorWholeWorkspace) { - return urgentWorkspace; - } else if (modelData.focused) { - return focusedWorkspace; - } else if (modelData.visible) { - return visibleWorkspace; + MouseArea { + id : mouseArea + hoverEnabled : true + cursorShape : Qt.PointingHandCursor + onClicked : { + i3pager.activateWorkspace(modelData.id) } - return defaultWorkspace; - } - function getFillColor() { - if (modelData.urgent && plasmoid.configuration.urgentColorWholeWorkspace) { - return urgentWorkspace; - } else if (!plasmoid.configuration.colorWorkspaceByScreen) { - return "transparent"; + width : textRow.width + height : root.height + function getIndicatorColor() { + if (mouseArea.containsMouse) { + return mouseWorkspace; + } else if (modelData.urgent && !plasmoid.configuration.urgentColorWholeWorkspace) { + return urgentWorkspace; + } else if (modelData.focused) { + return focusedWorkspace; + } else if (modelData.visible) { + return visibleWorkspace; + } + return defaultWorkspace; + } + function getFillColor() { + if (modelData.urgent && plasmoid.configuration.urgentColorWholeWorkspace) { + return urgentWorkspace; + } else if (!plasmoid.configuration.colorWorkspaceByScreen) { + return "transparent"; + } + var indexOfScreen = plasmoid.configuration.screenNameList.indexOf(modelData.output); + var screenColor = plasmoid.configuration.screenColorList[indexOfScreen]; + return screenColor; + } + function getRadius() { + return plasmoid.configuration.rounded ? 3 : 0; } - var indexOfScreen = plasmoid.configuration.screenNameList.indexOf(modelData.output); - var screenColor = plasmoid.configuration.screenColorList[indexOfScreen]; - return screenColor; - } - function getRadius() { - return plasmoid.configuration.rounded ? 3 : 0; - } - Rectangle { // Border style - visible : plasmoid.configuration.style == "border" - color : mouseArea.getFillColor() - radius : getRadius() - height : textRow.height - width : textRow.width - border { - width : 2 - color : mouseArea.getIndicatorColor() + Rectangle { // Border style + visible : plasmoid.configuration.style === "border" + color : mouseArea.getFillColor() + radius : getRadius() + height : textRow.height + width : textRow.width + border { + width : 2 + color : mouseArea.getIndicatorColor() + } } - } - Rectangle { // Underline style - visible : plasmoid.configuration.style == "line" - color : mouseArea.getFillColor() - radius : getRadius() - height : textRow.height - width : textRow.width + Rectangle { // Underline style + visible : plasmoid.configuration.style === "line" + color : mouseArea.getFillColor() + radius : getRadius() + height : textRow.height + width : textRow.width - Rectangle { - Component.onCompleted : { - if (plasmoid.configuration.indicatorPosition == "top") { - anchors.top = parent.top; - } else { - anchors.bottom = parent.bottom; + Rectangle { + Component.onCompleted : { + if (plasmoid.configuration.indicatorPosition === "top") { + anchors.top = parent.top; + } else { + anchors.bottom = parent.bottom; + } } - } - height : 5 - width : textRow.width - radius : getRadius() - color : mouseArea.getIndicatorColor() + height : 5 + width : textRow.width + radius : getRadius() + color : mouseArea.getIndicatorColor() + } } - } - RowLayout { - id : textRow - height : parent.height + RowLayout { + id : textRow + height : parent.height - Rectangle { - width : 5 - } - Text { - font.family : theme.defaultFont.family - height : textRow.height - minimumPixelSize : theme.smallestFont.pixelSize - font.pixelSize : Math.min(textRow.height * 0.5, 1.5 * theme.defaultFont.pixelSize) - fontSizeMode : Text.VerticalFit - color : theme.textColor - text : modelData.index - verticalAlignment : Text.AlignHCenter - } - Label { - id : icon - rightPadding : 3 - leftPadding : 3 - bottomPadding : 0 - height : textRow.height - minimumPixelSize : theme.smallestFont.pixelSize - font.pixelSize : Math.min(textRow.height * 0.5, 1.5 * theme.defaultFont.pixelSize) - fontSizeMode : Text.VerticalFit - font.family : "Font Awesome 5 Free Solid" - font.styleName : "Solid" - color : theme.textColor - text : modelData.icon - verticalAlignment : Text.AlignHCenter - visible : plasmoid.configuration.showWorkspaceNames - } - Text { - height : textRow.height - minimumPixelSize : theme.smallestFont.pixelSize - font.pixelSize : Math.min(textRow.height * 0.5, 1.5 * theme.defaultFont.pixelSize) - fontSizeMode : Text.VerticalFit - font.family : theme.defaultFont.family - color : theme.textColor - text : modelData.name - verticalAlignment : Text.AlignHCenter - visible : plasmoid.configuration.showWorkspaceNames - } - Rectangle { - width : 5 + Rectangle { + width : 5 + } + Text { + font.family : Kirigami.Theme.defaultFont.family + height : textRow.height + minimumPixelSize : Kirigami.Theme.smallFont.pixelSize + font.pixelSize : Math.min(textRow.height * 0.5, 1.5 * Kirigami.Theme.defaultFont.pixelSize) + fontSizeMode : Text.VerticalFit + color : Kirigami.Theme.textColor + text : modelData.index + verticalAlignment : Text.AlignHCenter + } + Label { + id : icon + rightPadding : 3 + leftPadding : 3 + bottomPadding : 0 + height : textRow.height + minimumPixelSize : Kirigami.Theme.smallFont.pixelSize + font.pixelSize : Math.min(textRow.height * 0.5, 1.5 * Kirigami.Theme.defaultFont.pixelSize) + fontSizeMode : Text.VerticalFit + font.family : "Font Awesome 5 Free Solid" + font.styleName : "Solid" + color : Kirigami.Theme.textColor + text : modelData.icon + verticalAlignment : Text.AlignHCenter + visible : plasmoid.configuration.showWorkspaceNames + } + Text { + height : textRow.height + minimumPixelSize : Kirigami.Theme.smallFont.pixelSize + font.pixelSize : Math.min(textRow.height * 0.5, 1.5 * Kirigami.Theme.defaultFont.pixelSize) + fontSizeMode : Text.VerticalFit + font.family : Kirigami.Theme.defaultFont.family + color : Kirigami.Theme.textColor + text : modelData.name + verticalAlignment : Text.AlignHCenter + visible : plasmoid.configuration.showWorkspaceNames + } + Rectangle { + width : 5 + } } } } - } - Item { - width : modeText.width - height : modeText.height - anchors.verticalCenter : parent.verticalCenter - visible : i3pager.mode != "default" - Rectangle { - color : "#e5c07b" - height : parent.height - width : parent.width - } - Text { - id : modeText - rightPadding : 10 - leftPadding : 10 - minimumPixelSize : theme.smallestFont.pixelSize - font.pixelSize : Math.min(textRow.height * 0.5, 1.5 * theme.defaultFont.pixelSize) - fontSizeMode : Text.VerticalFit - font.family : theme.defaultFont.family - color : "#333333" - text : i3pager.mode + Item { + width : modeText.width + height : modeText.height + anchors.verticalCenter : parent.verticalCenter + visible : i3pager.mode !== "default" + Rectangle { + color : "#e5c07b" + height : parent.height + width : parent.width + } + Text { + id : modeText + rightPadding : 10 + leftPadding : 10 + minimumPixelSize : Kirigami.Theme.smallFont.pixelSize + font.pixelSize : Math.min(textRow.height * 0.5, 1.5 * Kirigami.Theme.defaultFont.pixelSize) + fontSizeMode : Text.VerticalFit + font.family : Kirigami.Theme.defaultFont.family + color : "#333333" + text : i3pager.mode + } } } } diff --git a/plasmoid/metadata.json b/plasmoid/metadata.json index e76ca40..e4375e4 100644 --- a/plasmoid/metadata.json +++ b/plasmoid/metadata.json @@ -17,5 +17,6 @@ "Website": "plasma.kde.org" }, "X-Plasma-API": "declarativeappletscript", + "X-Plasma-API-Minimum-Version": "6.0", "X-Plasma-MainScript": "ui/main.qml" } From 9ded353fb16b64de3d7f8f773e64884378783688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bidar?= Date: Mon, 22 Apr 2024 17:33:29 +0300 Subject: [PATCH 12/12] Don't use deprecated onFoo property syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: `QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo() { ... }` Signed-off-by: Björn Bidar --- plasmoid/contents/ui/main.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml index 509f10d..9e22158 100644 --- a/plasmoid/contents/ui/main.qml +++ b/plasmoid/contents/ui/main.qml @@ -37,16 +37,16 @@ PlasmoidItem { Connections { target : plasmoid.configuration - onFilterByCurrentScreenChanged : { + function onFilterByCurrentScreenChanged() { i3pager.updateWorkspaces(); } - onOrderWorkspacesByChanged : { + function onOrderWorkspacesByChanged() { i3pager.updateWorkspaces(); } - onScreenNameListChanged : { + function onScreenNameListChanged() { i3pager.updateWorkspaces(); } - onIndicatorPositionChanged : { + function onIndicatorPositionChanged() { i3pager.updateWorkspaces(); } }