added custommenu command
markt markt
4 files changed,
27 insertions(+),
0 deletions(-)
M
ChangeLog
→
ChangeLog
@@ -1,5 +1,9 @@
(Format: Year/Month/Day) Changes for 1.0rc3: +*07/03/16: + * Added key command to open a custom menu file (thanks Matteo Galiazzo) + - :CustomMenu /path/to/file + FbCommands.cc/hh FbCommandFactory.cc *07/03/11: * Fixed display bug with ParentRelative menu highlight (thanks Julien Trolet) FbTk/Menu.cc
M
src/FbCommandFactory.cc
→
src/FbCommandFactory.cc
@@ -65,6 +65,7 @@ "bindkey",
"close", "closeallwindows", "commanddialog", + "custommenu", "deiconify", "detachclient", "export",@@ -438,6 +439,8 @@ else if (command == "hidemenus")
return new HideMenuCmd(); else if (command == "rootmenu") return new ShowRootMenuCmd(); + else if (command == "custommenu") + return new ShowCustomMenuCmd(arguments.c_str()); else if (command == "workspacemenu") return new ShowWorkspaceMenuCmd(); else if (command == "setworkspacename") {
M
src/FbCommands.cc
→
src/FbCommands.cc
@@ -28,6 +28,7 @@ #include "CommandDialog.hh"
#include "Workspace.hh" #include "Window.hh" #include "Keys.hh" +#include "MenuCreator.hh" #include "FbTk/Theme.hh" #include "FbTk/Menu.hh"@@ -267,6 +268,16 @@ if (screen->rootMenu().isVisible())
screen->rootMenu().hide(); if (screen->workspaceMenu().isVisible()) screen->workspaceMenu().hide(); +} + +ShowCustomMenuCmd::ShowCustomMenuCmd(const string &arguments) : custom_menu_file(arguments) {} + +void ShowCustomMenuCmd::execute() { + BScreen *screen = Fluxbox::instance()->mouseScreen(); + if (screen == 0) + return; + ::showMenu(*screen, *MenuCreator::createFromFile(custom_menu_file, + screen->screenNumber(), true)); } void ShowRootMenuCmd::execute() {
M
src/FbCommands.hh
→
src/FbCommands.hh
@@ -118,6 +118,15 @@ public:
void execute(); }; +class ShowCustomMenuCmd: public FbTk::Command { +public: + explicit ShowCustomMenuCmd(const std::string &arguments); + void execute(); +private: + std::string custom_menu_file; + +}; + class ShowRootMenuCmd: public FbTk::Command { public: void execute();