Hello, I recently discovered surf, and was attracted to the conciseness of it's code. From the dev mailing list archives, I think I recall Gottox (or someone) saying there was no plans to add a config.h way of customising surf. And looking at the code [keypress()] I can see why, it would add complexity to wrap webkit and gdk functions. But I think customising key bindings through the source code would interfere with people wanting to write and submit patches. I really want to see surf improve, so I went ahead and added the config.h feature.
I modelled it after dwm, and I noticed for the feature to be flexible, I had to modify the api of many functions to take in an Arg argument. I didn't want to change the api, but I think it's a change in the right direction. I didn't add Arg to every function, only the ones specified in config.h, if Gottox merges this patch into the trunk, I'll make changes to the remaining functions. I wrote some wrappers to webkit and gdk calls. Also, I modified load_uri() a little because I didn't want a wrapper that just loads the url from bar and hides bar, also to demonstrate that "chaining" commands is possible (see attached config.h). The enum Keypressmode is sorta not pretty, but I used it to preserve semantics of original keypress(). Also I was thinking it could be used to add a modal feature (like vim or uzbl). Thanks
keys_config.patch
Description: Binary data
config.h
Description: Binary data