Add KWIN_BUILD_NOTIFICATIONS option

Notifications are really only useful in a setting with a full
shell environment where there is a notification center to display them.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
master
Kai Uwe Broulik 3 years ago committed by Kai Uwe Broulik
parent 0f448a83d9
commit 0793c24249

@ -78,7 +78,6 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
GlobalAccel
I18n
IdleTime
Notifications
Package
Plasma
WidgetsAddons
@ -335,6 +334,7 @@ include(CMakeDependentOption)
option(KWIN_BUILD_DECORATIONS "Enable building of KWin decorations." ON)
option(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON)
option(KWIN_BUILD_NOTIFICATIONS "Enable building of KWin with knotifications support" ON)
option(KWIN_BUILD_SCREENLOCKER "Enable building of KWin lockscreen functionality" ON)
option(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON)
cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON "KF5Activities_FOUND" OFF)
@ -391,6 +391,10 @@ add_feature_info("SCHED_RESET_ON_FORK"
pkg_check_modules(PipeWire IMPORTED_TARGET libpipewire-0.3>=0.3.29)
add_feature_info(PipeWire PipeWire_FOUND "Required for Wayland screencasting")
if (KWIN_BUILD_NOTIFICATIONS)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Notifications)
endif()
if (KWIN_BUILD_SCREENLOCKER)
find_package(KScreenLocker CONFIG REQUIRED)
set_package_properties(KScreenLocker PROPERTIES

@ -175,7 +175,6 @@ target_link_libraries(kwin
KF5::GlobalAccel
KF5::GlobalAccelPrivate
KF5::I18n
KF5::Notifications
KF5::Package
KF5::Plasma
KF5::QuickAddons
@ -208,6 +207,10 @@ target_link_libraries(kwin
Threads::Threads
)
if (KWIN_BUILD_NOTIFICATIONS)
target_link_libraries(kwin KF5::Notifications)
endif()
kconfig_add_kcfg_files(kwin
settings.kcfgc
rulesettings.kcfgc
@ -341,7 +344,9 @@ if (PipeWire_FOUND)
endif()
install(FILES kwin.kcfg DESTINATION ${KDE_INSTALL_KCFGDIR} RENAME ${KWIN_NAME}.kcfg)
install(FILES kwin.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFY5RCDIR} RENAME ${KWIN_NAME}.notifyrc)
if (KWIN_BUILD_NOTIFICATIONS)
install(FILES kwin.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFY5RCDIR} RENAME ${KWIN_NAME}.notifyrc)
endif()
install(
FILES
org.kde.KWin.VirtualDesktopManager.xml

@ -6,6 +6,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config-kwin.h>
#include "composite.h"
#include "abstract_output.h"
#include "cursorview_opengl.h"
@ -45,7 +46,9 @@
#include <KGlobalAccel>
#include <KLocalizedString>
#if KWIN_BUILD_NOTIFICATIONS
#include <KNotification>
#endif
#include <KSelectionOwner>
#include <QDateTime>
@ -630,7 +633,9 @@ void Compositor::composite(RenderLoop *renderLoop)
{
if (m_backend->checkGraphicsReset()) {
qCDebug(KWIN_CORE) << "Graphics reset occurred";
#if KWIN_BUILD_NOTIFICATIONS
KNotification::event(QStringLiteral("graphicsreset"), i18n("Desktop effects were restarted due to a graphics reset"));
#endif
reinitialize();
return;
}
@ -837,7 +842,9 @@ void X11Compositor::suspend(X11Compositor::SuspendReason reason)
i18n("Desktop effects have been suspended by another application.<br/>"
"You can resume using the '%1' shortcut.",
shortcuts.first().toString(QKeySequence::NativeText));
#if KWIN_BUILD_NOTIFICATIONS
KNotification::event(QStringLiteral("compositingsuspendeddbus"), message);
#endif
}
}
stop();

@ -1,6 +1,7 @@
#define KWIN_PLUGIN_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
#cmakedefine01 KWIN_BUILD_DECORATIONS
#cmakedefine01 KWIN_BUILD_NOTIFICATIONS
#cmakedefine01 KWIN_BUILD_SCREENLOCKER
#cmakedefine01 KWIN_BUILD_TABBOX
#cmakedefine01 KWIN_BUILD_ACTIVITIES

@ -16,7 +16,6 @@ target_link_libraries(kwin4_effect_screenshot PRIVATE
kwineffects
kwinglutils
KF5::Notifications
KF5::Service
KF5::I18n
@ -24,6 +23,10 @@ target_link_libraries(kwin4_effect_screenshot PRIVATE
Qt::DBus
)
if (KWIN_BUILD_NOTIFICATIONS)
target_link_libraries(kwin4_effect_screenshot PRIVATE KF5::Notifications)
endif()
ecm_qt_declare_logging_category(kwin4_effect_screenshot
HEADER screenshotlogging.h
IDENTIFIER KWIN_SCREENSHOT

@ -5,12 +5,15 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config-kwin.h>
#include "screenshotdbusinterface1.h"
#include "screenshotlogging.h"
#include "utils/serviceutils.h"
#include <KLocalizedString>
#if KWIN_BUILD_NOTIFICATIONS
#include <KNotification>
#endif
#include <QDBusConnection>
#include <QDBusConnectionInterface>
@ -468,10 +471,13 @@ static QString saveTempImage(const QImage &image)
}
image.save(&temp);
temp.close();
qCInfo(KWIN_SCREENSHOT) << "Screenshot saved to" << temp.fileName();
#if KWIN_BUILD_NOTIFICATIONS
KNotification::event(KNotification::Notification,
i18nc("Notification caption that a screenshot got saved to file", "Screenshot"),
i18nc("Notification with path to screenshot file", "Screenshot saved to %1", temp.fileName()),
QStringLiteral("spectacle"));
#endif
return temp.fileName();
}

@ -8,6 +8,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config-kwin.h>
#include "xwayland.h"
#include "cursor.h"
#include "databridge.h"
@ -27,7 +28,9 @@
#include "xwaylandsocket.h"
#include <KLocalizedString>
#if KWIN_BUILD_NOTIFICATIONS
#include <KNotification>
#endif
#include <KSelectionOwner>
#include <QAbstractEventDispatcher>
@ -347,7 +350,9 @@ void Xwayland::handleXwaylandFinished(int exitCode, QProcess::ExitStatus exitSta
void Xwayland::handleXwaylandCrashed()
{
#if KWIN_BUILD_NOTIFICATIONS
KNotification::event(QStringLiteral("xwaylandcrash"), i18n("Xwayland has crashed"));
#endif
m_resetCrashCountTimer->stop();
switch (options->xwaylandCrashPolicy()) {

Loading…
Cancel
Save