Just in case someone else wants a bang for cooljugator, or runs into some other limitation on what can be done with bangs, I solved this by making a script for rofi instead, which is a universal launcher for linux. It's vibe coded (one-shotted by opus in kagi assistant) but I read the source and checked it works:
#!/usr/bin/env python3
"""
Rofi script for searching Russian words on Cooljugator.
Usage:
rofi -modi "Verbs:./cooljugator-rofi.py verb,Nouns:./cooljugator-rofi.py noun,Adjectives:./cooljugator-rofi.py adjective" \
-show Verbs
Dependencies: python3, python-requests, rofi, chromium
"""
import sys
import os
import subprocess
import requests
API_PATHS = {"verb": "ru", "noun": "run", "adjective": "rua"}
BASE_API = "https://conjugation.pw/search"
BASE_URL = "https://cooljugator.com"
BROWSER = "chromium --new-window"
def search(query, mode):
"""Query the Cooljugator search API and return results."""
api_path = API_PATHS.get(mode, "ru")
try:
resp = requests.get(f"{BASE_API}/{api_path}/{query}", timeout=5)
return resp.json().get("results", [])
except Exception:
return []
def show_results(query, results, mode):
"""Print search results for rofi."""
if results:
print(f"\0message\x1fResults for \"{query}\" ({mode}s)")
print(f"\0prompt\x1fSelect")
for r in results:
url = BASE_URL + r["url"]
print(f"{r['title']} — {r['description']}\0info\x1f{url}")
else:
print(f"\0message\x1fNo results for \"{query}\". Type another word and press Enter.")
print(f"\0prompt\x1f{mode.capitalize()}")
print(f"No results for \"{query}\"\0nonselectable\x1ftrue")
def main():
mode = sys.argv[1] if len(sys.argv) > 1 else "verb"
selected = sys.argv[2] if len(sys.argv) > 2 else ""
retv = int(os.environ.get("ROFI_RETV", "0"))
info = os.environ.get("ROFI_INFO", "")
if retv == 0:
# Initial call
print(f"\0message\x1fType a Russian word and press Enter to search")
print(f"\0prompt\x1f{mode.capitalize()}")
elif retv == 1:
# User selected an entry
if info:
subprocess.Popen(BROWSER.split() + [info], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
else:
query = selected.split(" — ")[0].strip()
if query:
show_results(query, search(query, mode), mode)
elif retv == 2:
# User typed custom text
query = selected.strip()
if query:
show_results(query, search(query, mode), mode)
if __name__ == "__main__":
main()
and shell script to run rofi:
#!/bin/sh
SCRIPT="cooljugator-rofi.py"
rofi \
-modi "Verbs:${SCRIPT} verb,Nouns:${SCRIPT} noun,Adjectives:${SCRIPT} adjective" \
-show Verbs \
-matching fuzzy \
-theme-str 'window {width: 40%;}'
then just bind that script to some keyboard shortcut in your window manager for a quick pop up search for russian conjugations and declensions.