Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: enable automatically switching to Neovim #35

Open
gibfahn opened this issue Mar 21, 2021 · 4 comments
Open

Feature Request: enable automatically switching to Neovim #35

gibfahn opened this issue Mar 21, 2021 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed needs design We haven't thought yet how we'd go about fixing this issue

Comments

@gibfahn
Copy link

gibfahn commented Mar 21, 2021

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.

@subnut
Copy link
Owner

subnut commented Mar 21, 2021

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.

@gibfahn
Copy link
Author

gibfahn commented Mar 22, 2021

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 😁 .

@subnut subnut added the enhancement New feature or request label Mar 23, 2021
@subnut subnut added the help wanted Extra attention is needed label Jul 11, 2021
@subnut
Copy link
Owner

subnut commented Feb 11, 2022

Just re-discovered this issue. 😆

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"

@subnut subnut added the good first issue Good for newcomers label Feb 11, 2022
@gibfahn
Copy link
Author

gibfahn commented Mar 13, 2023

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.

@subnut subnut added needs design We haven't thought yet how we'd go about fixing this issue and removed good first issue Good for newcomers labels Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed needs design We haven't thought yet how we'd go about fixing this issue
Projects
None yet
Development

No branches or pull requests

2 participants