37

Ok that’s a big one (maybe something to consider for the long run):
It would be amazing to have a sort of custom widget/computer system.

I’m imagining it to be kind of similar to Tempermonkey UserScripts tbh:

  • Script creator can set for what kind of input it triggers
  • Script creator can define if it’s a computer plugin or a on page search widget
  • Scripts can be easily shared (maybe a script browser with verified/trusted scripts?)
  • UI for the on page widgets should be fully customizable
  • Should it define settings, those should be saved on the Kagi account

Those should be able to both interact with Kagi based on a defined api as well as being able to access website content (maybe through Kagi as well so it doesn’t leak IP address of a normal ajax call?)

That way people could make widgets for very specific niche use cases they’d like to have without bloating everyone’s search engine/adding more widgets for you to maintain.

    Fun idea.

    Can you add bit more thoughts on the UI/flow/use cases when you get a chance.

    • Kai replied to this.

      Vlad sure:
      First of all those probably have to be JavaScript/TypeScript cause otherwise debugging them would be almost impossible and if it’s something on your server you get all sorts of problems (security, halting problem, etc).

      UI wise:
      If it’s the plugin UI you probably shouldn’t put any restrictions here (apart from the computer ones since those are limited by that).

      If it’s how you install/write them:
      Like I said I’d have some sort of plugin store/browser where people can list their plugins and other people can view the source code, install them, rate them, report them, etc. (maybe take inspiration from wago.io it’s a website for WoW user scripts https://wago.io/slraid2 )

      After installing you should be able to modify scripts. It should also give you the ability to update them if there’s a new version in the “store”. (Appropriate warnings that custom changes will be overwritten and the likes before updating).
      A user should have a list of installed plugins (Name,triggers, version, active state) where he can activate/deactivate them, view the code and delete them.

      For writing them I’d make a on site JS editor kind of thing, with code highlighting, auto completion (especially useful for eventual Kagi specific api calls) and stuff like that.
      Like UserScripts you probably should add meta information as comments to the header (plugin name, trigger conditions etc) so that they can be easily exported and imported by other people/parsed into a UI.

      Flow:
      The extension developer should be able to define trigger words that’ll activate the plugin (if there are multiple plugins with the same triggers, give a warning and tell the user to change one of them).

      The trigger words and if the plugin is active are probably the only thing you guys should be aware of on the server tbh since depending on the trigger you might have to call the computer or the search widget.
      After a trigger word is found you render either the search with the empty plugin container on top or the computer, give the search input to the plugin and let the dev handle the rest.
      That being said you probably should do some JS binding to help with hooking into the Kagi UI (especially for the computer, for the empty plugin container selecting it and setting the html probably is enough).

      I don’t know how viable it would be to define JS bindings in the way of querying a website via Kagi (rate limits and stuff) but that also could be something nice to not expose user IPs to websites if the plugin needs to crawl/parse a website to display something.

      You should make a binding to store and load settings on the user profile though so that settings the plugins might have a shared between devices. (Maybe encrypt those somehow (user password? Though that would bring problems on password change) since they might contain login information or something)

      Use cases:
      probably endless tbh.
      I could imagine a password generator with ones own rule sets would be a good example for a computer widget by typing something like password 25 and you’ll get a nice 25 character random password.(feel free to incorporate that one actually)
      Basically small scripts like that would be predestined for computer plugins.

      For the big on site widget ones a personal example maybe:
      I thought it would be neat if I could scrap something like (https://na.finalfantasyxiv.com/lodestone/playguide/db/recipe/0e775b9dd31/) and display the recipe tree and where to find the stuff for FFXIV. Useful for me and probably another subset of people but way too much for an official Kagi widget so a custom one would be useful.

      Thinking farther it might be a good thing to have for corporations to though.
      They could define business related plugins and automatically distribute them to all their employees by means of corporate/team accounts.

      Hope that helps 🙂

      9 months later
      a year later

      Totally would love a widget API. Just today, when I asked Kagi about duration of the current daylight saving time phase in Germany, I noticed it does not display it easily, while Google has a widget for that. Shortly considered yet another feature suggestion here, but for such simple things, I'd probably would have programmed this myself faster than I'd written a proper feature suggestion.

      There could be a directory of user-installable widgets, as in this report, but Kagi could also include the most general widgets directly into the base product after some kind of review or so. You'd need trigger regions then also in addition to trigger words/topics though.

      DuckDuckGo had DuckDuckHack (https://github.com/duckduckgo?q=zeroclick) when it launched and made it possible to extend the search results, but in the end stopped the program, probably cause they made the mistake and allowed people to submit cheatsheets and static results, so they got bogged down in loads of trivial additions, which would better have been written as static text on a webpage somewhere, and attempts by people to gain more (SEO) visibility for niche stuff.

        2 months later

        There could be a Widget Store where users will upload those widgets and then they could add it trough website. Just like there are Chrome extensions.

        a month later

        I saw feature requests in the community for parcel tracking and more. Why not be the first search engine that has a plugin eco system?

        I could build my own widgets and share them with the community. I could add what I care for to my kagi search.

        Every user can tailor their search experience to their desire. For some, certain widgets are irrelevant. Others want widgets that don't yet exist. Wigdets based on 3rd parties could be written by these 3rd parties.

        This could be a game changer.

          iynaejVcJ Very cool idea. Would you take a hot at thinkng this through more deeply.

          What is the mechanism that would make it possible? How would it execute? How would you share it with others? How ould you prevent malicious use/abuse?

            What is the mechanism that would make it possible?

            I think, there would be some kind of search query matcher
            component. If the matcher returns true, the widget would be shown. The
            matcher could be a regular expression or some key words or something
            like that (regex being the most powerful, I suppose).

            The widget itself could work in many ways. Some ideas:

            • Frontend script
              • Could be either hosted by Kagi and added through a "plugin shop"
                OR could be added in the settings via copy paste
              • Upside: Easy to host, easy to write plugin
              • Downside:
              • API calls to third parties might be tricky due to cross
                side scripting constraints. They could be routed through a Kagi
                proxy though
              • In case of hosting by Kagi: Who reviews scripts?
              • In case of users adding script through copy/pasting into
                settings: Non-technical users might compromise themselves with
                unsafe scripts
            • Iframe that points to an third party website that provides the widget
              • Very powerful, APIs can be used, etc.
              • Downside:
              • Hosting cost of iframe content lies on the plugin developer
                • Incentive issue? Maybe we would need payed plugins then,
                  through a new "Kagi shop"? (potential revenue stream for
                  plugin dev and Kagi)
                • Review next to impossible, iframe content could change at any
                  time

            I thought about a few plugins/widgets that might be interesting to users (I am
            sure the community would have a million more ideas):

            • Weather
            • Maps
            • Parcel tracking
            • Flight tracking
            • Next Trains by train provider XY (e.g. Deutsche Bahn)
            • News from source XY
            • Calculator
            • TODO List application?
            • Chat GPT Search query enhancer (takes search query, suggests better
              search query)
            • Wikipedia, StackOverflow, HN, other website you frequent often...
            • Spotify Song Preview

            These ideas are not thought completely through, just a bit of brain
            storming.

              What about a Luau script? It could work like CGI, and the resulting HTML could be cleaned of any malicious stuff using a library (I know rust has ammonia, ruby probably has something similar). Luau is already sandboxed, so it might work out.

                Merged 4 posts from Kagi Plugins - Widgets that can be created by third parties and shared.
                  a month later

                  Chiming in to contribute to this idea!

                  Recently there has been couple users in Discord asking about Dall-e integration in assistant, but as this is something that is financially a problem for Kagi and out of scope as well, this could also be solved by the users with a plugin/widget system!

                  The plugin could ask the users to bring their own API key in some sort of settings page/code and just send an xmlhttprequest from the users computer with javascript to OpenAI's API for generating images. This could be interfaced like custom bangs.

                  The high level flow could be something like:

                  1. User does a search query - !dalle Tokyo skyline with green clouds.
                  2. Kagi recognizes this query from the users settings as something that should be intercepted by the plugin/widget system.
                  3. Kagi opens the search results page with no results (or maybe some on/off toggle in the plugin settings to make this more of an quick-answer like feature?), starts some sort of spinner to indicate to users that something is happening.
                  4. Kagi calls the plugin and the plugin queries the OpenAI's Dall-e API. The plugin then should format it's return value to some json format which Kagi provides schema for.
                  5. Kagi renders the results from the returned json value on the search page.

                  Would be fun to be able to integrate personal projects to Kagi like this as well for developers.

                  5 days later

                  Yes, this is something we want to do. Just to get through all the immediate bugs and we can start developing this (pretty significant) undertaking.

                  • zut likes this.
                  4 months later

                  Just want to throw my two cents in:

                  1. Really excited for this feature! Legitimately the reason that I changed to a Kagi subscriber
                  2. Even more so than keywords, I think "presence of a particular URL" on the first page is a critical use case. For instance, using the final fantasy example - perhaps it is keyed off the word "recipe". You would obviously want "Boar Leather recipe" to trigger your widget. But what about just "boar leather"? Presumably - yes. But that is harder to create a keyword regex for. Conversely, you don't want "banana bread recipe" to trigger the widget, since it's clear you're looking for a food recipe. However, if finalfantasyxiv.com shows up in the search results, you can use that as a trigger to understand that the user wants the FF recipe widget.
                  3. Building on the above, Diigo has (had?) the ability to simultaneously search your Diigo library when making a Google search request. I think this is a great feature, and I would potentially want to build this as a widget where any keyword search also embedded content from my bookmarks on the page (or ideally, alongside it). For such functionality, it really seems like it should run across all keywords.
                  • Vlad replied to this.

                    I was basically envisioning it as a "simultaneous search"

                    It's kind of like a custom lens, where Kagi would only return results that I have bookmarked in Diigo. Except, it would always show the first 5 results in a small box on the right side of the normal Kagi results.

                    In terms of how it would work:
                    Whenever I would do a keyword search, the widget would simultaneously do a search of my Diigo library. If there were any results returned by the Diigo search, it would display them in a small box either within the Kagi search results or off to the side.

                    For reference, Diigo API: https://www.diigo.com/api_dev

                    Of course, (while I would probably build this for fun), this example is primarily just to suggest that a use case for custom widgets is "simultaneously search another website and include those results"

                    But, building off of https://kagifeedback.org/d/1560-bookmarks, it could also be really interesting to hook into other websites/services (Diigo, Instapaper, Memex, Wallabag) as a "bookmarks provider".

                      6 months later

                      Added image for example. I remember watching the American election as it happened and was quite disappointed that Kagi didn't have such an integration like Google does here. I'm sure it wouldn't be easy but it would be necessary to meet feature parity with Google.

                      Plenty of time to work on it though. 4 years yet

                      Simple. The convenience of being able to quickly search and see results for elections within Kagi. While I think American elections (given population size and probably percentage of userbase) would be top priority. It would be nice to have. Similar to the widgets Google also has for Sports. Something to quickly search at a glance and get an update. Especially useful during an election where you are getting comparisons from multiple sources. Look at state by state cases, etc...

                        I think they're planning on adding some way for users to create and submit their own widgets. This would be a fun project for a member of the community to take on!

                        9 days later

                        Yes, I'll merge this thread with the main "custom" widgets thread.