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

How can I switch focus between monitors #458

Open
simon-xia opened this issue Dec 4, 2015 · 3 comments
Open

How can I switch focus between monitors #458

simon-xia opened this issue Dec 4, 2015 · 3 comments

Comments

@simon-xia
Copy link

the default config
cmd + right and cmd + left seems only works on apps

So, how can I switch focus between monitors

@mattr-
Copy link

mattr- commented Dec 7, 2015

Slate doesn't have anything in the way of multiple monitor support. I've been needing the same thing myself lately, so this may appear soon. Need to dive back into the code again.

@bemyhre
Copy link

bemyhre commented Mar 21, 2016

I would really like to see this as well. This would be wonderful.

@ashaffer
Copy link

I've written a script that does this with slate (and also lets you focus the window behind):

slate.bind('up:ctrl', function(win) {
  win.doOperation('focus', {
    direction: 'behind'
  });
});

slate.bind('down:ctrl', function(win) {
  win.doOperation('focus', {
    direction: 'behind'
  });
});

slate.bind('left:ctrl', function() {
  var wnd = getScreenForegroundWindow('0');
  wnd && wnd.focus();
});

slate.bind('right:ctrl', function() {
  var wnd = getScreenForegroundWindow('1');
  wnd && wnd.focus();
});

function getScreenForegroundWindow(id) {
  var center = getRectCenter(slate.screenForRef(id).rect());
  return slate.windowUnderPoint(center);
}

function getRectCenter(rect) {
  return {
    x: rect.x + rect.width/2,
    y: rect.y + rect.height/2
  };
}

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

No branches or pull requests

4 participants