rizzatti / dash.vim

Search Dash.app from Vim
MIT License
995 stars 59 forks source link

Focusing back MacVim windows after searching for a term in Dash. #30

Closed zeroDivisible closed 10 years ago

zeroDivisible commented 10 years ago

Hi there!

Currently I had introduced a nasty hack in my dash#search(bang, ...) function: at the end of it I had added:

  sleep 200m
  call foreground()

which effectively searches for a term in Dash and then focuses MacVim window back, saving me the need to press Option-Tab to go back. That relatively minor change makes the whole flow of displaying documentation way swifter.

If you could provide me with some guidance for finding a proper solution for this (and if you think that this is a worthy feature), I might work on adding :DashBack function (or something like that) which bounces back to MacVim window after searching.

What's your opinion about this?

Cheers!

rizzatti commented 10 years ago

I have always ran Dash in HUD mode, so this had never really crossed my mind. But I guess going back and forth can be a bit of pain for those using it as a normal application. One way I could see myself doing that would be if I had 2 monitors connected most times, I might let Dash be opened constantly in one of them.

I would have no problem implementing some solution to this if it does bother some users :)

@zeroDivisible would you know of any other plugins that call upon other apps or trigger something in the background (losing vim's focus) and get it back after some time, so that I could check how is it they do this? I can't think of any right now.

crokobit commented 10 years ago

It does bother me . Any solution?

jcelliott commented 9 years ago

I've been using Zeal and zeavim on Linux. That plugin does essentially the same thing as dash.vim without losing focus on vim.

rizzatti commented 9 years ago

This is not a problem in dash.vim. It's an issue in Dash.app, which will not stay in the background. Once a command is issued to Dash, it always comes to the foreground.

Kapeli commented 9 years ago

The only way right now to call Dash while also keeping it in the background is by using the Alfred-workflow binary. I can give you instructions on how to do that if you want to take that route, but I don't really recommend it.

I can add an arg to dash-plugin:// in the next Dash update to support background calls. Is this something you'd want to support in your plugin @rizzatti? It would require a separate hotkey or an option somewhere.

rizzatti commented 9 years ago

@Kapeli Hi. I'm not sure how the whole Alfred thing works. I use Alfred myself, but would that require the users to have it installed too? I think the arg option for dash-plugin might be the way to go. I already use "open -g" today (I think you were the one that sent that PR :), and -g states that it should keep things in the background, but that does not help. It appears some people like leaving Dash opened in a second monitor, in the normal non-HUD window mode. And giving it focus can be a bit annoying when being used that way, @Kapeli.

Kapeli commented 9 years ago

I already use "open -g" today (I think you were the one that sent that PR :), and -g states that it should keep things in the background, but that does not help.

Yes. The -g allows Dash to decide on its own whether or not to activate itself. Currently it always does that, except when an iOS remote is used.

I'll add support for an arg option for this in the next Dash update. However, please note that you should not make Dash not activate by default. It needs to be a separate option.

rizzatti commented 9 years ago

I'll leave it as an option to be configured in dash.vim, disabled by default.

Kapeli commented 9 years ago

Starting with the next Dash update, you'll be able to add &prevent_activation=true to dash-plugin:// to make Dash not activate.

rizzatti commented 9 years ago

@Kapeli Thanks. I'll implement that asap.

rizzatti commented 8 years ago

Just pushed a new option (g:dash_activate) that will allow Dash.app not to come to the foreground.