fix #102,show apps menu with Super key

--this needs from the user side to add
in the .config/kwinrc

[ModifierOnlyShortcuts]
Meta=org.kde.lattedock,/Latte,org.kde.LatteDock,activateLauncherMenu
v0.6
Michail Vourlakos 8 years ago
parent 9fc1bfd2d2
commit b56cbc4084

@ -16,7 +16,7 @@ set(KF5_LOCALE_PREFIX "")
find_package(ECM 1.8.0 REQUIRED NO_MODULE) find_package(ECM 1.8.0 REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED NO_MODULE COMPONENTS Quick Qml) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED NO_MODULE COMPONENTS Quick Qml DBus)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Plasma PlasmaQuick WindowSystem Declarative Activities Plasma PlasmaQuick WindowSystem Declarative Activities
I18n CoreAddons XmlGui DBusAddons IconThemes Wayland) I18n CoreAddons XmlGui DBusAddons IconThemes Wayland)

@ -15,14 +15,19 @@ set(lattedock-app_SRCS
main.cpp main.cpp
) )
set(latte_dbusXML dbus/org.kde.LatteDock.xml)
qt5_add_dbus_adaptor(lattedock-app_SRCS ${latte_dbusXML} dockcorona.h Latte::DockCorona lattedockadaptor)
add_executable(latte-dock ${lattedock-app_SRCS}) add_executable(latte-dock ${lattedock-app_SRCS})
include(FakeTarget.cmake) include(FakeTarget.cmake)
target_link_libraries(latte-dock target_link_libraries(latte-dock
Qt5::DBus
Qt5::Quick Qt5::Quick
Qt5::Qml Qt5::Qml
KF5::I18n KF5::I18n
KF5::DBusAddons
KF5::Declarative KF5::Declarative
KF5::CoreAddons KF5::CoreAddons
KF5::XmlGui KF5::XmlGui
@ -43,5 +48,7 @@ if(HAVE_X11)
endif() endif()
configure_file(latte-dock.desktop.cmake latte-dock.desktop) configure_file(latte-dock.desktop.cmake latte-dock.desktop)
install(TARGETS latte-dock ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS latte-dock ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/latte-dock.desktop DESTINATION ${KDE_INSTALL_APPDIR}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/latte-dock.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install(FILES dbus/org.kde.LatteDock.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR} )

@ -0,0 +1,7 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.LatteDock">
<method name="activateLauncherMenu">
</method>
</interface>
</node>

@ -24,10 +24,13 @@
#include "abstractwindowinterface.h" #include "abstractwindowinterface.h"
#include "alternativeshelper.h" #include "alternativeshelper.h"
#include "screenpool.h" #include "screenpool.h"
//dbus adaptor
#include "lattedockadaptor.h"
#include <QAction> #include <QAction>
#include <QApplication> #include <QApplication>
#include <QScreen> #include <QScreen>
#include <QDBusConnection>
#include <QDebug> #include <QDebug>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QDir> #include <QDir>
@ -77,6 +80,11 @@ DockCorona::DockCorona(QObject *parent)
m_docksScreenSyncTimer.setSingleShot(true); m_docksScreenSyncTimer.setSingleShot(true);
m_docksScreenSyncTimer.setInterval(2500); m_docksScreenSyncTimer.setInterval(2500);
connect(&m_docksScreenSyncTimer, &QTimer::timeout, this, &DockCorona::syncDockViews); connect(&m_docksScreenSyncTimer, &QTimer::timeout, this, &DockCorona::syncDockViews);
//! Dbus adaptor initialization
new LatteDockAdaptor(this);
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.registerObject(QStringLiteral("/Latte"), this);
} }
DockCorona::~DockCorona() DockCorona::~DockCorona()
@ -1088,6 +1096,25 @@ bool DockCorona::containmentContainsTasks(Plasma::Containment *cont)
return false; return false;
} }
//! Activate launcher menu through dbus interface
void DockCorona::activateLauncherMenu()
{
for (auto it = m_dockViews.constBegin(), end = m_dockViews.constEnd(); it != end; ++it) {
const auto applets = it.key()->applets();
for (auto applet : applets) {
const auto provides = KPluginMetaData::readStringList(applet->pluginMetaData().rawData(), QStringLiteral("X-Plasma-Provides"));
if (provides.contains(QLatin1String("org.kde.plasma.launchermenu"))) {
// if (!applet->globalShortcut().isEmpty()) {
emit applet->activated();
return;
// }
}
}
}
}
inline void DockCorona::qmlRegisterTypes() const inline void DockCorona::qmlRegisterTypes() const
{ {
qmlRegisterType<QScreen>(); qmlRegisterType<QScreen>();

@ -45,6 +45,7 @@ namespace Latte {
class DockCorona : public Plasma::Corona { class DockCorona : public Plasma::Corona {
Q_OBJECT Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.LatteDock")
public: public:
DockCorona(QObject *parent = nullptr); DockCorona(QObject *parent = nullptr);
@ -82,6 +83,7 @@ public:
ScreenPool *screenPool() const; ScreenPool *screenPool() const;
public slots: public slots:
void activateLauncherMenu();
void loadDefaultLayout() override; void loadDefaultLayout() override;
void dockContainmentDestroyed(QObject *cont); void dockContainmentDestroyed(QObject *cont);

@ -20,9 +20,11 @@ Categories=Utility;X-SuSE-DesktopUtility;
Exec=latte-dock %u Exec=latte-dock %u
Icon=latte-dock Icon=latte-dock
InitialPreference=1 InitialPreference=1
StartupNotify=true
Terminal=false Terminal=false
Type=Application Type=Application
X-KDE-PluginInfo-Author=@AUTHOR@ X-KDE-PluginInfo-Author=@AUTHOR@
X-KDE-PluginInfo-Email=@EMAIL@ X-KDE-PluginInfo-Email=@EMAIL@
X-KDE-PluginInfo-Website=@WEBSITE@ X-KDE-PluginInfo-Website=@WEBSITE@
X-KDE-StartupNotify=false
X-DBUS-StartupType=Unique
X-DBUS-ServiceName=org.kde.lattedock

@ -36,6 +36,7 @@
#include <KLocalizedString> #include <KLocalizedString>
#include <KAboutData> #include <KAboutData>
#include <KDBusService>
//! COLORS //! COLORS
@ -50,7 +51,8 @@
inline void configureAboutData(); inline void configureAboutData();
int main(int argc, char **argv) int main(int argc, char **argv)
{ // Devive pixel ratio has some problems in latte (plasmashell) currently. {
// Devive pixel ratio has some problems in latte (plasmashell) currently.
// - dialog continually expands (347951) // - dialog continually expands (347951)
// - Text element text is screwed (QTBUG-42606) // - Text element text is screwed (QTBUG-42606)
// - Panel struts (350614) // - Panel struts (350614)
@ -70,11 +72,11 @@ int main(int argc, char **argv)
parser.addHelpOption(); parser.addHelpOption();
parser.addVersionOption(); parser.addVersionOption();
parser.addOptions({ parser.addOptions({
{{"r", "replace"}, i18nc("command line", "Replace the current dock instance.")} {{"r", "replace"}, i18nc("command line", "Replace the current dock instance.")}
, {{"d", "debug"}, i18nc("command line", "Show the debugging messages on stdout.")} , {{"d", "debug"}, i18nc("command line", "Show the debugging messages on stdout.")}
, {"mask", i18nc("command line" , "Show messages of debugging for the mask (Only useful to devs).")} , {"mask", i18nc("command line" , "Show messages of debugging for the mask (Only useful to devs).")}
, {"graphics", i18nc("command line", "Draw boxes around of the applets.")} , {"graphics", i18nc("command line", "Draw boxes around of the applets.")}
, {"with-window", i18nc("command line", "Open a window with much debug information.")} , {"with-window", i18nc("command line", "Open a window with much debug information.")}
}); });
parser.process(app); parser.process(app);
@ -82,8 +84,10 @@ int main(int argc, char **argv)
QLockFile lockFile {QDir::tempPath() + "/latte-dock.lock"}; QLockFile lockFile {QDir::tempPath() + "/latte-dock.lock"};
int timeout {100}; int timeout {100};
if (parser.isSet(QStringLiteral("replace"))) { if (parser.isSet(QStringLiteral("replace"))) {
qint64 pid{-1}; qint64 pid{ -1};
if (lockFile.getLockInfo(&pid, nullptr, nullptr)) { if (lockFile.getLockInfo(&pid, nullptr, nullptr)) {
kill(static_cast<__pid_t>(pid), SIGINT); kill(static_cast<__pid_t>(pid), SIGINT);
timeout = 3000; timeout = 3000;
@ -96,19 +100,19 @@ int main(int argc, char **argv)
} }
if (parser.isSet(QStringLiteral("debug")) || parser.isSet(QStringLiteral("mask"))) { if (parser.isSet(QStringLiteral("debug")) || parser.isSet(QStringLiteral("mask"))) {
//! set pattern for debug messages //! set pattern for debug messages
//! [%{type}] [%{function}:%{line}] - %{message} [%{backtrace}] //! [%{type}] [%{function}:%{line}] - %{message} [%{backtrace}]
qSetMessagePattern(QStringLiteral( qSetMessagePattern(QStringLiteral(
CIGREEN "[%{type} " CGREEN "%{time h:mm:ss.zz}" CIGREEN "]" CNORMAL CIGREEN "[%{type} " CGREEN "%{time h:mm:ss.zz}" CIGREEN "]" CNORMAL
#ifndef QT_NO_DEBUG #ifndef QT_NO_DEBUG
CIRED " [" CCYAN "%{function}" CIRED ":" CCYAN "%{line}" CIRED "]" CIRED " [" CCYAN "%{function}" CIRED ":" CCYAN "%{line}" CIRED "]"
#endif #endif
CICYAN " - " CNORMAL "%{message}" CICYAN " - " CNORMAL "%{message}"
CIRED "%{if-fatal}\n%{backtrace depth=8 separator=\"\n\"}%{endif}" CIRED "%{if-fatal}\n%{backtrace depth=8 separator=\"\n\"}%{endif}"
"%{if-critical}\n%{backtrace depth=8 separator=\"\n\"}%{endif}" CNORMAL)); "%{if-critical}\n%{backtrace depth=8 separator=\"\n\"}%{endif}" CNORMAL));
} else { } else {
const auto noMessageOutput = [](QtMsgType, const QMessageLogContext&, const QString&){}; const auto noMessageOutput = [](QtMsgType, const QMessageLogContext &, const QString &) {};
qInstallMessageHandler(noMessageOutput); qInstallMessageHandler(noMessageOutput);
} }
@ -121,6 +125,8 @@ int main(int argc, char **argv)
std::signal(SIGINT, signal_handler); std::signal(SIGINT, signal_handler);
Latte::DockCorona corona; Latte::DockCorona corona;
KDBusService service(KDBusService::Unique);
return app.exec(); return app.exec();
} }

@ -8,9 +8,11 @@ Categories=Utility;X-SuSE-DesktopUtility;
Exec=latte-dock %u Exec=latte-dock %u
Icon=latte-dock Icon=latte-dock
InitialPreference=1 InitialPreference=1
StartupNotify=true
Terminal=false Terminal=false
Type=Application Type=Application
X-KDE-PluginInfo-Author=@AUTHOR@ X-KDE-PluginInfo-Author=@AUTHOR@
X-KDE-PluginInfo-Email=@EMAIL@ X-KDE-PluginInfo-Email=@EMAIL@
X-KDE-PluginInfo-Website=@WEBSITE@ X-KDE-PluginInfo-Website=@WEBSITE@
X-KDE-StartupNotify=false
X-DBUS-StartupType=Unique
X-DBUS-ServiceName=org.kde.lattedock

Loading…
Cancel
Save