uzbl icon indicating copy to clipboard operation
uzbl copied to clipboard

Allow to cycle through settings

Open GSI opened this issue 10 years ago • 9 comments

=> just like toggle, but with multiple settings

Use case:

@cbind !xx = chain 'cycle proxy_url http://127.0.0.1:8123#polipo http://127.0.0.1:8118#privoxy ""' 'reload'

The above should switch to polipo upon first invocation, to privoxy upon second and to no proxy (note the "") upon third. (On the fourth, back to polipo and so on ...; also reload upon every invocation)

Any way to achieve this in current master?

GSI avatar Apr 07 '16 01:04 GSI

Toggle takes extra arguments to cycle between.

mathstuf avatar Apr 07 '16 03:04 mathstuf

Let me know if the docs need clarification (needed to double check that bit was in there).

mathstuf avatar Apr 07 '16 03:04 mathstuf

I guess so. I had tested it like this before reporting, but it fails:

@cbind !xx = chain 'toggle proxy_url http://127.0.0.1:8123#polipo http://127.0.0.1:8118#privoxy ""' 'reload'

Am I misunderstanding the concept?

GSI avatar Apr 07 '16 03:04 GSI

Does the toggle command work outside of chain?

mathstuf avatar Apr 07 '16 04:04 mathstuf

Not for proxy_url. It works for other things like in toggle zoom_text_only, though.

GSI avatar Apr 07 '16 05:04 GSI

toggle works by looking at the current value and from that figuring out the next value. The problem with proxy_url is that it normalises the urls when set so we don't get a match

set proxy_url http://localhost:8080 => proxy_url = http://localhost:8080/

however seems to be a separate issue clearing the proxy_url

keis avatar Apr 07 '16 07:04 keis

Confirmed.

Despite this, how can the third state be "proxy off" ?

I tried several variants of escaped "emptiness".

GSI avatar Apr 09 '16 01:04 GSI

I think that's a bug in implementation of the proxy_url variable. I can't get it to work with a simple set either

keis avatar Apr 09 '16 10:04 keis

Works just fine with normalized strings now. Thanks.

Maybe we should have a way to "name" proxies in order to display that name in the UI (and ditch my approach of putting a hash tag into the URL for that purpose).

GSI avatar Apr 13 '16 16:04 GSI