feat: focus follows click, composer key intents

Remove focus reclaim (watchFocus/reclaim/timer), debug notice and the
Ctrl+C binding (Ctrl+C is copy). Add pure keyIntent (keys.js) and route
Enter/Escape/menu keys through it; bind ctrl-r, ctrl-enter, alt-enter,
escape. install.ps1: merge ctrl-shift-space into keys.json (backup),
relink wrong junction, warn on failed layout.switch.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
FactorandClaude Sonnet 5.5 committed 2026-11-19 11:10:01 +01:00
1 parent c05e252d79
commit 5761825ac8
4 files changed
+238 -129

No files matched your search

+40 -4
View File
@@ -35,9 +35,34 @@ function Remove-Junction([string]$Path) {
if ($LASTEXITCODE -ne 0) { throw "rmdir failed for $Path" }
}
# Task 2 adds the key binding here (keys.json.bak-$Stamp is taken first).
# Merge "ctrl-shift-space": "ovis-composer.focus" into keys.json "global",
# leaving every other entry alone. Backs the file up once; idempotent.
function Install-KeyEntry {
# TODO(Task 2): back up keys.json once as $KeysBak, then add the entry.
$chord = 'ctrl-shift-space'
$action = 'ovis-composer.focus'
if (-not (Test-Path -LiteralPath $KeysFile)) {
$obj = [pscustomobject]@{ global = [pscustomobject]@{ $chord = $action } }
} else {
$raw = [IO.File]::ReadAllText($KeysFile)
$obj = $raw | ConvertFrom-Json
if ($obj -isnot [pscustomobject]) { throw "keys.json is not a JSON object - resolve by hand." }
if (-not $obj.PSObject.Properties['global']) {
$obj | Add-Member -NotePropertyName 'global' -NotePropertyValue ([pscustomobject]@{})
}
$global = $obj.global
if ($global.PSObject.Properties[$chord] -and $global.$chord -eq $action) {
Write-Host "keys.json already has $chord"
return
}
if (-not (Test-Path -LiteralPath $KeysBak)) {
Copy-Item -LiteralPath $KeysFile -Destination $KeysBak
Write-Host "Backed up keys.json to $KeysBak"
}
$global | Add-Member -NotePropertyName $chord -NotePropertyValue $action -Force
}
$json = $obj | ConvertTo-Json -Depth 32
[IO.File]::WriteAllText($KeysFile, $json, (New-Object Text.UTF8Encoding($false)))
Write-Host "keys.json: $chord -> $action"
}
if ($Uninstall) {
@@ -61,13 +86,24 @@ if ($Uninstall) {
Write-Host "Restored keys.json"
}
herdr-app do layout.switch '{"name":"main"}'
if ($LASTEXITCODE -ne 0) { Write-Warning "layout.switch to main failed (exit $LASTEXITCODE) - switch the layout by hand." }
exit 0
}
# 1. Mod directory -> junction to the repo.
$relink = $false
if (Test-Junction $Junction) {
Write-Host "Junction already in place: $Junction"
} else {
$target = (Get-Item -LiteralPath $Junction -Force).Target
if ($target -is [array]) { $target = $target[0] }
if ($target -and ([IO.Path]::GetFullPath($target).TrimEnd([char]92) -ieq [IO.Path]::GetFullPath($ModSource).TrimEnd([char]92))) {
Write-Host "Junction already in place: $Junction"
} else {
Write-Host "Junction points at '$target' - recreating it for $ModSource"
Remove-Junction $Junction
$relink = $true
}
} else { $relink = $true }
if ($relink) {
if (Test-Path -LiteralPath $Junction) {
if (Test-Path -LiteralPath $ModBackup) { throw "$ModBackup already exists - resolve by hand." }
Move-Item -LiteralPath $Junction -Destination $ModBackup