Workspace switching on the toolbar via the mouse buttons
Soeren Beye soeren at soerenbeye dot de
3 files changed,
12 insertions(+),
6 deletions(-)
M
doc/asciidoc/fluxbox.txt
→
doc/asciidoc/fluxbox.txt
@@ -557,7 +557,9 @@ *Systemtray*:::
The Systemtray can hold applications that are made to use it. *WorkspaceName*::: - This displays the name of the current workspace. + This displays the name of the current workspace. Also, one is able to switch + to the workspace left of the current one with a left click and to the + workspace right of the current one with a right click. *PrevWorkspace*::: This displays an arrow that allows one to switch to the workspace left of@@ -577,7 +579,7 @@ current workspace.
Other aspects of the toolbar can be configured in two ways: through the toolbar menu, which is accessible in the Configuration part of the RootMenu or with a -right click on the edge the toolbar, or by editing the init file (see the +middle click on the edge the toolbar, or by editing the init file (see the *RESOURCES* section for more information about that). Toolbar Menu
M
src/ToolFactory.cc
→
src/ToolFactory.cc
@@ -75,6 +75,8 @@
ToolbarItem *ToolFactory::create(const std::string &name, const FbTk::FbWindow &parent, Toolbar &tbar) { ToolbarItem * item = 0; + FbTk::CommandParser<void>& cp = FbTk::CommandParser<void>::instance(); + unsigned int button_size = 24; if (tbar.theme()->buttonSize() > 0) button_size = tbar.theme()->buttonSize();@@ -83,8 +85,10 @@ if (name == "workspacename") {
WorkspaceNameTool *witem = new WorkspaceNameTool(parent, *m_workspace_theme, screen()); using namespace FbTk; - RefCount<Command<void> > showmenu(new ShowMenuAboveToolbar(tbar)); - witem->button().setOnClick(showmenu); + RefCount< Command<void> > leftCommand(cp.parse("prevworkspace")); + RefCount< Command<void> > rightCommand(cp.parse("nextworkspace")); + witem->button().setOnClick(leftCommand); + witem->button().setOnClick(rightCommand, 3); item = witem; } else if (name == "iconbar") { item = new IconbarTool(parent, m_iconbar_theme, m_focused_iconbar_theme, m_unfocused_iconbar_theme, screen(), tbar.menu());@@ -101,7 +105,7 @@ if (name == "prevwindow" || name == "nextwindow") {
cmd_str += " (workspace=[current])"; } - FbTk::RefCount<FbTk::Command<void> > cmd(FbTk::CommandParser<void>::instance().parse(cmd_str)); + FbTk::RefCount<FbTk::Command<void> > cmd(cp.parse(cmd_str)); if (cmd == 0) // we need a command return 0;
M
src/Toolbar.cc
→
src/Toolbar.cc
@@ -517,7 +517,7 @@ return;
if (be.button == 1) raise(); - if (be.button != 3) + if (be.button != 2) return; screen()