From b735d405f58ac226e025d6ef4dbd91a0129bb12e Mon Sep 17 00:00:00 2001 From: markt Date: Sat, 7 Jul 2007 04:54:34 +0000 Subject: allow negative indices in :Workspace --- ChangeLog | 2 ++ src/WorkspaceCmd.cc | 11 +++++++++-- util/fluxbox-update_configs.cc | 12 +++++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f4d5ac..2a36cc4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ (Format: Year/Month/Day) Changes for 1.0.0: *07/07/07: + * Allow negative numbers in :Workspace command, which counts backwards + from the last one (Mark) * Right clicking on a submenu didn't revert focus to its parent (Mark) FbTk/Menu.cc/hh * Pressing escape in a torn menu didn't work (Mark) diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc index b040fdd..9859dd6 100644 --- a/src/WorkspaceCmd.cc +++ b/src/WorkspaceCmd.cc @@ -103,8 +103,15 @@ JumpToWorkspaceCmd::JumpToWorkspaceCmd(int workspace_num):m_workspace_num(worksp void JumpToWorkspaceCmd::execute() { BScreen *screen = Fluxbox::instance()->mouseScreen(); - if (screen != 0) - screen->changeWorkspaceID(m_workspace_num); + if (screen != 0) { + int num = screen->numberOfWorkspaces(); + int actual = m_workspace_num; + // we need an extra +1, since it's subtracted in FbCommandFactory + if (actual < 0) actual += num+1; + if (actual < 0) actual = 0; + if (actual >= num) actual = num - 1; + screen->changeWorkspaceID(actual); + } } diff --git a/util/fluxbox-update_configs.cc b/util/fluxbox-update_configs.cc index de1fbb9..8cfe8ef 100644 --- a/util/fluxbox-update_configs.cc +++ b/util/fluxbox-update_configs.cc @@ -160,13 +160,15 @@ int main(int argc, char **argv) { } } + if (rc_filename.empty()) + rc_filename = getenv("HOME") + string("/.fluxbox/init"); + FbTk::ResourceManager resource_manager(rc_filename.c_str(),false); - if (rc_filename.empty() || !resource_manager.load(rc_filename.c_str())) { + if (!resource_manager.load(rc_filename.c_str())) { // couldn't load rc file - if (!rc_filename.empty()) { - cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "Failed trying to read rc file")<<":"<