aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkt <markt>2007-07-07 04:56:42 (GMT)
committermarkt <markt>2007-07-07 04:56:42 (GMT)
commit393d48888f30684935d657923db445c1a77c8e38 (patch)
tree1059e8ead6e019ff95dbbb67020b80a79dc75b9a
parent0a316695e88299dfbcfa88c1f07786581e1cfb0f (diff)
downloadfluxbox-393d48888f30684935d657923db445c1a77c8e38.zip
fluxbox-393d48888f30684935d657923db445c1a77c8e38.tar.bz2
allow negative indices for :Workspace <int>
-rw-r--r--src/WorkspaceCmd.cc11
-rw-r--r--util/fluxbox-update_configs.cc16
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
177 177
178void JumpToWorkspaceCmd::execute() { 178void JumpToWorkspaceCmd::execute() {
179 BScreen *screen = Fluxbox::instance()->mouseScreen(); 179 BScreen *screen = Fluxbox::instance()->mouseScreen();
180 if (screen != 0) 180 if (screen != 0) {
181 screen->changeWorkspaceID(m_workspace_num); 181 int num = screen->numberOfWorkspaces();
182 int actual = m_workspace_num;
183 // we need an extra +1, since it's subtracted in FbCommandFactory
184 if (actual < 0) actual += num+1;
185 if (actual < 0) actual = 0;
186 if (actual >= num) actual = num - 1;
187 screen->changeWorkspaceID(actual);
188 }
182} 189}
183 190
184 191
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) {
221 } 221 }
222 } 222 }
223 223
224 if (rc_filename.empty())
225 rc_filename = getenv("HOME") + string("/.fluxbox/init");
226
224 FbTk::ResourceManager resource_manager(rc_filename.c_str(),false); 227 FbTk::ResourceManager resource_manager(rc_filename.c_str(),false);
225 if (rc_filename.empty() || !resource_manager.load(rc_filename.c_str())) { 228 if (!resource_manager.load(rc_filename.c_str())) {
226 // couldn't load rc file 229 // couldn't load rc file
227 if (!rc_filename.empty()) { 230 cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "Failed trying to read rc file")<<":"<<rc_filename<<endl;
228 cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "Failed trying to read rc file")<<":"<<rc_filename<<endl; 231 cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFileTrying, "Retrying with", "Retrying rc file loading with (the following file)")<<": "<<DEFAULT_INITFILE<<endl;
229 cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFileTrying, "Retrying with", "Retrying rc file loading with (the following file)")<<": ~/.fluxbox/init"<<endl; 232
230 }
231 // couldn't load default rc file, either 233 // couldn't load default rc file, either
232 if (!resource_manager.load("~/.fluxbox/init")) { 234 if (!resource_manager.load(DEFAULT_INITFILE)) {
233 cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "")<<": ~/.fluxbox/init"<<endl; 235 cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "")<<": "<<DEFAULT_INITFILE<<endl;
234 exit(1); // this is a fatal error for us 236 exit(1); // this is a fatal error for us
235 } 237 }
236 } 238 }