[dev] [surf] patch : toggle, horiz scroll, togglestyle

2010-05-20 Thread stanio
Hi,

I am posting a patch against tip which lies on the border to caprice and
code bloat, but these changes proved very useful to me in the last months.
That's why I'd love to see some of them accepted. 

- toggle() boolean properties of Webkit (examples in the config)

- scroll uses a heuristic in passing integer parameter borrowed from
  meillo, I guess, and extended to scroll a page up/down or to the
  begin/end of document.  Scrolling vertically and horizontally differs
  just in the GtkAdjustment used. So I've put them together. 

  Horizontal scroll is very useful on many (broken) sites when you have a
  small screen.

- setting  custom style I found useful for the frequent cases that I  read
  long texts of insane color on insane background burning my eyes. The
  style file being sth like * {background:#33 !important; text:#ee
  !important;}

- the key bindings in the patch are not ok but I ran out of ideas. Couldn't
  post my original ones, since they don't conform to the main line, e.g. I
  have hjkl for scrolling, HL for navigation, gG for begin/end of document,
  Space/Shift|Space for page down/up, etc. 

Thanks to everybody contributing to surf. 

Hope you find something useful.

cheers,
-- 
 stanio_
diff -r c7c0e3c25efb config.def.h
--- a/config.def.h  Tue May 18 14:20:24 2010 +0200
+++ b/config.def.h  Thu May 20 11:03:36 2010 +0200
@@ -25,10 +25,19 @@
 { 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_j,  scroll_v,   { .i = +1 } },
+{ MODKEY,   GDK_k,  scroll_v,   { .i = -1 } },
+{ MODKEY,   GDK_space,  scroll_v,   { .i = +1 } },
+{ MODKEY,   GDK_b,  scroll_v,   { .i = +2 } },
+{ MODKEY|GDK_SHIFT_MASK,GDK_h,  scroll_h,   { .i = -1 } },
+{ MODKEY|GDK_SHIFT_MASK,GDK_l,  scroll_h,   { .i = +1 } },
 { 0,GDK_Escape, stop,   { 0 } },
+{ MODKEY,   GDK_v,  toggle, { .v = "enable-plugins" } 
},
+{ MODKEY,   GDK_I,  toggle, { .v = "auto-load-images" 
} },
+{ MODKEY,   GDK_c,  toggle, { .v = 
"enable-caret-browsing" } },
 { MODKEY,   GDK_o,  source, { 0 } },
+{ MODKEY,   GDK_t,  setstyle,   { .v = 
"/home/stanio/.surf/text_style.css" } },
+{ MODKEY|GDK_SHIFT_MASK,GDK_t,  setstyle,   { .v = (const char *)NULL} 
},
 { MODKEY,   GDK_g,  spawn,  SETPROP("_SURF_URI", 
"_SURF_GO") },
 { MODKEY,   GDK_slash,  spawn,  SETPROP("_SURF_FIND", 
"_SURF_FIND") },
 { MODKEY,   GDK_n,  find,   { .b = TRUE } },
diff -r c7c0e3c25efb surf.c
--- a/surf.cTue May 18 14:20:24 2010 +0200
+++ b/surf.cThu May 20 11:03:36 2010 +0200
@@ -96,15 +96,19 @@
 static void progresschange(WebKitWebView *view, GParamSpec *pspec, Client *c);
 static void reload(Client *c, const Arg *arg);
 static void resize(GtkWidget *w, GtkAllocation *a, Client *c);
-static void scroll(Client *c, const Arg *arg);
+static void scroll(GtkAdjustment *a,  const Arg *arg);
+static void scroll_h(Client *c, const Arg *arg);
+static void scroll_v(Client *c, const Arg *arg);
 static void setatom(Client *c, int a, const char *v);
 static void setcookie(SoupCookie *c);
+static void setstyle(Client *c, const Arg *arg);
 static void setup(void);
 static void sigchld(int unused);
 static void source(Client *c, const Arg *arg);
 static void spawn(Client *c, const Arg *arg);
 static void stop(Client *c, const Arg *arg);
 static void titlechange(WebKitWebView *v, WebKitWebFrame* frame, const char* 
title, Client *c);
+static void toggle(Client *c, const Arg *arg);
 static void update(Client *c);
 static void updatewinid(Client *c);
 static void usage(void);
@@ -634,19 +638,37 @@
 }
 
 void
-scroll(Client *c, const Arg *arg) {
+scroll(GtkAdjustment *a, const Arg *arg) {
gdouble v;
-   GtkAdjustment *a;
 
-   a = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(c->scroll));
v = gtk_adjustment_get_value(a);
-   v += gtk_adjustment_get_step_increment(a) * arg->i;
+   switch (arg->i){
+   case +1:
+   case -1:
+   v += gtk_adjustment_get_page_increment(a) * (arg->i / 
1); break;
+   case +2:
+   case -2:
+   default:
+   v += gtk_adjustment_get_step_increment(a) * arg->i;
+   }
v = MAX(v, 0.0);
v = MIN(v, gtk_adjustment_get_upper(a) - 
gtk_adjustment_get_page_size(a));
gtk_adjustment_set_value(a, v);
 }
 
 void
+scroll_h(Client *c, const Arg *arg) {
+ 

[dev] [surf] following links in caret mode

2010-05-20 Thread stanio
Hi,

I find the idea of caret browsing in combination with search better than
relying on 200-300 additional lines of JS. (That is what you can do for
instance in lynx when link numbering is off) The problem is that when
searching in caret mode the match sometimes doesn't get
selected/highlighted even if it is a link ... 

Does anybody experience that too? Any idea why and how to fix?

cheers,
-- 
 stanio_



Re: [dev] vimium extension for chromium

2010-05-20 Thread Claudio M. Alessi
On Thu, May 20, 2010 at 01:32:29AM +0200, pancake wrote:
> It was a joke
Indeed, i'd suspect it ;-)

-- 
JID: smoppy AT gmail.com
WWW: http://cma.teroristi.org



Re: [dev] vimium extension for chromium

2010-05-20 Thread markus schnalke
[2010-05-19 08:58] Niki Yoshiuchi 
> On Wed, May 19, 2010 at 8:02 AM, Marvin Vek  wrote:
> > On Wed, May 19, 2010 at 12:07:31PM +0200, markus schnalke wrote:
> > > Vimium and surf are very different; I see hardly any similarity.
> > >
> > > With s/surf/vimperator/ I can agree.
> >
> > Vimperator had version 0.4 released 30th of April 2007. First Surf
> > commit i see was 11 months ago. I'd say the Surf people are cloning
> > Vimperator.
> >
> I think he meant that vimium was copying vimperator, as s// typically
> overwrites the former with the latter.

Correct.


meillo



Re: [dev] [surf] patch : toggle, horiz scroll, togglestyle

2010-05-20 Thread Rob
On 2010-05-20, sta...@cs.tu-berlin.de  wrote:
> Hi,
>
> I am posting a patch against tip which lies on the border to caprice and
> code bloat, but these changes proved very useful to me in the last months.
> That's why I'd love to see some of them accepted.
>
> - toggle() boolean properties of Webkit (examples in the config)
>
> - scroll uses a heuristic in passing integer parameter borrowed from
>   meillo, I guess, and extended to scroll a page up/down or to the
>   begin/end of document.  Scrolling vertically and horizontally differs
>   just in the GtkAdjustment used. So I've put them together.
>
>   Horizontal scroll is very useful on many (broken) sites when you have a
>   small screen.
>
> - setting  custom style I found useful for the frequent cases that I  read
>   long texts of insane color on insane background burning my eyes. The
>   style file being sth like * {background:#33 !important; text:#ee
>   !important;}
>
> - the key bindings in the patch are not ok but I ran out of ideas. Couldn't
>   post my original ones, since they don't conform to the main line, e.g. I
>   have hjkl for scrolling, HL for navigation, gG for begin/end of document,
>   Space/Shift|Space for page down/up, etc.
>
> Thanks to everybody contributing to surf.
>
> Hope you find something useful.
>
> cheers,
> --
>  stanio_
>



Re: [dev] [surf] patch : toggle, horiz scroll, togglestyle

2010-05-20 Thread Rob
Ah sorry about that, my mail client was playing up
:S


On 2010-05-20, Rob  wrote:
> On 2010-05-20, sta...@cs.tu-berlin.de  wrote:
>> Hi,
>>
>> I am posting a patch against tip which lies on the border to caprice and
>> code bloat, but these changes proved very useful to me in the last
>> months.
>> That's why I'd love to see some of them accepted.
>>
>> - toggle() boolean properties of Webkit (examples in the config)
>>
>> - scroll uses a heuristic in passing integer parameter borrowed from
>>   meillo, I guess, and extended to scroll a page up/down or to the
>>   begin/end of document.  Scrolling vertically and horizontally differs
>>   just in the GtkAdjustment used. So I've put them together.
>>
>>   Horizontal scroll is very useful on many (broken) sites when you have a
>>   small screen.
>>
>> - setting  custom style I found useful for the frequent cases that I
>> read
>>   long texts of insane color on insane background burning my eyes. The
>>   style file being sth like * {background:#33 !important;
>> text:#ee
>>   !important;}
>>
>> - the key bindings in the patch are not ok but I ran out of ideas.
>> Couldn't
>>   post my original ones, since they don't conform to the main line, e.g.
>> I
>>   have hjkl for scrolling, HL for navigation, gG for begin/end of
>> document,
>>   Space/Shift|Space for page down/up, etc.
>>
>> Thanks to everybody contributing to surf.
>>
>> Hope you find something useful.
>>
>> cheers,
>> --
>>  stanio_
>>
>



Re: [dev] [surf] patch : toggle, horiz scroll, togglestyle

2010-05-20 Thread Rob Greer
On Thu, May 20, 2010 at 04:12,  wrote:

> - scroll uses a heuristic in passing integer parameter borrowed from
>  meillo, I guess, and extended to scroll a page up/down or to the
>  begin/end of document.  Scrolling vertically and horizontally differs
>  just in the GtkAdjustment used. So I've put them together.
>
Can't you just do this with Home and End?

>  Horizontal scroll is very useful on many (broken) sites when you have a
>  small screen.
>
Arrow keys?


[dev] wmii; make with /bin/bash not with /bin/sh

2010-05-20 Thread David Schmid

Hello dear subscribers,

when compiling the wmii+ixp-3.9b1 on a solaris box, make calls /bin/sh 
to evaluate several scripts. Since /bin/sh is really old around here, 
make dies instantly because /bin/sh can't interpret the scripts ("/bin 
sh: bad substitution").
Since relinking /bin/sh to /bin/bash is neiter a decent nor any option 
here, how do I get make to use /bin/bash and not /bin/sh?


Measures tried:
 - resetting PATH, since make calls /bin/sh and not sh it is never 
looked up there

 - setting BINSH or SHELL to /bin/bash won't work either.
 - Asking for help at #suckless did not come up with immediate solution.

The only thing that came up on #suckless was LD_PRELOAD to overwrite the 
system calls... but that might take some time to do and is not a clean 
option either. But it looks interesting enough to try out some time.


Any ideas?

--
regards,
David



Re: [dev] wmii; make with /bin/bash not with /bin/sh

2010-05-20 Thread Robert Ransom
On Thu, 20 May 2010 14:51:37 +0200
David Schmid  wrote:

> Hello dear subscribers,
> 
> when compiling the wmii+ixp-3.9b1 on a solaris box, make calls /bin/sh 
> to evaluate several scripts. Since /bin/sh is really old around here, 
> make dies instantly because /bin/sh can't interpret the scripts ("/bin 
> sh: bad substitution").
> Since relinking /bin/sh to /bin/bash is neiter a decent nor any option 
> here, how do I get make to use /bin/bash and not /bin/sh?
> 
> Measures tried:
>   - resetting PATH, since make calls /bin/sh and not sh it is never 
> looked up there
>   - setting BINSH or SHELL to /bin/bash won't work either.
>   - Asking for help at #suckless did not come up with immediate solution.

I just tried "SHELL=/bin/echo make foo.o" on a system with GNU
userland, and no luck -- GNU make won't help unless you patch it.

Can you chroot?

> The only thing that came up on #suckless was LD_PRELOAD to overwrite the 
> system calls... but that might take some time to do and is not a clean 
> option either. But it looks interesting enough to try out some time.
> 
> Any ideas?

The long-term Right Thing is probably a Makefile-to-shell-script
converter.

Robert Ransom



Re: [dev] wmii; make with /bin/bash not with /bin/sh

2010-05-20 Thread Kris Maglione
On Thu, 20 May 2010 14:51:37 +0200
David Schmid  wrote:
> when compiling the wmii+ixp-3.9b1 on a solaris box, make
> calls /bin/sh to evaluate several scripts. Since /bin/sh is really
> old around here, make dies instantly because /bin/sh can't interpret
> the scripts ("/bin sh: bad substitution").
> Since relinking /bin/sh to /bin/bash is neiter a decent nor any
> option here, how do I get make to use /bin/bash and not /bin/sh?

Solaris' /bin/sh isn't a POSIX shell, as I recall. wmiirc should work
with any POSIX shell. We don't use bash by default because it's rather
slower than most of the alternatives, and tends to get worse for long
running scripts. Setting BINSH should work, but it looks like the
inclusion of config.mk got pushed up a few lines in the make scripts,
so it's too late. Just run:

  make BINSH=/bin/bash

and you should be fine.
 
> Measures tried:
>   - resetting PATH, since make calls /bin/sh and not sh it is never 
> looked up there
>   - setting BINSH or SHELL to /bin/bash won't work either.
>   - Asking for help at #suckless did not come up with immediate
> solution.
> 
> The only thing that came up on #suckless was LD_PRELOAD to overwrite
> the system calls... but that might take some time to do and is not a
> clean option either. But it looks interesting enough to try out some
> time.

Well, using LD_PRELOAD would be rather silly indeed. Perhaps it would
be fun as an exercise, but it would definitely not be a good choice.
It'd be easier to just do something like:

wmii -r 'bash /etc/wmii/wmiirc'


-- 
Kris Maglione

Mostly, when you see programmers, they aren't doing anything.  One of
the attractive things about programmers is that you cannot tell
whether or not they are working simply by looking at them.  Very often
they're sitting there seemingly drinking coffee and gossiping, or just
staring into space.  What the programmer is trying to do is get a
handle on all the individual and unrelated ideas that are scampering
around in his head.
--Charles M. Strauss




Re: [dev] [surf] patch : toggle, horiz scroll, togglestyle

2010-05-20 Thread stanio
* Rob Greer  [2010-05-20 14:58]:
> On Thu, May 20, 2010 at 04:12,  wrote:
> 
> > - scroll uses a heuristic in passing integer parameter borrowed from
> >  meillo, I guess, and extended to scroll a page up/down or to the
> >  begin/end of document.  Scrolling vertically and horizontally differs
> >  just in the GtkAdjustment used. So I've put them together.
> >
> Can't you just do this with Home and End?

sure

> >  Horizontal scroll is very useful on many (broken) sites when you have a
> >  small screen.
> >
> Arrow keys?

Of course. Moreover, you can scroll up/down with arrow keys, too. But jk is
part of the interface anyway, so for full vi-like experience you add hl
(and gG) at very low additional cost or to be consistent to your argument
you remove the jk binings at all and save some code. I'd go for the former.

cheers,
-- 
 stanio_



Re: [dev] wmii; make with /bin/bash not with /bin/sh

2010-05-20 Thread Kris Maglione
On Thu, 20 May 2010 14:51:37 +0200
David Schmid  wrote:

> Hello dear subscribers,
> 
> when compiling the wmii+ixp-3.9b1 on a solaris box, make
> calls /bin/sh to evaluate several scripts. Since /bin/sh is really
> old around here, make dies instantly because /bin/sh can't interpret
> the scripts ("/bin sh: bad substitution").
> Since relinking /bin/sh to /bin/bash is neiter a decent nor any
> option here, how do I get make to use /bin/bash and not /bin/sh?

Sorry, I've just reread this. Can you tell me exactly which scripts
fail to run under Solaris' sh? It might help to run

noisycc=1 make

and post the output. The only place /bin/sh is called directly is in
the shebang line of the util scripts, and they're all very basic, so
I'm not sure why there would be a problem. If you're really desperate,
you just do something like:

for f in util/*; do
  ed $f <

[dev] Re: wmii; make with /bin/bash not with /bin/sh

2010-05-20 Thread David Engster
Robert Ransom writes:
> On Thu, 20 May 2010 14:51:37 +0200
> David Schmid  wrote:
>> Measures tried:
>>   - resetting PATH, since make calls /bin/sh and not sh it is never 
>> looked up there
>>   - setting BINSH or SHELL to /bin/bash won't work either.
>>   - Asking for help at #suckless did not come up with immediate solution.
>
> I just tried "SHELL=/bin/echo make foo.o" on a system with GNU
> userland, and no luck -- GNU make won't help unless you patch it.

GNU make will never set the shell from the environment.

I've built wmii on Solaris without problems using

gmake SHELL=/bin/bash

-David




Re: [dev] wmii; make with /bin/bash not with /bin/sh

2010-05-20 Thread David Schmid
So, I don't know your rules around here so I hope I don't hurt your
netiquette with this eMail. Please don't kill me.
Even though someone warned me, that the suckless community _is_ good,
I am quite slightly overwhelmed by the many reactions. Thank you.

Robert Ransom  wrote:

> I just tried "SHELL=/bin/echo make foo.o" on a system with GNU
> userland, and no luck -- GNU make won't help unless you patch it.
> 
> Can you chroot?

Yes, I can chroot, but it seems I cannot do something useful with it
with my knowledge :/ I have a slight idea, but I am not sure if I could
damage the system. If I (mount) bind the folders
(like /bin, /share, ...) on a local folder and then chroot there;
relink sh to bash, compile, exit jail and be happy with a compiled
wmii, but a slightly damaged system this would not be what I had in
mind.

David Engster  wrote:

> GNU make will never set the shell from the environment.
> 
> I've built wmii on Solaris without problems using
> 
> gmake SHELL=/bin/bash

seeme like using "make SHELL=/bin/bash" instead of "SHELL=/bin/bash
make" _does_ make a difference. Now this is something new for me. Now
it says:

MAKE all libbio/
../util/compile: syntax error at line 13: `(' unexpected
make[1]: *** [bbuffered.o] Error 2
make: *** [dall] Error 2

Same with ksh.

Kris Maglione  wrote:

> Sorry, I've just reread this. Can you tell me exactly which scripts
> fail to run under Solaris' sh? It might help to run
> 
> noisycc=1 make
> 
> and post the output. 

output isn't very new...

/bin/sh: bad substitution
make: *** [dall] Error 1

> for f in util/*; do
>   ed $f < 1s/sh/bash/
> w
> EOF
> done
> 
> but I'd really rather fix it to work out of the box.

_if_ I get this right, this should substitute 'sh' for 'bash'. Tried
that already, forgot to mention this. Output is same as above.

-- 
regard,
David



[dev] Re: wmii; make with /bin/bash not with /bin/sh

2010-05-20 Thread David Engster
David Schmid writes:
> David Engster  wrote:
>
>> GNU make will never set the shell from the environment.
>> 
>> I've built wmii on Solaris without problems using
>> 
>> gmake SHELL=/bin/bash
>
> seeme like using "make SHELL=/bin/bash" instead of "SHELL=/bin/bash
> make" _does_ make a difference. Now this is something new for me.

You want to set the SHELL macro, not the environment variable SHELL. The
latter will always be ignored by GNU Make, even when using "-e".

> Now it says:
>
> MAKE all libbio/
> ../util/compile: syntax error at line 13: `(' unexpected
> make[1]: *** [bbuffered.o] Error 2
> make: *** [dall] Error 2

Sorry, forgot to mention that you still have to set /bin/bash in those
scripts in util.

> Kris Maglione  wrote:
>> Sorry, I've just reread this. Can you tell me exactly which scripts
>> fail to run under Solaris' sh? It might help to run
>> 
>> noisycc=1 make
>> 
>> and post the output. 

Last I checked, /bin/sh on Solaris was still the old Bourne shell, which
as you already wrote isn't POSIX and - amongst various other things -
doesn't understand $() command substitution, only backtick notation.

-David




Re: [dev] Re: wmii; make with /bin/bash not with /bin/sh

2010-05-20 Thread Marvin Vek
On Thu, May 20, 2010 at 09:46:01PM +0200, David Engster wrote:
> Last I checked, /bin/sh on Solaris was still the old Bourne shell, which
> as you already wrote isn't POSIX and - amongst various other things -
> doesn't understand $() command substitution, only backtick notation.

I believe ksh should be able to do it, iirc i used it like that with
ksh-88 in the past.

-- 
Marvin Vek
-
panic ("Splunge!");
linux-2.2.16/drivers/scsi/psi240i.c



Re: [dev] Re: wmii; make with /bin/bash not with /bin/sh

2010-05-20 Thread David Schmid
On Thu, 20 May 2010 21:46:01 +0200
David Engster  wrote:

> David Schmid writes:
> > David Engster  wrote:
> >
> >> GNU make will never set the shell from the environment.
> >> 
> >> I've built wmii on Solaris without problems using
> >> 
> >> gmake SHELL=/bin/bash
> >
> > seeme like using "make SHELL=/bin/bash" instead of "SHELL=/bin/bash
> > make" _does_ make a difference. Now this is something new for me.
> 
> You want to set the SHELL macro, not the environment variable SHELL.
> The latter will always be ignored by GNU Make, even when using "-e".
> 
> > Now it says:
> >
> > MAKE all libbio/
> > ../util/compile: syntax error at line 13: `(' unexpected
> > make[1]: *** [bbuffered.o] Error 2
> > make: *** [dall] Error 2
> 
> Sorry, forgot to mention that you still have to set /bin/bash in those
> scripts in util.

Now that looks awesome. The only thing that does not work is
cmd/wihack.sh, even when set to /bin/bash.

FILTER cmd/wihack.sh
wihack.sh: bad substitution
make[1]: *** [wihack.out] Error 1
make: *** [dall] Error 2

But I think I will figure out the rest.

Thanks guys.
-- 
regards,
David