Created
August 22, 2022 08:05
-
-
Save jeanlaurent/386fe53b26bfcd34d34f20692f4b4547 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
// JL's config for https://github.com/kasper/phoenix | |
// https://github.com/kasper/phoenix/blob/master/docs/API.md#javascript-api | |
// Press Command-Option-1 get the currently focused window taking half screen docked on the right | |
Key.on('1', [ 'command', 'option' ], () => { | |
var focusedWindow = Window.focused(); | |
if (!focusedWindow) { | |
return; | |
} | |
focusedWindow.setFrame({ | |
x:focusedWindow.screen().frame().x, | |
y:focusedWindow.screen().frame().y, | |
width: focusedWindow.screen().frame().width/2, | |
height:focusedWindow.screen().frame().height | |
}); | |
}); | |
// Press Command-Option-2 get the currently focused window taking "full screen" | |
Key.on('2', [ 'command', 'option' ], () => { | |
var focusedWindow = Window.focused(); | |
if (!focusedWindow) { | |
return; | |
} | |
focusedWindow.setFrame({ | |
x:focusedWindow.screen().frame().x, | |
y:focusedWindow.screen().frame().y, | |
width: focusedWindow.screen().frame().width, | |
height:focusedWindow.screen().frame().height | |
}); | |
}) | |
// Press Command-Option-3 get the currently focused window taking half screen docked on the left | |
Key.on('3', [ 'command', 'option' ], () => { | |
var focusedWindow = Window.focused(); | |
if (!focusedWindow) { | |
return; | |
} | |
focusedWindow.setFrame({ | |
x:focusedWindow.screen().frame().x + focusedWindow.screen().frame().width/2, | |
y:focusedWindow.screen().frame().y, | |
width: focusedWindow.screen().frame().width/2, | |
height:focusedWindow.screen().frame().height | |
}); | |
}) | |
// Press command-option-4 and move currently focused window into the next screen, keeping the same size. | |
Key.on('4', [ 'command', 'option' ], () => { | |
var focusedWindow = Window.focused(); | |
if (!focusedWindow) { | |
return; | |
} | |
currentScreenIdentifier = focusedWindow.screen().identifier() | |
Screen.all().forEach(screen => { | |
if (screen.identifier() != currentScreenIdentifier) { // I got only 2 screens :D | |
focusedWindow.setTopLeft({x:screen.frame().x, y:screen.frame().y}) | |
} | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment