all repos — fluxbox @ a2fc845d50e245ab3aa9f44d2ea8c559eaa1adbe

custom fork of the fluxbox windowmanager

Next|PrevWorkspace 0 toggles former Workspace

REQUEST: 185
also PATCH 92
Thomas Lübking thomas.luebking@gmail.com
commit

a2fc845d50e245ab3aa9f44d2ea8c559eaa1adbe

parent

36993a80f4a246456429932abf596f2d2ef4b89d

4 files changed, 20 insertions(+), 8 deletions(-)

jump to
M doc/asciidoc/fluxbox-keys.txtdoc/asciidoc/fluxbox-keys.txt

@@ -359,6 +359,8 @@ Switch to the Next / Previous workspace. All versions accept an

offset value 'n', which defaults to *1* and refers to the number of workspaces to move at one time. {Next,Prev}Workspace wrap around when going past the last workspace, whereas {Right,Left}Workspace do not. + The special offset "0" will toggle the former workspace for Next- and + PrevWorkspace *Workspace* 'number':: Jumps to the given workspace 'number'. The first workspace is *1*.
M src/Screen.ccsrc/Screen.cc

@@ -194,6 +194,7 @@ unsigned int opts) :

m_layermanager(num_layers), root_colormap_installed(false), m_current_workspace(0), + m_former_workspace(0), m_focused_windowtheme(new FbWinFrameTheme(scrn, ".focus", ".Focus")), m_unfocused_windowtheme(new FbWinFrameTheme(scrn, ".unfocus", ".Unfocus")), // the order of windowtheme and winbutton theme is important

@@ -919,6 +920,8 @@ Workspace *wkspc = m_workspaces_list.back();

if (m_current_workspace->workspaceID() == wkspc->workspaceID()) changeWorkspaceID(m_current_workspace->workspaceID() - 1); + if (m_former_workspace && m_former_workspace->workspaceID() == wkspc->workspaceID()) + m_former_workspace = 0; wkspc->removeAll(wkspc->workspaceID()-1);

@@ -949,6 +952,8 @@

if (! m_current_workspace || id >= m_workspaces_list.size() || id == m_current_workspace->workspaceID()) return; + + m_former_workspace = m_current_workspace; /* Ignore all EnterNotify events until the pointer actually moves */ this->focusControl().ignoreAtPointer();

@@ -1524,14 +1529,20 @@ /**

Goes to the workspace "right" of the current */ void BScreen::nextWorkspace(int delta) { - changeWorkspaceID( (currentWorkspaceID() + delta) % numberOfWorkspaces()); + if (delta) + changeWorkspaceID( (currentWorkspaceID() + delta) % numberOfWorkspaces()); + else if (m_former_workspace) + changeWorkspaceID(m_former_workspace->workspaceID()); } /** Goes to the workspace "left" of the current */ void BScreen::prevWorkspace(int delta) { - changeWorkspaceID( (static_cast<signed>(numberOfWorkspaces()) + currentWorkspaceID() - (delta % numberOfWorkspaces())) % numberOfWorkspaces()); + if (delta) + changeWorkspaceID( (static_cast<signed>(numberOfWorkspaces()) + currentWorkspaceID() - (delta % numberOfWorkspaces())) % numberOfWorkspaces()); + else if (m_former_workspace) + changeWorkspaceID(m_former_workspace->workspaceID()); } /**
M src/Screen.hhsrc/Screen.hh

@@ -502,6 +502,7 @@ std::unique_ptr<Toolbar> m_toolbar;

std::unique_ptr<ToolButtonMap> m_toolButtonMap; Workspace *m_current_workspace; + Workspace *m_former_workspace; WorkspaceNames m_workspace_names; Workspaces m_workspaces_list;
M src/WorkspaceCmd.ccsrc/WorkspaceCmd.cc

@@ -357,15 +357,13 @@

} // end anonymous namespace void NextWorkspaceCmd::execute() { - BScreen *screen = Fluxbox::instance()->mouseScreen(); - if (screen != 0) - screen->nextWorkspace(m_option == 0 ? 1 : m_option); + if (BScreen *screen = Fluxbox::instance()->mouseScreen()) + screen->nextWorkspace(m_option); } void PrevWorkspaceCmd::execute() { - BScreen *screen = Fluxbox::instance()->mouseScreen(); - if (screen != 0) - screen->prevWorkspace(m_option == 0 ? 1 : m_option); + if (BScreen *screen = Fluxbox::instance()->mouseScreen()) + screen->prevWorkspace(m_option); } void LeftWorkspaceCmd::execute() {