# Script pour verifier la configuration Tridactyl # Verifie que les fichiers de configuration sont au bon endroit et accessibles $ErrorActionPreference = "Continue" Write-Host "=== Verification de la configuration Tridactyl ===" -ForegroundColor Cyan Write-Host "" # 1. Verifier le fichier tridactyl.json pour le native messenger Write-Host "1. Verification du Native Messenger (tridactyl.json)..." -ForegroundColor Yellow $nativeMessengerPath = "$env:APPDATA\Mozilla\NativeMessagingHosts\tridactyl.json" $sourcePath = "$env:USERPROFILE\.tridactyl\tridactyl.json" if (Test-Path $nativeMessengerPath) { Write-Host " [OK] Fichier trouve: $nativeMessengerPath" -ForegroundColor Green # Verifier le contenu try { $content = Get-Content $nativeMessengerPath -Raw | ConvertFrom-Json Write-Host " [OK] Fichier JSON valide" -ForegroundColor Green Write-Host " - Nom: $($content.name)" -ForegroundColor Gray Write-Host " - Type: $($content.type)" -ForegroundColor Gray # Verifier que le path pointe vers un executable valide if ($content.path) { $exePath = $content.path # Si c'est un chemin relatif, chercher dans le repertoire .tridactyl if (-not [System.IO.Path]::IsPathRooted($exePath)) { $fullExePath = Join-Path (Split-Path $sourcePath -Parent) $exePath } else { $fullExePath = $exePath } if (Test-Path $fullExePath) { Write-Host " [OK] Executable trouve: $fullExePath" -ForegroundColor Green } else { Write-Host " [ERREUR] Executable introuvable: $fullExePath" -ForegroundColor Red } } } catch { Write-Host " [ERREUR] Erreur lors de la lecture du JSON: $_" -ForegroundColor Red } } else { Write-Host " [ERREUR] Fichier introuvable: $nativeMessengerPath" -ForegroundColor Red Write-Host " -> Le fichier doit etre copie depuis: $sourcePath" -ForegroundColor Yellow if (Test-Path $sourcePath) { Write-Host " -> Voulez-vous creer le lien maintenant? (O/N)" -ForegroundColor Yellow $response = Read-Host if ($response -eq 'O' -or $response -eq 'o') { $nativeDir = Split-Path $nativeMessengerPath -Parent if (-not (Test-Path $nativeDir)) { New-Item -ItemType Directory -Path $nativeDir -Force | Out-Null Write-Host " [OK] Repertoire cree: $nativeDir" -ForegroundColor Green } Copy-Item -Path $sourcePath -Destination $nativeMessengerPath -Force Write-Host " [OK] Fichier copie vers: $nativeMessengerPath" -ForegroundColor Green } } else { Write-Host " [ERREUR] Fichier source introuvable: $sourcePath" -ForegroundColor Red } } Write-Host "" # 2. Verifier le fichier .tridactylrc Write-Host "2. Verification du fichier de configuration (.tridactylrc)..." -ForegroundColor Yellow $tridactylrcPath = "$env:USERPROFILE\.tridactylrc" if (Test-Path $tridactylrcPath) { Write-Host " [OK] Fichier trouve: $tridactylrcPath" -ForegroundColor Green $lineCount = (Get-Content $tridactylrcPath | Measure-Object -Line).Lines Write-Host " - Nombre de lignes: $lineCount" -ForegroundColor Gray # Afficher un apercu $preview = Get-Content $tridactylrcPath -First 5 if ($preview) { Write-Host " Apercu (5 premieres lignes):" -ForegroundColor Gray foreach ($line in $preview) { Write-Host " $line" -ForegroundColor DarkGray } } } else { Write-Host " [ATTENTION] Fichier introuvable: $tridactylrcPath" -ForegroundColor Yellow Write-Host " -> Ce fichier est optionnel mais recommande pour personnaliser Tridactyl" -ForegroundColor Gray Write-Host " -> Vous pouvez le creer avec des commandes comme:" -ForegroundColor Gray Write-Host " set searchengine google" -ForegroundColor DarkGray Write-Host " bind J tabnext" -ForegroundColor DarkGray Write-Host " bind K tabprev" -ForegroundColor DarkGray } Write-Host "" # 3. Instructions pour verifier dans Firefox Write-Host "3. Instructions pour verifier dans Firefox:" -ForegroundColor Yellow Write-Host " a) Ouvrez Firefox" -ForegroundColor Gray Write-Host " b) Appuyez sur ':' pour ouvrir la ligne de commande Tridactyl" -ForegroundColor Gray Write-Host " c) Tapez ':version' pour voir la version de Tridactyl" -ForegroundColor Gray Write-Host " d) Tapez ':native' pour verifier la connexion au native messenger" -ForegroundColor Gray Write-Host " e) Tapez ':source' pour recharger la configuration depuis .tridactylrc" -ForegroundColor Gray Write-Host " f) Tapez ':get searchengine' pour voir le moteur de recherche configure" -ForegroundColor Gray Write-Host "" Write-Host "=== Verification terminee ===" -ForegroundColor Cyan