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

additional/combined searches "at once", via custom bangs #33

Closed
devsbae opened this issue Jan 26, 2025 · 4 comments
Closed

additional/combined searches "at once", via custom bangs #33

devsbae opened this issue Jan 26, 2025 · 4 comments

Comments

@devsbae
Copy link

devsbae commented Jan 26, 2025

Is your feature request related to a problem? Please describe.
Less of a problem, more of a desired use case!

I'd like to define multiple/additional search URLs for a custom bang, with the intent of "firing off" multiple/additional searches (in their own, additionaly created tabs) when used.

Example scenario:
You encounter a term and you are interested in learning more about its meanings and origins.
Additionally you might have a multilingual interest and you are curious to see what this term looks like in one or more other languages.
Maybe there's also a neat Wikipedia entry?
and so on...

Currently, you'd have to remember all relevant bangs you pretty much always use in these situations, and then, execute those searches "by hand", one after the other.
i.e. new tab, type bang plus term, enter, open new tab, type bang plus term, enter, etc.
(which isn't difficult in itself, and ultimately a matter of habit. however, i hope this demonstrates how this procedure could grow to be somewhat cumbersome and/or dull over time.)

Describe the solution you'd like
Provide functionality to define multiple searches when creating/editing a custom bang.

How it could look like:
During "Edit Custom Bang" dialog / setting screen, add functionality for additional search URL input fields, i.e. adding, editing, and removing them.

Then, with a single custom bang search, all its defined searches get executed. The first in the current tab, and all additional ones in additional tabs.

Additional usability & functionality:

  • Allow user to sort URL input fields freely, so they can customize the order of the searches.
    e.g. via drag sorting, or up/down arrows for each entry.

  • Allow user to input other bangs (default or custom) instead of search URLs:
    e.g. etym{{{s}}} is functionally synonymous with https://www.etymonline.com/search?q={{{s}}}

    This may prove to be even more useful, as multiple searches themselves could be combined in another custom bang.
    as an example:
    create custom bang "mean?" for meaning related searches (say, monolingual dicts, etymology dicts, etc.)
    create custom bang "tr?" for multilingual related searches (bilingual dicts, google translate, etc.)
    and then combine them both in another custom bang "what?", maybe with an additional "w" bang for en.wikipedia.org.

Describe alternatives you've considered
n/a

Additional context
n/a

@dmlls
Copy link
Owner

dmlls commented Jan 29, 2025

Hi @devsbae, and thank you for the detailed feature request! Actually, I also think this would be pretty cool to have!

I can also see it being used as a nifty shortcut to, e.g., open all your mail accounts with a bang, your favorite news sites, even perhaps your work-related sites (Jira, Confluence, GitHub, etc.).

The only thing I don't see happening for now is this "bang nesting" you mention at the end, since we would also need to check for loops (e.g., A → B → C → A), which complicates the logic unnecessarily. Moreover, it would make the bang resolution slightly slower since we would need to resolve all bang references. But otherwise, I agree with all you said!

Now, this might take a bit of time, since also the storage schema needs to be updated so that a bang can have multiple targets. I have two important deadlines in mid-February, so I will be pretty busy until then, but I will get to it after that. I think this feature can also be a good excuse to finally release the 1.0.0 version after 2 years :)

@devsbae
Copy link
Author

devsbae commented Jan 29, 2025

I appreciate that this is an appealing feature for you too!
And while it wasn't and isn't necessary, I appreciate the provisional timeline!
That is to say, given that I'm obviously not in a position to say so anyhow, that there is no hurry/urgency (at least from me).
In any case, I'm glad I could maybe contribute a good excuse to tinker on this extension :)

Back on track: The endless loop problem occurred to me too, probably the morning after I issued the OP.
I already had somewhat of a follow-up post drafted, with some thoughts/ideas on how to tackle this, etc.1
But, stewing over it, and then looking into it some more, it seems to be a non-trivial problem, albeit an interesting one.
Then again, maybe I'm unaware of already existing and well-known approaches to this class of problem.

Anyway, I agree that this nesting bang functionality is not a good trade-off, with regards to work input and functionality output.

Meanwhile, I found an alternative extension, which seems to provide multi-target searches via custom bangs.
Their demo video (note: timestamped by me) shows this in action, with another nice use case (e-shopping).
I just wanted to mention it, maybe it's useful somehow.

Footnotes

  1. The most "feasible" thing I've come up with is something like auto-expanding custom multi-target bangs while editing another custom bang.
    "Feasible" in terms of meeting the "nesting bangs" functionality/requirements I had in mind, while also not having to solve a "hard" problem.
    Specifically, not having to type out already defined custom multi-target bangs.
    (And not having to edit and then update all affected bangs manually, if needed.)

    Something like this:
    - While editing a custom bang, in a search url field, you type "shop" and hit the tab key. ("shop" being an already defined custom multi-target bang.)
    - It will then expand and insert/add the "shop" bang into the one you're currently editing, "as is".
    - So, with "shop" being a multi-target bang, it expands to multiple, already filled-in search url fields.
    - Sometime later: You change the "shop" multi-target bang, and want its changes to affect other custom bangs, in which you previously expanded the, now outdated, "shop" bang.
    - For this, manually edit each of those "to-be-affected": Just expand the updated "shop" bang again. Manually delete the outdated search url entries.
    - (This may benefit from something like a "annotation/description" field, where you could make note of a custom multi-target bang's intent, as it may not be (immediately) obvious from glancing at its search urls. Then again, the "name" field is a good candidate for multi-purposing for this.)

    Taking a step back, and in the manner of "let's be real here": This is a highly specialized use case and/or suspicious of scope overreach.
    I just wanted to propose and type this out nonetheless, in case the implementation is more trivial than I have figured. In other words, feel free to disregard, of course :)
    To be clear, I'm not haggling or pleading here: I'll be perfectly content without this "nesting"/"auto-expand" functionality!

@dmlls
Copy link
Owner

dmlls commented Feb 6, 2025

@devsbae awesome ideation, once again! Looking forward to working on this :)

And thanks a lot for mentioning the other extension and the demo, very cool indeed! It's nice to see there are other great (FOSS) alternatives, freedom to the user!

@dmlls
Copy link
Owner

dmlls commented Mar 8, 2025

Hi @devsbae, the new feature is up! Enjoy!

https://github.com/dmlls/yang/releases/tag/v1.0.0

@dmlls dmlls closed this as completed Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants