I made a small tool called LLM Key that lets you run queries for large language models like openai, Xai and ollama from anywhere on your computer. It creates a system tray icon and then when you press ctrl+alt+o it pops up a window to get an LLM query, and then runs this query in the background.
I’m generally interested in the topic of HCI and AI.
Internals
Feels like something someone else should have done before but they don’t seem to have. I’d hacked up scripts to do something similar before using zenity, but decided to make something a bit more “official” and maintained. I use pynput, tkinter, and pystray for the functionality that made it fairly straightforward. Mostly an exercise in arranging tkinter widgets.
A few things that were interesting in working on this. I ended up kind of using an “event bus” from e.g. the shortcut detection code in pynput and a background thread that ran the LLM queries to the main tkinter thread to handle things. This was more or less the suggested way of doing things.
I created a separate menu for “advanced usage” that worked by having a global shortcut to open the menu and then using tkinter bindings to read another key. This created keychains like you can use in emacs, while also providing the user with visual feedback. This might be a nice approach in general.