Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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);
- }
- });
Add Comment
Please, Sign In to add comment