From 8ec97ed6c41fab5422cea5103790e386b5238f5d Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sun, 27 Jun 2021 20:53:39 +0300 Subject: [PATCH] cmd:provide option for add-dock --- app/main.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/main.cpp b/app/main.cpp index c3b4e7525..5f5d6d02c 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -98,6 +98,7 @@ int main(int argc, char **argv) , {"layout", i18nc("command line", "Load specific layout on startup."), i18nc("command line: load", "layout_name")} , {"import-layout", i18nc("command line", "Import and load a layout."), i18nc("command line: import", "file_name")} , {"import-full", i18nc("command line", "Import full configuration."), i18nc("command line: import", "file_name")} + , {"add-dock", i18nc("command line", "Add Dock/Panel"), i18nc("command line: add", "template_name")} , {"single", i18nc("command line", "Single layout memory mode. Only one layout is active at any case.")} , {"multiple", i18nc("command line", "Multiple layouts memory mode. Multiple layouts can be active at any time based on Activities running.")} }); @@ -223,9 +224,18 @@ int main(int argc, char **argv) if (!lockFile.tryLock(timeout)) { QDBusInterface iface("org.kde.lattedock", "/Latte", "", QDBusConnection::sessionBus()); + bool addview{parser.isSet(QStringLiteral("add-dock"))}; + if (iface.isValid()) { - // LayoutPage = 0 - iface.call("showSettingsWindow", 0); + if (addview) { + //iface.call("addView", 0, parser.value(QStringLiteral("add-dock"))); + //! Enable code above when the code path is ready and works correctly + qGuiApp->exit(); + return 0; + } else { + // LayoutPage = 0 + iface.call("showSettingsWindow", 0); + } } qInfo() << i18n("An instance is already running!, use --replace to restart Latte");