aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop/LDesktop.cpp
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-06-29 17:28:54 -0400
committerKen Moore <moorekou@gmail.com>2016-06-29 17:28:54 -0400
commit1fc459836734c564aec5e92f9f4adaa29aa8178f (patch)
tree4846db7898613a425872ba49cd152585731be3b1 /src-qt5/core/lumina-desktop/LDesktop.cpp
parentA minor tweak to the "Glass" theme. (diff)
downloadlumina-1fc459836734c564aec5e92f9f4adaa29aa8178f.tar.gz
lumina-1fc459836734c564aec5e92f9f4adaa29aa8178f.tar.bz2
lumina-1fc459836734c564aec5e92f9f4adaa29aa8178f.zip
Add a new type of menu plugin: jsonmenu
This is a recursive, auto-generating menu which runs an external utility (a script of some kind usually), which generates a JSON document/object which is used to populate the menu. Syntax: (Per object) { "type" : "item", "icon" : "icon name (optional)", "action" : "something lumina-open can run (optional)" } Or for a recursive menu generation { "type" : "jsonmenu", "exec" : "some command to run to populate menu", "icon" : "icon name (optional)" } Example for a full return: { "Item1" : { "type" : "item", "icon" : "folder", "action" : "~/item1.jpg" }, "Menu1" : { "type" : "jsonmenu", "exec" : "some script", "icon" : "system-run" } } Item1 will open ~/item1.jpg with lumina-open when clicked, while Menu1 will call "some script" to generate a new menu with additional options. }
Diffstat (limited to 'src-qt5/core/lumina-desktop/LDesktop.cpp')
-rw-r--r--src-qt5/core/lumina-desktop/LDesktop.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src-qt5/core/lumina-desktop/LDesktop.cpp b/src-qt5/core/lumina-desktop/LDesktop.cpp
index 772ead8a..c759d641 100644
--- a/src-qt5/core/lumina-desktop/LDesktop.cpp
+++ b/src-qt5/core/lumina-desktop/LDesktop.cpp
@@ -10,6 +10,7 @@
#include <LuminaOS.h>
#include <LuminaX11.h>
#include "LWinInfo.h"
+#include "JsonMenu.h"
#define DEBUG 0
@@ -291,6 +292,17 @@ void LDesktop::UpdateMenu(bool fast){
}else{
qDebug() << "Could not load application file:" << file;
}
+ }else if(items[i].startsWith("jsonmenu::::")){
+ //Custom JSON menu system (populated on demand via external scripts/tools
+ QStringList info = items[i].split("::::"); //FORMAT:[ "jsonmenu",exec,name, icon(optional)]
+ if(info.length()>=3){
+ qDebug() << "Custom JSON Menu Loaded:" << info;
+ JsonMenu *tmp = new JsonMenu(info[1], deskMenu);
+ tmp->setTitle(info[2]);
+ connect(tmp, SIGNAL(triggered(QAction*)), this, SLOT(SystemApplication(QAction*)) );
+ if(info.length()>=4){ tmp->setIcon( LXDG::findIcon(info[3],"") ); }
+ deskMenu->addMenu(tmp);
+ }
}
}
//Now add the system quit options
bgstack15