#!/bin/bash # Toggle Conversation Service Control Script # This script creates/removes the conversation lock file to control AI conversation state # Set environment variables for GUI access export DISPLAY=${DISPLAY:-:1} export XAUTHORITY=${XAUTHORITY:-/run/user/1000/gdm/Xauthority} DICTATION_DIR="/mnt/storage/Development/dictation-service" DICTATION_LOCK_FILE="$DICTATION_DIR/listening.lock" CONVERSATION_LOCK_FILE="$DICTATION_DIR/conversation.lock" if [ -f "$CONVERSATION_LOCK_FILE" ]; then # Stop conversation rm "$CONVERSATION_LOCK_FILE" notify-send "🤖 Conversation Stopped" "AI conversation ended" echo "$(date): AI conversation stopped" >> /tmp/conversation.log else # Stop dictation if running, then start conversation if [ -f "$DICTATION_LOCK_FILE" ]; then rm "$DICTATION_LOCK_FILE" echo "$(date): Dictation stopped (conversation mode)" >> /tmp/dictation.log fi # Start conversation touch "$CONVERSATION_LOCK_FILE" notify-send "🤖 Conversation Started" "AI conversation mode enabled - Start speaking" echo "$(date): AI conversation started" >> /tmp/conversation.log fi