Open gibfahn opened 3 years ago
Which OS are you on?
I had tried it once, but I couldn't get it working reliably across all platforms. When you factor in the fact that many people run neovim inside their terminals, it becomes even harder.
I am considering to look into how raghur implemented in vim-ghost, but I don't think I will be working on this before June. I am really busy till June.
tl;dr - I will try, but not now.
I'm on macOS, on which I believe raghur has you set a variable like:
let g:ghost_darwin_app = 'kitty' " Tell vim-ghost which terminal to open.
and then to switch to the app it runs open -a kitty
. There's probably something more fancy that could be done with auto-detection of the parent process of the nvim process the plugin is running in, but that seems like a lot of work.
I don't think I will be working on this before June
No urgency on my side 😁 .
Just re-discovered this issue. :laughing:
I've left neovim and ghosttext long since, but I don't want to let this plugin rot unmaintained.
After reading raghur's code, it looks like this is the function he is using -
def _raise_window(self):
try:
if platform.system() == "Linux" and self.linux_window_id:
subprocess.call(["xdotool", "windowactivate",
self.linux_window_id])
logger.debug("activated window: %s", self.linux_window_id)
elif platform.system() == "Windows" and self.winapp:
logger.debug("WINDOWS: trying to raise window")
# dragons - this is the only thing that works.
try:
self.winapp.windows()[0].set_focus()
self.winapp.windows()[0].ShowInTaskbar()
except Exception as e:
logger.warning("Error during _raise_window, %s", e)
elif platform.system() == "Darwin" and self.darwin_app:
logger.debug("Darwin: trying to raise window")
subprocess.call(["osascript", "-e",
'tell application "' + self.darwin_app +
'" to activate'])
except Exception as e:
# with vim yarp etc - letting an exception escape messes
# with other plugins. so catch everything
logger.debug("error while activating window - %s" % e)
Looks like in macOS it uses some osascript
program to raise the window. I'll have to take a look
@gibfahn Are you still using this plugin? If so, I will consider implementing this feature. Else, I shall keep it open for any future contributors as a "Good First Issue"
Are you still using this plugin? If so, I will consider implementing this feature
Totally missed this, yes I'm still using the plugin. I have an easy shortcut to switch to my terminal though, so this isn't high-priority for me.
Just came across this app, works ideally on my machine without dependencies.
One nice thing that vim-ghost does is automatically switching to nvim when you hit the ghost button in your browser (https://github.com/raghur/vim-ghost#auto-switching-to-vim).
Would be nice to have the same functionality in this plugin.