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)
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
Plasma PlasmaQuick WindowSystem Declarative Activities
I18n CoreAddons XmlGui DBusAddons IconThemes Wayland)

@ -15,14 +15,19 @@ set(lattedock-app_SRCS
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})
include(FakeTarget.cmake)
target_link_libraries(latte-dock
Qt5::DBus
Qt5::Quick
Qt5::Qml
KF5::I18n
KF5::DBusAddons
KF5::Declarative
KF5::CoreAddons
KF5::XmlGui
@ -43,5 +48,7 @@ if(HAVE_X11)
endif()
configure_file(latte-dock.desktop.cmake latte-dock.desktop)
install(TARGETS latte-dock ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
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 "alternativeshelper.h"
#include "screenpool.h"
//dbus adaptor
#include "lattedockadaptor.h"
#include <QAction>
#include <QApplication>
#include <QScreen>
#include <QDBusConnection>
#include <QDebug>
#include <QDesktopWidget>
#include <QDir>
@ -77,6 +80,11 @@ DockCorona::DockCorona(QObject *parent)
m_docksScreenSyncTimer.setSingleShot(true);
m_docksScreenSyncTimer.setInterval(2500);
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()
@ -1088,6 +1096,25 @@ bool DockCorona::containmentContainsTasks(Plasma::Containment *cont)
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
{
qmlRegisterType<QScreen>();

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

@ -20,9 +20,11 @@ Categories=Utility;X-SuSE-DesktopUtility;
Exec=latte-dock %u
Icon=latte-dock
InitialPreference=1
StartupNotify=true
Terminal=false
Type=Application
X-KDE-PluginInfo-Author=@AUTHOR@
X-KDE-PluginInfo-Email=@EMAIL@
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 <KAboutData>
#include <KDBusService>
//! COLORS
@ -50,7 +51,8 @@
inline void configureAboutData();
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)
// - Text element text is screwed (QTBUG-42606)
// - Panel struts (350614)
@ -70,11 +72,11 @@ int main(int argc, char **argv)
parser.addHelpOption();
parser.addVersionOption();
parser.addOptions({
{{"r", "replace"}, i18nc("command line", "Replace the current dock instance.")}
, {{"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).")}
, {"graphics", i18nc("command line", "Draw boxes around of the applets.")}
, {"with-window", i18nc("command line", "Open a window with much debug information.")}
{{"r", "replace"}, i18nc("command line", "Replace the current dock instance.")}
, {{"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).")}
, {"graphics", i18nc("command line", "Draw boxes around of the applets.")}
, {"with-window", i18nc("command line", "Open a window with much debug information.")}
});
parser.process(app);
@ -82,8 +84,10 @@ int main(int argc, char **argv)
QLockFile lockFile {QDir::tempPath() + "/latte-dock.lock"};
int timeout {100};
if (parser.isSet(QStringLiteral("replace"))) {
qint64 pid{-1};
qint64 pid{ -1};
if (lockFile.getLockInfo(&pid, nullptr, nullptr)) {
kill(static_cast<__pid_t>(pid), SIGINT);
timeout = 3000;
@ -96,19 +100,19 @@ int main(int argc, char **argv)
}
if (parser.isSet(QStringLiteral("debug")) || parser.isSet(QStringLiteral("mask"))) {
//! set pattern for debug messages
//! [%{type}] [%{function}:%{line}] - %{message} [%{backtrace}]
//! set pattern for debug messages
//! [%{type}] [%{function}:%{line}] - %{message} [%{backtrace}]
qSetMessagePattern(QStringLiteral(
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 "]"
#endif
#endif
CICYAN " - " CNORMAL "%{message}"
CIRED "%{if-fatal}\n%{backtrace depth=8 separator=\"\n\"}%{endif}"
"%{if-critical}\n%{backtrace depth=8 separator=\"\n\"}%{endif}" CNORMAL));
} else {
const auto noMessageOutput = [](QtMsgType, const QMessageLogContext&, const QString&){};
const auto noMessageOutput = [](QtMsgType, const QMessageLogContext &, const QString &) {};
qInstallMessageHandler(noMessageOutput);
}
@ -121,6 +125,8 @@ int main(int argc, char **argv)
std::signal(SIGINT, signal_handler);
Latte::DockCorona corona;
KDBusService service(KDBusService::Unique);
return app.exec();
}

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

Loading…
Cancel
Save