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

Window.open should allow you to pick a screen #2384

Closed
adam-lynch opened this issue Sep 24, 2014 · 15 comments
Closed

Window.open should allow you to pick a screen #2384

adam-lynch opened this issue Sep 24, 2014 · 15 comments
Labels

Comments

@adam-lynch
Copy link

I guess by passing in a screen (/ screen ID) from the Screen API. The coordinates you give then should be relative to that screen. Should be optional & defaults to the current screen (where the app is placed) / the "primary" one (see #2383).

But then I guess if this was added, then there should also be a function to move a window to another screen (again by passing a screen / ID).

Related: #2178

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@adam-lynch
Copy link
Author

Example use case: custom notifications

@adam-lynch
Copy link
Author

Looking at what gui.Screen.screens returns again and it seems that the primary screen's bounds.x and bounds.y are 0. Can someone confirm if this is always the case?

EDIT

I actualy meant to post this as a reply to #2383

@Destreyf
Copy link

adam, the way that i found works best for detecting the workspace, is by taking the screen with work_area less than bounds. This works on Windows, Mac and Ubuntu 14.04 tested.

@adam-lynch
Copy link
Author

@Destreyf But on my Windows setup here the taskbar goes across all screens. Also, a colleague told me yesterday that the Mac menu / context bar can be on multiple screens since Mavericks (previously used to denote the primary screen).

@matthiasg
Copy link

@adam-lynch if your taskbar really goes across all screens (e.g start button all the way on the left monitor, clock all the way on the right), then your graphics driver is setup as one big monitor and is not really using multi monitor support of windows per se. Its just one big desktop from the perspective of the applications. This would affect every app (such as e.g. lightroom) that has multi monitor features. This mode in the graphics card settings often doesnt make any sense.

@adam-lynch
Copy link
Author

@matthiasg No, my starts button is on every screen and the clock is on the middle screen. This is a Windows feature.

@adam-lynch
Copy link
Author

image

@matthiasg
Copy link

then you have multiple taskbars .. that's ok of course then you indeed have multiple true screens … i understood it such that you have one long taskbar (which would be a driver feature).

But in that case there isn't much of an issue since you can position a window globally … e.g setting it to -1000,0 would position it on the left of the primary screen ..

in combination with screen geometry that would get you started..

admittedly it would be extremely helpful to move this very common use cases into node-webkit to prevent people from re-implementing this over and over .. or a common external library that does the calculation and were required into the app could help too..

From: Adam Lynch
Sent: ‎Tuesday‎, ‎October‎ ‎28‎, ‎2014 ‎11‎:‎34‎ ‎AM
To: rogerwang/node-webkit
Cc: mgt576@gmail.com

@matthiasg No, my starts button is on every screen and the clock is on the middle screen. This is a Windows feature.


Reply to this email directly or view it on GitHub.

@adam-lynch
Copy link
Author

But in that case there isn't much of an issue since you can position a window globally … e.g setting it to -1000,0 would position it on the left of the primary screen ..

Not always. See #1152.

@matthiasg
Copy link

The other ticket is talking about off screen .. Which might mean outside the screen area as defined by all monitors.. It might also mean off the primary screen.. Do you have more info on that ?

-----Original Message-----
From: "Adam Lynch" notifications@github.com
Sent: ‎28.‎10.‎2014 17:46
To: "rogerwang/node-webkit" node-webkit@noreply.github.com
Cc: "matthiasg" mgt576@gmail.com
Subject: Re: [node-webkit] Window.open should allow you to pick a screen(#2384)

But in that case there isn't much of an issue since you can position a window globally … e.g setting it to -1000,0 would position it on the left of the primary screen ..
Not always. See #1152.

Reply to this email directly or view it on GitHub.=

@adam-lynch
Copy link
Author

I created #2391 myself. To me, screen is an individual screen, the same meaning the screen API uses.

@matthiasg
Copy link

I will try to recreate that with the 0.11 rc1 when I can then .. I will need some sensible multi monitor functionality relatively soon as we are starting to port our current medical image viewing application. I would assume a common library on top of NW would make sense, but that does require that positioning windows across all screens works of course

-----Original Message-----
From: "Adam Lynch" notifications@github.com
Sent: ‎28.‎10.‎2014 20:02
To: "rogerwang/node-webkit" node-webkit@noreply.github.com
Cc: "matthiasg" mgt576@gmail.com
Subject: Re: [node-webkit] Window.open should allow you to pick a screen(#2384)

I created #2391 myself. To me, screen is an individual screen, the same meaning the screen API uses.

Reply to this email directly or view it on GitHub.=

@donaldpipowitch
Copy link

Maybe related #180? Its a little bit confusing, because most terms sound so similar (window, screen, desktop, monitor...)

@fritx
Copy link

fritx commented Jan 20, 2016

// Calculating for new win screen/position
const depWin = global._wins['home'] ||
  global._wins['login'] || win
const winCX = depWin.x + depWin.width / 2
const winCY = depWin.y + depWin.height / 2
const curScr = _.find(screens, (scr) => {
  const { x, y, width, height } = scr.bounds
  return winCX >= x && winCX < x + width &&
    winCY >= y && winCY < y + height
}) || screens[0] // todo: Some more calculating
const wrkCX = curScr.work_area.x + curScr.work_area.width / 2
const wrkCY = curScr.work_area.y + curScr.work_area.height / 2
opt.x = wrkCX - opt.width / 2
opt.y = wrkCY - opt.height / 2

@stale
Copy link

stale bot commented Nov 6, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 6, 2017
@stale stale bot closed this as completed Nov 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants