mhinz / neovim-remote

:ok_hand: Support for --remote and friends.
MIT License
1.73k stars 83 forks source link

Bring neovim-qt to front #164

Open MartyLake opened 3 years ago

MartyLake commented 3 years ago

Hello, Not sure if correct repo to kindly ask for a new feature (or maybe I can't read the manual?).

Would it be possible to bring neovim-qt (win32) to the front when calling nvr ? It would save me one alt-tab at each context switch :) Best

mhinz commented 3 years ago

I use neither neovim-qt nor Windows and I assume bringing a GUI application to the front requires some kind of Windows-specific scripting (batch file or powershell script).

Also I'm not sure if it should be part of neovim-remote in the first place. It sounds as if you wanted a wrapper script that first calls nvr and then does some magic to bring the application to the front.

So, this won't happen unless someone else makes a PR for it. :)

MartyLake commented 3 years ago

Makes sense ! =) At least this wish is registered now, maybe someone with strong win32-fu can make it happen eventually.

newptcai commented 2 years ago

Is there any gui of neovim for which this works?

newptcai commented 2 years ago

The following script should work

#!/bin/bash                                                                                                                                                                                   

# Check if neovim-qt is running                                                                                                                                                               
if pgrep -x "nvim-qt" > /dev/null                                                                                                                                                             
then                                                                                                                                                                                          
    # echo "nvim-qt is running"                                                                                                                                                               
    # If it is, use nvr to connect to it and bring it to front                                                                                                                                
    nvr --remote-tab-silent "$@"                                                                                                                                                              
    wmctrl -a Neovim                                                                                                                                                                          
else                                                                                                                                                                                          
    # echo "nvim-qt is not running"                                                                                                                                                           
    # If not, start a new one                                                                                                                                                                 
    nvim-qt -- --listen /tmp/nvimsocket "$@"                                                                                                                                                  
fi