Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to cycle through settings #250

Open
GSI opened this issue Apr 7, 2016 · 9 comments
Open

Allow to cycle through settings #250

GSI opened this issue Apr 7, 2016 · 9 comments

Comments

@GSI
Copy link
Contributor

GSI commented Apr 7, 2016

=> 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?

@mathstuf
Copy link
Member

mathstuf commented Apr 7, 2016

Toggle takes extra arguments to cycle between.

@mathstuf
Copy link
Member

mathstuf commented Apr 7, 2016

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

@GSI GSI changed the title Allow to cicle through settings Allow to cycle through settings Apr 7, 2016
@GSI
Copy link
Contributor Author

GSI commented Apr 7, 2016

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?

@mathstuf
Copy link
Member

mathstuf commented Apr 7, 2016

Does the toggle command work outside of chain?

@GSI
Copy link
Contributor Author

GSI commented Apr 7, 2016

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

@keis
Copy link
Member

keis commented Apr 7, 2016

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

@GSI
Copy link
Contributor Author

GSI commented Apr 9, 2016

Confirmed.

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

I tried several variants of escaped "emptiness".

@keis
Copy link
Member

keis commented Apr 9, 2016

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

@GSI
Copy link
Contributor Author

GSI commented Apr 13, 2016

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants