diff options
Diffstat (limited to 'util/fluxbox-update_configs.cc')
-rw-r--r-- | util/fluxbox-update_configs.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/util/fluxbox-update_configs.cc b/util/fluxbox-update_configs.cc index 2dc5eb6..27c8b48 100644 --- a/util/fluxbox-update_configs.cc +++ b/util/fluxbox-update_configs.cc | |||
@@ -182,6 +182,38 @@ int run_updates(int old_version, FbTk::ResourceManager rm) { | |||
182 | new_version = 3; | 182 | new_version = 3; |
183 | } | 183 | } |
184 | 184 | ||
185 | if (old_version < 4) { // move modkey to keys file | ||
186 | string whole_keyfile = read_file(keyfilename); | ||
187 | string new_keyfile = ""; | ||
188 | // let's put our new keybindings first, so they're easy to find | ||
189 | new_keyfile += "!mouse actions added by fluxbox-update_configs\n"; | ||
190 | |||
191 | // need to match user's resize model | ||
192 | FbTk::Resource<string> rc_mode(rm, "Bottom", | ||
193 | "session.screen0.resizeMode", | ||
194 | "Session.Screen0.ResizeMode"); | ||
195 | FbTk::Resource<string> rc_modkey(rm, "Mod1", | ||
196 | "session.modKey", | ||
197 | "Session.ModKey"); | ||
198 | |||
199 | new_keyfile += "OnWindow " + *rc_modkey + " Mouse1 :StartMoving\n"; | ||
200 | if (strcasecmp((*rc_mode).c_str(), "Quadrant") == 0) { | ||
201 | new_keyfile += "OnWindow " + *rc_modkey + | ||
202 | " Mouse3 :StartResizing NearestCorner\n"; | ||
203 | } else if (strcasecmp((*rc_mode).c_str(), "Center") == 0) { | ||
204 | new_keyfile += "OnWindow " + *rc_modkey + | ||
205 | " Mouse3 :StartResizing Center\n"; | ||
206 | } else { | ||
207 | new_keyfile += "OnWindow " + *rc_modkey + | ||
208 | "StartResizing BottomRight\n"; | ||
209 | } | ||
210 | new_keyfile += "\n"; // just for good looks | ||
211 | new_keyfile += whole_keyfile; // don't forget user's old keybindings | ||
212 | |||
213 | write_file(keyfilename, new_keyfile); | ||
214 | new_version = 4; | ||
215 | } | ||
216 | |||
185 | return new_version; | 217 | return new_version; |
186 | } | 218 | } |
187 | 219 | ||