aboutsummaryrefslogtreecommitdiff
path: root/util/fluxbox-update_configs.cc
diff options
context:
space:
mode:
Diffstat (limited to 'util/fluxbox-update_configs.cc')
-rw-r--r--util/fluxbox-update_configs.cc63
1 files changed, 50 insertions, 13 deletions
diff --git a/util/fluxbox-update_configs.cc b/util/fluxbox-update_configs.cc
index 89b355f..ac1d2a2 100644
--- a/util/fluxbox-update_configs.cc
+++ b/util/fluxbox-update_configs.cc
@@ -34,8 +34,8 @@
34#endif // HAVE_SIGNAL_H 34#endif // HAVE_SIGNAL_H
35 35
36//use GNU extensions 36//use GNU extensions
37#ifndef _GNU_SOURCE 37#ifndef _GNU_SOURCE
38#define _GNU_SOURCE 38#define _GNU_SOURCE
39#endif // _GNU_SOURCE 39#endif // _GNU_SOURCE
40 40
41#ifdef HAVE_CSTRING 41#ifdef HAVE_CSTRING
@@ -81,9 +81,9 @@ int run_updates(int old_version, FbTk::ResourceManager &rm) {
81 string new_keyfile = ""; 81 string new_keyfile = "";
82 // let's put our new keybindings first, so they're easy to find 82 // let's put our new keybindings first, so they're easy to find
83 new_keyfile += "!mouse actions added by fluxbox-update_configs\n"; 83 new_keyfile += "!mouse actions added by fluxbox-update_configs\n";
84 new_keyfile += "OnDesktop Mouse1 :hideMenus\n"; 84 new_keyfile += "OnDesktop Mouse1 :HideMenus\n";
85 new_keyfile += "OnDesktop Mouse2 :workspaceMenu\n"; 85 new_keyfile += "OnDesktop Mouse2 :WorkspaceMenu\n";
86 new_keyfile += "OnDesktop Mouse3 :rootMenu\n"; 86 new_keyfile += "OnDesktop Mouse3 :RootMenu\n";
87 87
88 // scrolling on desktop needs to match user's desktop wheeling settings 88 // scrolling on desktop needs to match user's desktop wheeling settings
89 // hmmm, what are the odds that somebody wants this to be different on 89 // hmmm, what are the odds that somebody wants this to be different on
@@ -97,11 +97,11 @@ int run_updates(int old_version, FbTk::ResourceManager &rm) {
97 "Session.Screen0.ReverseWheeling"); 97 "Session.Screen0.ReverseWheeling");
98 if (*rc_wheeling) { 98 if (*rc_wheeling) {
99 if (*rc_reverse) { // if you ask me, this should have been default 99 if (*rc_reverse) { // if you ask me, this should have been default
100 new_keyfile += "OnDesktop Mouse4 :prevWorkspace\n"; 100 new_keyfile += "OnDesktop Mouse4 :PrevWorkspace\n";
101 new_keyfile += "OnDesktop Mouse5 :nextWorkspace\n"; 101 new_keyfile += "OnDesktop Mouse5 :NextWorkspace\n";
102 } else { 102 } else {
103 new_keyfile += "OnDesktop Mouse4 :nextWorkspace\n"; 103 new_keyfile += "OnDesktop Mouse4 :NextWorkspace\n";
104 new_keyfile += "OnDesktop Mouse5 :prevWorkspace\n"; 104 new_keyfile += "OnDesktop Mouse5 :PrevWorkspace\n";
105 } 105 }
106 } 106 }
107 new_keyfile += "\n"; // just for good looks 107 new_keyfile += "\n"; // just for good looks
@@ -167,11 +167,11 @@ int run_updates(int old_version, FbTk::ResourceManager &rm) {
167 (strcasecmp((*rc_wheeling).c_str(), "Screen") && *rc_screen)) { 167 (strcasecmp((*rc_wheeling).c_str(), "Screen") && *rc_screen)) {
168 keep_changes = true; 168 keep_changes = true;
169 if (*rc_reverse) { // if you ask me, this should have been default 169 if (*rc_reverse) { // if you ask me, this should have been default
170 new_keyfile += "OnToolbar Mouse4 :prevWorkspace\n"; 170 new_keyfile += "OnToolbar Mouse4 :PrevWorkspace\n";
171 new_keyfile += "OnToolbar Mouse5 :nextWorkspace\n"; 171 new_keyfile += "OnToolbar Mouse5 :NextWorkspace\n";
172 } else { 172 } else {
173 new_keyfile += "OnToolbar Mouse4 :nextWorkspace\n"; 173 new_keyfile += "OnToolbar Mouse4 :NextWorkspace\n";
174 new_keyfile += "OnToolbar Mouse5 :prevWorkspace\n"; 174 new_keyfile += "OnToolbar Mouse5 :PrevWorkspace\n";
175 } 175 }
176 } 176 }
177 new_keyfile += "\n"; // just for good looks 177 new_keyfile += "\n"; // just for good looks
@@ -239,6 +239,43 @@ int run_updates(int old_version, FbTk::ResourceManager &rm) {
239 new_version = 5; 239 new_version = 5;
240 } 240 }
241 241
242 if (old_version < 6) { // move titlebar actions to keys file
243 string whole_keyfile = read_file(keyfilename);
244 string new_keyfile = "";
245 // let's put our new keybindings first, so they're easy to find
246 new_keyfile += "!mouse actions added by fluxbox-update_configs\n";
247 new_keyfile += "OnTitlebar Double Mouse1 :Shade\n";
248 new_keyfile += "OnTitlebar Mouse3 :Windowmenu\n";
249 new_keyfile += "OnTitlebar Mouse2 :Lower\n";
250
251 FbTk::Resource<bool> rc_reverse(rm, false,"session.screen0.reversewheeling", "Session.Screen0.ReverseWheeling");
252 FbTk::Resource<std::string> scroll_action(rm, "", "session.screen0.windowScrollAction", "Session.Screen0.WindowScrollAction");
253 if (strcasecmp((*scroll_action).c_str(), "shade") == 0) {
254 if (*rc_reverse) {
255 new_keyfile += "OnTitlebar Mouse5 :ShadeOn\n";
256 new_keyfile += "OnTitlebar Mouse4 :ShadeOff\n";
257 } else {
258 new_keyfile += "OnTitlebar Mouse4 :ShadeOn\n";
259 new_keyfile += "OnTitlebar Mouse5 :ShadeOff\n";
260 }
261 } else if (strcasecmp((*scroll_action).c_str(), "nexttab") == 0) {
262 if (*rc_reverse) {
263 new_keyfile += "OnTitlebar Mouse5 :PrevTab\n";
264 new_keyfile += "OnTitlebar Mouse4 :NextTab\n";
265 } else {
266 new_keyfile += "OnTitlebar Mouse4 :PrevTab\n";
267 new_keyfile += "OnTitlebar Mouse5 :NextTab\n";
268 }
269 }
270
271 new_keyfile += "\n"; // just for good looks
272 new_keyfile += whole_keyfile; // don't forget user's old keybindings
273
274 write_file(keyfilename, new_keyfile);
275
276 new_version = 6;
277 }
278
242 return new_version; 279 return new_version;
243} 280}
244 281