You are not logged in.

#1 2010-10-23 22:49:26

collards
Member
Registered: 2010-10-08
Posts: 5

suckless surf link hinting

Desperately trying to get this working.  I've managed to apply a few patches, can rebuild surf consistently without errors etc. etc., but the script.js file on suckless.org just isn't doing anything.  Can anyone who has gotten this to work walk me through the steps I need to perform? At this point I feel like I really need a step by step tutorial.

step 1. copy script into script.js
step 2. put script in .surf
so on and so forth

Offline

#2 2010-10-23 23:05:04

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: suckless surf link hinting

Moved to newbie corner...

# edit: I've not used surf, but looking at config.def.h, you may need to define the relevant keybinds to call the hinting script...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2010-10-23 23:25:40

collards
Member
Registered: 2010-10-08
Posts: 5

Re: suckless surf link hinting

I have done that.  I don't *feel* like a newbie, but I guess you can argue that's where this belongs...

Offline

#4 2010-10-24 02:03:31

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: suckless surf link hinting

Hi collards,

I know that this isn't at all what you asked, but I recommend one of the vimprobables (I use vimprobable2-git). It's very active in development and the hinting mode works great. The set up is similar to dwm in that it has a central config.h file. The devs are readily accessible for patches, feature requests, and general questions. And, the impression that it's buggy is from the early days; It's very solid right now.

Offline

#5 2010-10-27 02:12:25

milomouse
Member
Registered: 2009-03-24
Posts: 940
Website

Re: suckless surf link hinting

I use surf with link hints and it works fine. Here's what I did... Copy text from: http://surf.suckless.org/files/link_hints  (here's a snapshot I uploaded of working copy in case website changes, etc: http://pastebin.com/2Hbgm3yc) and make sure this line is in your config.def.h

static char *scriptfile     = ".config/surf/script.js";

Copy the provided script from suckless.org (or pastebin snapshot 2010-10-26) as script.js into your surf directory (~/.surf/script.js or ~/.config/surf/script.js ..etc, depending on your setup in config). The default keybindings for hints are on that webpage. (Ctrl-f, Ctrl-F, Ctrl-c). Here's my entire config.def.h (although there are quite a few modifications from my other patches and I haven't quite gotten everything the way I want)

/* modifier 0 means no modifier */
static char *useragent      = "Surf/"VERSION" (X11; U; Unix; en-US) AppleWebKit/531.2+ Compatible (Safari)";
static char *progress       = "#FF0000";
static char *progress_trust = "#00FF00";
static char *stylefile      = ".config/surf/style.css";
static char *scriptfile     = ".config/surf/script.js";
static char *cookiefile     = ".config/surf/cookies.txt";
static char *historyfile    = ".config/surf/history";
static char *dldir          = ".config/surf/downloads";
static time_t sessiontime   = 3600;
static int indicator_thickness = 8;
static int using_proxy = 0;

#define HOMEPAGE "https://bbs.archlinux.org/search.php?action=show_new"
#define NOBACKGROUND 0

#define SETPROP(p, q) { \
  .v = (char *[]){ "/bin/zsh", "-c", \
    "prop=\"`xprop -id $2 $0 | cut -d '\"' -f 2 | stumpish pout`\" &&" \
    "xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
    p, q, winid, NULL } }

#define SETURI(p) { \
  .v = (char *[]){ "/bin/zsh", "-c", \
  "prop=\`cat ~/.config/surf/history | sort -ru | dmenu -l 10 -b i | xprop -id `cat ~/.config/surf/id` -f SURF_URI 8s -set _SURF_URI`\" &&" \
  "xprop -id $1 -f $0 8s -set $0 \"$prop\"", p, winid, NULL } }

#define DOWNLOAD(d) { \
    .v = (char *[]){ "/bin/zsh", "-c", \
    "dl=\"$XDG_DOWNLOAD_DIR/$(basename \"$0\")\"; urxvt -e \"curl -b ~/.config/surf/cookies.txt -c ~/.config/surf/cookies.txt -L --retry 3 --retry-delay 5 --ssl -k --ftp-pasv -O \"$dl\" \"$0\";\"", \
    d, NULL } }

#define BMARK_LOAD { \
  .v = (char *[]){ "/bin/zsh", "-c", \
  "xprop -id $0 -f _SURF_GO 8s -set _SURF_GO \
  `cat ~/.config/surf/bookmarks | dmenu || exit 0`", winid, NULL } }

#define BMARK_ADD { \
  .v = (char *[]){ "/bin/zsh", "-c", \
  "(echo `xprop -id $0 _SURF_URI | cut -d '\"' -f 2` && \
  `cat ~/.config/surf/bookmarks) | sort -u >! /dev/shm/.sm && \
  mv -f /dev/shm/.sm ~/.config/surf/bookmarks", winid, NULL } }

#define MODKEY GDK_CONTROL_MASK

static SearchEngine searchengines[] = {
    { "g",      "http://www.google.com/search?q=%s" },
    { "s",      "https://www.google.com/search?q=%s"  },
    { "k",      "http://www.kickasstorrents.com/search/%s"  },
    { "l",      "http://last.fm/music/?q=%s"  },
    { "e",      "http://search.ebay.com/search/search.dll?MfcISAPICommand=GetResult&krd=1&ht=1&shortcut=4&SoftProperty=MetaEndSort&cgiurl=http%3A%2Fcgi.com/%2Fws%2F&maxRecordsPerPage=50&st=2&ebaytag1code=77&query=%s"  },
    { "i",      "http://www.imdb.com/find?s=tt&q=%s"  },
    { "p",      "http://thepiratebay.org/search/%s" },
    { "w",      "https://secure.wikimedia.org/wikipedia/en/w/index.php?search=%s" },
    { "y",      "http://www.youtube.com/results?search_query=%s"  },
};

static Key keys[] = {
    /* modifier                keyval      function    arg             Focus */
    { MODKEY|GDK_SHIFT_MASK,GDK_r,      reload,     { .b = TRUE } },
    { MODKEY,               GDK_r,      reload,     { .b = FALSE } },
    { MODKEY|GDK_SHIFT_MASK,GDK_p,      print,      { 0 } },
    { MODKEY,               GDK_p,      clipboard,  { .b = TRUE } },
    { MODKEY,               GDK_y,      clipboard,  { .b = FALSE } },
    { MODKEY|GDK_SHIFT_MASK,GDK_j,      zoom,       { .i = -1 } },
    { MODKEY|GDK_SHIFT_MASK,GDK_k,      zoom,       { .i = +1 } },
    { MODKEY|GDK_SHIFT_MASK,GDK_i,      zoom,       { .i = 0  } },
    { MODKEY,               GDK_l,      navigate,   { .i = +1 } },
    { MODKEY,               GDK_h,      navigate,   { .i = -1 } },
    { MODKEY,               GDK_j,      scroll,     { .i = +1 } },
    { MODKEY,               GDK_k,      scroll,     { .i = -1 } },
    { MODKEY|GDK_SHIFT_MASK,GDK_j,      scroll,     { .i = +10 } },
    { MODKEY|GDK_SHIFT_MASK,GDK_k,      scroll,     { .i = -10 } },
    { 0,                    GDK_Escape, stop,       { 0 } },
    { MODKEY,               GDK_Return, spawn,      SETURI("_SURF_URI") },
    { MODKEY|GDK_SHIFT_MASK,GDK_s,      stop,       { 0 } },
    { MODKEY,               GDK_o,      source,     { 0 } },
/*    { MODKEY,               GKD_a,      spawn,      SETPROP("_SURF_AGENT") }, */
    { MODKEY,               GDK_g,      spawn,      SETPROP("_SURF_URI", "_SURF_GO") },
    { MODKEY,               GDK_slash,  spawn,      SETPROP("_SURF_FIND", "_SURF_FIND") },
/*    { MODKEY,               GDK_t,      togglesb,   { 0 } }, */
    { MODKEY,               GDK_n,      find,       { .b = TRUE } },
    { MODKEY|GDK_SHIFT_MASK,GDK_n,      find,       { .b = FALSE } },
    { MODKEY,               GDK_b,      spawn,      BMARK_LOAD },
    { MODKEY|GDK_SHIFT_MASK,GDK_b,      spawn,      BMARK_ADD },
};

Offline

#6 2010-10-27 18:04:54

reed9
Member
Registered: 2008-06-12
Posts: 77

Re: suckless surf link hinting

I would also check out dwb.  Similar to surf with great link hinting.

https://bbs.archlinux.org/viewtopic.php?id=95589&p=1

Offline

#7 2022-08-10 19:03:56

serxxx
Member
Registered: 2017-04-02
Posts: 9

Re: suckless surf link hinting

milomouse wrote:

I use surf with link hints and it works fine.

Except when it doesn't, which is quite frequently when the website you're on uses Javascript that interferes with the hinting script. It also stops working if you disable Javascript in surf, which is useful on websites with unnecessary or heavy Javascript.

If anyone comes across a non-JS solution to link hinting in surf, please post it here.

Offline

#8 2022-08-10 22:02:17

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,845
Website

Re: suckless surf link hinting

Please pay attention to the ages of topics and don't necrobump.

Closing.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB