From 393d48888f30684935d657923db445c1a77c8e38 Mon Sep 17 00:00:00 2001 From: markt Date: Sat, 7 Jul 2007 04:56:42 +0000 Subject: allow negative indices for :Workspace --- src/WorkspaceCmd.cc | 11 +++++++++-- util/fluxbox-update_configs.cc | 16 +++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc index 79c002e..e7d92ee 100644 --- a/src/WorkspaceCmd.cc +++ b/src/WorkspaceCmd.cc @@ -177,8 +177,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 563bada..2dc5eb6 100644 --- a/util/fluxbox-update_configs.cc +++ b/util/fluxbox-update_configs.cc @@ -221,16 +221,18 @@ 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")<<":"<