#!/bin/bash

# Manual Keybinding Setup for GNOME
# This script sets up the keybinding using the proper GNOME schema format

TOGGLE_SCRIPT="/mnt/storage/Development/dictation-service/toggle-dictation.sh"

echo "Setting up dictation service keybinding manually..."

# Create a custom keybinding using gsettings with proper path
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name "Toggle Dictation"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command "$TOGGLE_SCRIPT"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding "<Alt>d"

# Add to the list of custom keybindings
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']"

echo "Keybinding setup complete!"
echo "Press Alt+D to toggle dictation service"
echo ""
echo "To verify the keybinding:"
echo "gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings"
echo ""
echo "To remove this keybinding:"
echo "gsettings reset org.gnome.settings-daemon.plugins.media-keys custom-keybindings"