# SPDX-License-Identifier: MIT cmake_minimum_required(VERSION 3.22) project(plasma-task-group-shortcuts VERSION 0.1.0 LANGUAGES C CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_AUTOMOC ON) find_package(ECM REQUIRED NO_MODULE) list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) include(GNUInstallDirs) include(CTest) find_package(Qt6 REQUIRED COMPONENTS DBus Gui Quick WaylandClient) find_package(KF6 REQUIRED COMPONENTS Config GlobalAccel Service) find_package(LibTaskManager REQUIRED) find_package(Plasma REQUIRED) find_package(PlasmaWaylandProtocols REQUIRED) find_package(XKB REQUIRED) # KWin caches both QML components and directory listings for its whole session. # Changed helper code needs a new directory, not just a new filename. file(SHA256 "${CMAKE_CURRENT_SOURCE_DIR}/TaskbarGeometry.qml" geometry_hash) set(geometry_dir "plasma-task-group-shortcuts/${geometry_hash}") configure_file(TaskbarGeometry.qml "qml/${geometry_hash}/TaskbarGeometry.qml" COPYONLY) add_executable(plasma-task-group-shortcuts keyboardlayout.cpp main.cpp pendingselection.cpp previewplacement.cpp taskbargeometry.cpp taskselection.cpp windowpreview.cpp ) target_compile_definitions(plasma-task-group-shortcuts PRIVATE GEOMETRY_SCRIPT_PATH="${CMAKE_INSTALL_FULL_DATADIR}/${geometry_dir}/TaskbarGeometry.qml") qt_add_resources(plasma-task-group-shortcuts preview PREFIX "/" FILES Preview.qml) qt6_generate_wayland_protocol_client_sources(plasma-task-group-shortcuts PRIVATE_CODE FILES ${PLASMA_WAYLAND_PROTOCOLS_DIR}/keystate.xml ) target_link_libraries(plasma-task-group-shortcuts PRIVATE Qt6::Gui Qt6::DBus Qt6::Quick Qt6::WaylandClient KF6::ConfigCore KF6::GlobalAccel KF6::Service PW::LibTaskManager Plasma::Plasma XKB::XKB ) install(TARGETS plasma-task-group-shortcuts DESTINATION ${CMAKE_INSTALL_BINDIR}) install(FILES TaskbarGeometry.qml DESTINATION "${CMAKE_INSTALL_DATADIR}/${geometry_dir}") install(FILES se.ajpanton.plasma-task-group-shortcuts.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) install(FILES se.ajpanton.plasma-task-group-shortcuts-autostart.desktop DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/xdg/autostart) if(BUILD_TESTING) find_package(Qt6 REQUIRED COMPONENTS Test) add_executable(test-taskselection tests/test-taskselection.cpp taskselection.cpp ) target_link_libraries(test-taskselection PRIVATE Qt6::Test KF6::ConfigCore KF6::Service PW::LibTaskManager ) add_test(NAME taskselection COMMAND test-taskselection) add_executable(test-keyboardlayout tests/test-keyboardlayout.cpp keyboardlayout.cpp ) target_link_libraries(test-keyboardlayout PRIVATE Qt6::Test Qt6::Gui Qt6::DBus XKB::XKB ) add_test(NAME keyboardlayout COMMAND test-keyboardlayout) add_executable(test-pendingselection tests/test-pendingselection.cpp pendingselection.cpp) target_link_libraries(test-pendingselection PRIVATE Qt6::Test Qt6::Gui) add_test(NAME pendingselection COMMAND test-pendingselection) add_executable(test-preview tests/test-preview.cpp taskbargeometry.cpp previewplacement.cpp) target_compile_definitions(test-preview PRIVATE GEOMETRY_SCRIPT_PATH="${CMAKE_CURRENT_BINARY_DIR}/qml/${geometry_hash}/TaskbarGeometry.qml") qt_add_resources(test-preview preview PREFIX "/" FILES Preview.qml) target_link_libraries(test-preview PRIVATE Qt6::Test Qt6::Quick Qt6::DBus Plasma::Plasma PW::LibTaskManager KF6::Service) add_test(NAME preview COMMAND test-preview -platform offscreen) endif()