30 lines
870 B
Bash
Executable File
30 lines
870 B
Bash
Executable File
#!/bin/sh
|
|
# ollie-ask: one-shot prompt helper for Dolphin service menus
|
|
# Usage: ollie-ask <file_or_dir> [prompt_prefix]
|
|
|
|
TARGET="$1"
|
|
PREFIX="${2:-Describe and explain this file:}"
|
|
PROMPT="$PREFIX $TARGET"
|
|
|
|
# Use Generate one-shot via 9P (no session required)
|
|
RESULT=$(echo "$PROMPT" | ollie-9p rdwr generate 2>/dev/null)
|
|
|
|
if [ -z "$RESULT" ]; then
|
|
notify-send "Ollie" "No response (is olliesrv running?)"
|
|
exit 1
|
|
fi
|
|
|
|
# Show result
|
|
TMPFILE=$(mktemp /tmp/ollie-ask.XXXXXX)
|
|
printf '%s' "$RESULT" > "$TMPFILE"
|
|
|
|
if command -v kdialog > /dev/null 2>&1; then
|
|
kdialog --title "Ollie — $(basename "$TARGET")" --textbox "$TMPFILE" 600 400
|
|
elif command -v zenity > /dev/null 2>&1; then
|
|
zenity --text-info --title="Ollie — $(basename "$TARGET")" --width=600 --height=400 --filename="$TMPFILE"
|
|
else
|
|
notify-send -t 30000 "Ollie" "$RESULT"
|
|
fi
|
|
|
|
rm -f "$TMPFILE"
|