Skip to content

Instantly share code, notes, and snippets.

@andyHa
Created April 27, 2018 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andyHa/39266a71dc2e317005e8325dd09e2f80 to your computer and use it in GitHub Desktop.
Save andyHa/39266a71dc2e317005e8325dd09e2f80 to your computer and use it in GitHub Desktop.
My phoenix config
// Debug using log stream --process Phoenix
new Key('right', [ 'ctrl', 'cmd' ], function () {
var wnd = Window.focused();
if (!wnd) {
return;
}
if (!wnd.screen()) {
return;
}
var sortedScreens = Screen.all().sort((a, b) => a.frame().x < b.frame().x)
var index = sortedScreens.indexOf(wnd.screen());
if (index < 1) {
wnd.setFrame(wnd.screen().flippedVisibleFrame());
return;
}
wnd.setFrame(sortedScreens[index - 1].flippedVisibleFrame());
});
new Key('left', [ 'ctrl', 'cmd' ], function () {
var wnd = Window.focused();
if (!wnd) {
return;
}
if (!wnd.screen()) {
return;
}
var sortedScreens = Screen.all().sort((a, b) => a.frame().x < b.frame().x)
var index = sortedScreens.indexOf(wnd.screen());
if (index < 0 || index == sortedScreens.length - 1) {
wnd.setFrame(wnd.screen().flippedVisibleFrame());
return;
}
wnd.setFrame(sortedScreens[index + 1].flippedVisibleFrame());
});
new Key('up', [ 'ctrl', 'cmd' ], function () {
var wnd = Window.focused();
wnd.setFrame(wnd.screen().flippedVisibleFrame());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment