allow negative indices in :Workspace <int>
markt markt
3 files changed,
18 insertions(+),
7 deletions(-)
M
ChangeLog
→
ChangeLog
@@ -1,6 +1,8 @@
(Format: Year/Month/Day) Changes for 1.0.0: *07/07/07: + * Allow negative numbers in :Workspace <int> 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)
M
src/WorkspaceCmd.cc
→
src/WorkspaceCmd.cc
@@ -103,8 +103,15 @@ JumpToWorkspaceCmd::JumpToWorkspaceCmd(int workspace_num):m_workspace_num(workspace_num) { }
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); + } }
M
util/fluxbox-update_configs.cc
→
util/fluxbox-update_configs.cc
@@ -160,13 +160,15 @@ exit(0);
} } + 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")<<":"<<rc_filename<<endl; - cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFileTrying, "Retrying with", "Retrying rc file loading with (the following file)")<<": "<<DEFAULT_INITFILE<<endl; - } + cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "Failed trying to read rc file")<<":"<<rc_filename<<endl; + cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFileTrying, "Retrying with", "Retrying rc file loading with (the following file)")<<": "<<DEFAULT_INITFILE<<endl; + // couldn't load default rc file, either if (!resource_manager.load(DEFAULT_INITFILE)) { cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "")<<": "<<DEFAULT_INITFILE<<endl;