raghur / vim-ghost

Vim/Nvim client for GhostText - Edit browser text areas in Vim/Neovim
333 stars 13 forks source link

Potential Kitty Support? #43

Open the10thWiz opened 3 years ago

the10thWiz commented 3 years ago

The kitty terminal implements a remote control protocol that allows programs running within a kitty window to control a kitty instance.

It would be nice to implement this in vim-ghost, as an alternative to xdotool for auto-focusing the vim window. The following code snippet raises the current window, although it does require Kitty to be configured for remote control (obviously) and to listen on a specific port. The port kitty is listening on is provided via the environment variable, but it would be ideal if we can also avoid this dependency.

function! Focus()
  if getenv('KITTY_LISTEN_ON') != v:null
    silent ! kitty @ focus-window
    return v:true
  else
    return v:false
  endif
endfunction

This should be reasonably easy to port to Python, and we may be able to remove the reliance on kitty listening.

I am willing to work on this. The idea is that this would be checked before attempting to use xdotool, and should only require the user to enable remote control in kitty.