You are not logged in.
Lets start surf hacking thread. Share your patches or suggest new ideas. Feel free to provide feedback or improvements.
surf-0.6-searchengine.patch
Patch to add homepage support and search engine integration. Can be configured with config.def.h. Detects if the entered url is valid url or search keyword. If it is search keyword surf directs it to search engine. Rules: If the url has dot and dont have spaces its url. If the url ends with slash its url. If the url is "localhost its url. Otherwise its search keyword.
diff -up surf-upstream/config.def.h surf/config.def.h
--- surf-upstream/config.def.h 2013-02-10 20:40:14.000000000 +0200
+++ surf/config.def.h 2013-08-06 21:04:17.150798111 +0300
@@ -16,6 +16,9 @@ static char *cafile = "/etc/ssl/
static char *strictssl = FALSE; /* Refuse untrusted SSL connections */
static int indicator_thickness = 2;
+static char *searchengine = "http://www.google.com/search?q=%s";
+static char *homepage = "http://www.google.com/";
+
/* Webkit default features */
static Bool enablespatialbrowsing = TRUE;
static Bool enableplugins = TRUE;
Only in surf/: config.h
diff -up surf-upstream/surf.c surf/surf.c
--- surf-upstream/surf.c 2013-02-10 20:40:14.000000000 +0200
+++ surf/surf.c 2013-08-07 00:53:13.778066638 +0300
@@ -626,9 +626,12 @@ loaduri(Client *c, const Arg *arg) {
rp = realpath(uri, NULL);
u = g_strdup_printf("file://%s", rp);
free(rp);
- } else {
+ } else if ((g_strrstr(uri, ".") && !g_strrstr(uri, " ")) ||
+ uri[strlen(uri)-1] == '/' || g_strcmp0(uri, "localhost") >= 0) {
u = g_strrstr(uri, "://") ? g_strdup(uri)
: g_strdup_printf("http://%s", uri);
+ } else {
+ u = g_strdup_printf(searchengine, uri);
}
/* prevents endless loop */
@@ -1220,6 +1223,8 @@ main(int argc, char *argv[]) {
} ARGEND;
if(argc > 0)
arg.v = argv[0];
+ else
+ arg.v = homepage;
setup();
newclient();
Offline
There are also some patches upstream: http://surf.suckless.org/patches/
Offline
After trying many web browsers I ended up with Surf. In addition to some official patches I have applied the "default zoom" patch too becasue with 1920x1080 resolution on my TV I need 150% default zoom level. In surf.c
1. add this line in "static Client *newclient(void)" function:
webkit_web_view_set_zoom_level(c->view, 1.5);
2. change the default value for reset zoom level in "static void zoom function" from 1.0 to 1.5
} else {
/* reset */
c->zoomed = FALSE;
webkit_web_view_set_zoom_level(c->view, 1.5);
}
}
I have only one issue with Surf: in some cases I cannot download files. For example links on h33t.com always work but links on kickasstorrents always fail with
" curl: (3) [globbing] error: bad range specification after pos 71"
Does anyone know the reason and how to fix it?
Offline
I have few ideas / requests. Im not sure if some of them are already possible, i just started using surf.
1. Gui to select where to save downloads.
I think this should be easy by using zenity in #define DOWNLOAD(d, r)?. I will try this when i have time.
2. Borders between tabbed tabs.
Not so important anymore. Im already got used to them.
3. Image preview when opening file to upload.
4. Edit current url.
EDIT: modkey+g modkey+i
^This doesnt work after i added favorite urls modification?
EDIT: modkey+y modkey+g modkey+y works!
5. Suggest your favorite urls in dmenu when youre entering url.
EDIT: Create file ~/.surf/favorites.txt and add one url per line.
Edit config.def.h:
#define SETPROP(p, q) { \
.v = (char *[]){ "/bin/sh", "-c", \
"prop=\"`xprop -id $2 $0 | cut -d '\"' -f 2 | dmenu < ~/.surf/favorites.txt`\" &&" \
"xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
p, q, winid, NULL \
} \
}
Last edited by defer (2013-08-17 17:24:57)
Offline
There are somewhat similar browsers, like dwb, which might already have what you want.
surf is pretty bare-bones, so might have to rely on external apps for much of the stuff you want to do.
Offline
A bit of relevant self promotion: here is the code to replace dmenu with interrobang for a url selector. With customizable completion, it would be trivial to get 5 (and probably 4) above:
#interrobangrc excerpt:
bang surf = echo %s
tab surf = grep "%s%s" /path/to/favorites.urls
Where /path/to/favorites.urls is a list of urls.
EDIT: I should mention the `interrobang echo` in the linked-to code block would be changed to `interrobang surf` to use the above two lines.
Last edited by Trilby (2013-08-10 18:41:23)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Online
4. Edit current url.
You can yank url and load url from clipboard, but how to modify?5. Suggest your favourite urls in dmenu when youre entering url.
Could be possible by setting file for favorite urls and modifying #define SETPROP(p, q)? I will try this when i have time.
4. MODKEY+g then MODKEY+i
5. Try the bookmark patch - I am happy with that.
Offline
A bit of relevant self promotion: here is the code to replace dmenu with interrobang for a url selector. With customizable completion, it would be trivial to get 5 (and probably 4) above
What is this interrobang? Some kind of selector or url bar? Can i get screenshot?
----
How can i set surf to download files with wget to ~/downloads ? By default surf seems to use curl to download files.
It seems its in this part of config.def.h but i cant completely understand it. Why there is useragent and cookie parameters? Where is the download path defined?
/* DOWNLOAD(URI, referer) */
#define DOWNLOAD(d, r) { \
.v = (char *[]){ "/bin/sh", "-c", \
"st -e /bin/sh -c \"curl -J -O --user-agent '$1'" \
" --referer '$2'" \
" -b ~/.surf/cookies.txt -c ~/.surf/cookies.txt '$0';" \
" sleep 5;\"", \
d, useragent, r, NULL \
} \
}
Offline
Trilby wrote:A bit of relevant self promotion: here is the code to replace dmenu with interrobang for a url selector. With customizable completion, it would be trivial to get 5 (and probably 4) above
What is this interrobang? Some kind of selector or url bar?
See https://bbs.archlinux.org/viewtopic.php?id=160182 and Trilby's signature.
Offline
Karol got it. But in a very small nutshell, it's a launcher alternative to dmenu.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Online
4. Edit current url.
EDIT: modkey+g modkey+i
^This doesnt work after i added favorite urls modification?
EDIT: modkey+y modkey+g modkey+y works!
This makes me wonder.. What about modkey+g tab?
Offline
This makes me wonder.. What about modkey+g tab?
It spawns the first url from favorites with modkey-g modkey-i and modkey-g tab
Karol got it. But in a very small nutshell, it's a launcher alternative to dmenu.
Sorry but im not going to test it if i cant get screenshot first
Last edited by defer (2013-08-17 20:56:24)
Offline
You know you don't have to test it; Trilby merely suggested it in case it might fit your needs better. If you're not wanting to test for yourself, stick to your own solutions...
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
My post wasn't directed specifically at you defer, it was for the thread as idea for surf hacking. If you want a screenshot before you try it, I'm pretty sure you wouldn't like it
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Online
How can i set surf to download files with wget to ~/downloads ? By default surf seems to use curl to download files.
I did not try wget but with curl to set the default location:
/* DOWNLOAD(URI, referer) */
#define DOWNLOAD(d, r) { \
.v = (char *[]){ "/bin/sh", "-c", \
"urxvtc -e /bin/sh -c \"cd /home/<username>/Downloads && curl -J -O --user-agent '$1'" \
" --referer '$2'" \
" -b ~/.surf/cookies.txt -c ~/.surf/cookies.txt '$0';" \
" sleep 5;\"", \
d, useragent, r, NULL \
} \
}
Offline
It would be nice if tabbed had equal sized tabs. I cant figure out how to implement it.
I did not try wget but with curl to set the default location
Thanks!
Last edited by defer (2013-08-20 01:13:14)
Offline
Something similar to LeechBlock or Chrome Nanny for surf would be great. (Being minimalist and undistracted definitely sucks less. )
Maybe this script could be directly integrated to surf: https://github.com/leftnode/get-shit-done
BTW, thanks, defer, for starting this thread!
Offline
What is the difference between LeechBlock and blacklisting sites with privoxy?
Offline
What is the difference between LeechBlock and blacklisting sites with privoxy?
I've no experience with privoxy (but I did read this -- interesting!). I found LeechBlock very effective because I could also block access to its settings, so I was not able to "hack myself out" of the site access restrictions. With privoxy -- I assume -- modifying settings is just a matter of becoming root?
Offline
Anyone else getting a "cISV |" before the title of every url?
An example is: "cISV | ArchWiki"
It happens on both a 64- and 32-bit box.
Offline
@ dluco, it shows the status for different options such as images, scripts etc.
Upper case denotes an enabled option, and lower case denotes a disabled option.
Take a look here:
http://lists.suckless.org/dev/1302/14528.html
Last edited by x33a (2013-12-10 05:13:01)
Offline
totolotto wrote:What is the difference between LeechBlock and blacklisting sites with privoxy?
I've no experience with privoxy (but I did read this -- interesting!). I found LeechBlock very effective because I could also block access to its settings, so I was not able to "hack myself out" of the site access restrictions. With privoxy -- I assume -- modifying settings is just a matter of becoming root?
As long as you are root nothing will help you. Installing an unrestrictet browser is no challenge. Use privoxy, force http(s) traffic through it and use pam_time to block root access for some hours.
Last edited by progandy (2013-12-10 05:28:49)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
Hi, does someone here setted DuckDuckGo as search engine and can tell me how did it! The official site didn't tell how to do it, and i didn't found anything on internet. Appear that just we use surf, haha.
Emacs - tmux - Cmus - Mutt - Lynx/w3m - ....
Offline
Hi, does someone here setted DuckDuckGo as search engine and can tell me how did it! The official site didn't tell how to do it, and i didn't found anything on internet. Appear that just we use surf, haha.
https://bbs.archlinux.org/viewtopic.php … 2#p1308782 provides an example how to add google search. Have you treid to do something similar with DDG?
I've found https://bbs.archlinux.org/viewtopic.php?pid=1192047 and http://surf.suckless.org/patches/searchengines
Offline
Is there a patch that make me able to use commands without a modkey (just a single key, e.g. `j` instead of `MOD+j` to scroll down) and when I type this key into a textbox just its corresponding character be inserted and its corresponding command be not executed; typing out of a textbox would do the regular behaviour?
Offline