Created
June 20, 2018 06:54
-
-
Save andyHa/0f7e3ebab503acd70b4fb16e9496ad61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Debug using /usr/bin/log stream --process Phoenix | |
new Key('right', [ 'ctrl', 'cmd' ], function () { | |
try { | |
Phoenix.log("Right") | |
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()); | |
} catch(e) { | |
Phoenix.log(e); | |
} | |
}); | |
new Key('left', [ 'ctrl', 'cmd' ], function () { | |
try { | |
Phoenix.log("Left") | |
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()); | |
} catch(e) { | |
Phoenix.log(e); | |
} | |
}); | |
new Key('up', [ 'ctrl', 'cmd' ], function () { | |
try { | |
Phoenix.log("Up") | |
var wnd = Window.focused(); | |
wnd.setFrame(wnd.screen().flippedVisibleFrame()); | |
} catch(e) { | |
Phoenix.log(e); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment