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

Active screen #131

Closed
luisdavim opened this issue Feb 22, 2017 · 19 comments · Fixed by #416
Closed

Active screen #131

luisdavim opened this issue Feb 22, 2017 · 19 comments · Fixed by #416

Comments

@luisdavim
Copy link

I use a multi-head setup and cerebro always starts on the main screen (usually the laptop's built in monitor) it would be great if cerebro could be displayed on the active monitor, it could either follow the mouse or the window that has focus.

@maximbaz
Copy link
Contributor

This feature was implemented a while ago, and it works fine for me on Linux. I know @KELiON also tested on his Mac. Maybe you discovered a bug. But first, what OS do you use? Do you have the latest version installed?

@luisdavim
Copy link
Author

I'm on macOS Sierra 10.12.3 running cerebro 0.2.6 that I installed with brew cask.

@matmunn
Copy link
Contributor

matmunn commented Feb 22, 2017

I'm on macOS 10.12.4 running Cerebro 0.2.5 installed from the .dmg on the releases page and I can confirm that I only get the cerebro window on my main monitor.

@maximbaz
Copy link
Contributor

Guys I've just realized that I misread the description, sorry! The feature I mentioned was about remembering the window position, instead of being always displayed on the primary screen. That is, if you move a window to a different screen, next time it will start there. But unfortunately there is no electron API to detect the active screen, or I didn't find one.

@matmunn
Copy link
Contributor

matmunn commented Feb 22, 2017

In that case I can confirm that it remembers the active screen on macOS 10.12.4 ;)

@luisdavim
Copy link
Author

Hi,
Sorry if I didn't expressed myself correctly.
I never used electron so this may be rubbish but I think you could use '''screen.getCursorScreenPoint()''' to get the cursor position and then '''screen.getDisplayNearestPoint(point)''' to get the display does that makes sense?

https://github.com/electron/electron/blob/master/docs/api/screen.md

Luis

@maximbaz
Copy link
Contributor

I think that's a good idea on how to follow a mouse, though I personally would rather prefer to follow a screen that has focused window... if there was such API.

@luisdavim
Copy link
Author

Alfred has both options and I was using "follow active screen" and then switched to "screen containing mouse" and I actually prefer that.
For me it would be great if you could add this option.
Thanks.

@maximbaz
Copy link
Contributor

I think long-term we should target having both options as well, and for now since we know how to implement "follow the mouse" it should be added right away 👍

@luisdavim
Copy link
Author

Awesome, thanks.

@KELiON
Copy link
Collaborator

KELiON commented Feb 23, 2017

@luisdavim I couldn't find these options in Alfred. Is it somewhere in settings?

@luisdavim
Copy link
Author

@KELiON it's under the appearance tab on the theme options (button on the bottom left).
screen shot 2017-02-23 at 2 43 30 pm

@KELiON
Copy link
Collaborator

KELiON commented Feb 23, 2017

@luisdavim now I see, thanks. I have only one concern: how can it work together with "save position" option? I.e. case:

  1. Check "save position" checkbox;
  2. Move window somewhere on screen 1 and hide the window;
  3. Move cursor to screen 2 and use shortcut to show window;
  4. Where the window should appear?

I'd try to find some universal solution. I don't like too much configuration options and I think that the more configuration options users have, the less they use.

@luisdavim
Copy link
Author

with one of these options enabled, follow mouse or active window the position that is saved is relative to the monitor instead of absolute across all monitors.

@Kageetai
Copy link
Contributor

Hmm maybe do it similar to Alfred and have an exclusive option to either follow mouse or save position?!

@luisdavim
Copy link
Author

I would say, with follow mouse enabled, you save the position relative to the screen, if not, you save the absolute position. That way you only need a toggle to follow mouse or not and the default behaviour is kept.
What do you think?

@maximbaz
Copy link
Contributor

There's no need to have exclusive mode, now we detect a primary screen and save position based on its ID, if the "follow cursor" mode is enabled, we could just use exactly the same algorithm but base it on the "detected screen". That way, you could choose favorite positions on each of your screens, and they all will be remembered.

@maximbaz
Copy link
Contributor

maximbaz commented Feb 23, 2017

To give you some context, this is the logic of storing the window position after it was moved. As you can see, the primary screen is detected, and its ID is used to save the position in the config. Supply it with "active" display instead, and the position will be stored for that screen.

Here is how the window position is restored, again it is based on the primary screen, replace it with "active" one to load the proper position.

@luisdavim
Copy link
Author

That sounds like an awesome idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants