Skip to content

Instantly share code, notes, and snippets.

@anthonynichols
Last active March 8, 2019 16:37
Show Gist options
  • Save anthonynichols/000ba3e2530605b6a13b2f851c084a9f to your computer and use it in GitHub Desktop.
Save anthonynichols/000ba3e2530605b6a13b2f851c084a9f to your computer and use it in GitHub Desktop.
Phoenix (Mac windows manager) config
// -----------------------------------------------------------------------------
// full screen: width 100%, height 100%
// -----------------------------------------------------------------------------
function fullScreen() {
let window = Window.focused();
if (window) {
let screen = window.screen().flippedVisibleFrame();
window.setTopLeft({
x: screen.x,
y: screen.y,
});
window.setSize({
height: screen.height,
width: screen.width,
});
}
}
Key.on('keypad5', ['ctrl', 'shift'], fullScreen);
// -----------------------------------------------------------------------------
// bottom left quarter: width left 50%, height bottom 50%
// -----------------------------------------------------------------------------
function bottomLeftQuarter() {
let window = Window.focused();
if (window) {
let screen = window.screen().flippedVisibleFrame();
let halfScreenHeight = screen.height / 2;
let halfScreenWidth = screen.width / 2;
window.setTopLeft({
x: screen.x,
y: halfScreenHeight + 22,
});
window.setSize({
height: halfScreenHeight,
width: halfScreenWidth,
});
}
}
Key.on('keypad1', ['ctrl', 'shift'], bottomLeftQuarter);
// -----------------------------------------------------------------------------
// bottom right quarter: width right 50%, height bottom 50%
// -----------------------------------------------------------------------------
function bottomRightQuarter() {
let window = Window.focused();
if (window) {
let screen = window.screen().flippedVisibleFrame();
let halfScreenHeight = screen.height / 2;
let halfScreenWidth = screen.width / 2;
window.setTopLeft({
x: screen.x + halfScreenWidth,
y: halfScreenHeight + 22,
});
window.setSize({
height: halfScreenHeight,
width: halfScreenWidth,
});
}
}
Key.on('keypad3', ['ctrl', 'shift'], bottomRightQuarter);
// -----------------------------------------------------------------------------
// left half: width left 50%, height 100%
// -----------------------------------------------------------------------------
function leftHalf() {
let window = Window.focused();
if (window) {
let screen = window.screen().flippedVisibleFrame();
let halfScreenWidth = screen.width / 2;
window.setTopLeft({
x: screen.x,
y: screen.y,
});
window.setSize({
height: screen.height,
width: halfScreenWidth,
});
}
}
Key.on('keypad4', ['ctrl', 'shift'], leftHalf);
// -----------------------------------------------------------------------------
// right half: width right 50%, height 100%
// -----------------------------------------------------------------------------
function rightHalf() {
let window = Window.focused();
if (window) {
let screen = window.screen().flippedVisibleFrame();
let halfScreenWidth = screen.width / 2;
window.setTopLeft({
x: screen.x + halfScreenWidth,
y: screen.y,
});
window.setSize({
height: screen.height,
width: halfScreenWidth,
});
}
}
Key.on('keypad6', ['ctrl', 'shift'], rightHalf);
// -----------------------------------------------------------------------------
// top left quarter: width left 50%, height top 50%
// -----------------------------------------------------------------------------
function topLeftQuarter() {
let window = Window.focused();
if (window) {
let screen = window.screen().flippedVisibleFrame();
let halfScreenHeight = screen.height / 2;
let halfScreenWidth = screen.width / 2;
window.setTopLeft({
x: screen.x,
y: screen.y,
});
window.setSize({
height: halfScreenHeight,
width: halfScreenWidth,
});
}
}
Key.on('keypad7', ['ctrl', 'shift'], topLeftQuarter);
// -----------------------------------------------------------------------------
// top right quarter: width right 50%, height top 50%
// -----------------------------------------------------------------------------
function topRightQuarter() {
let window = Window.focused();
if (window) {
let screen = window.screen().flippedVisibleFrame();
let halfScreenHeight = screen.height / 2;
let halfScreenWidth = screen.width / 2;
window.setTopLeft({
x: screen.x + halfScreenWidth,
y: screen.y,
});
window.setSize({
height: halfScreenHeight,
width: halfScreenWidth,
});
}
}
Key.on('keypad9', ['ctrl', 'shift'], topRightQuarter);
// -----------------------------------------------------------------------------
// bottom left third height: width left 50%, height bottom 33%
// -----------------------------------------------------------------------------
function bottomLeftThirdHeight() {
let window = Window.focused();
if (window) {
let screen = window.screen().flippedVisibleFrame();
let oneThirdScreenHeight = screen.height / 3;
let twoThirdScreenHeight = oneThirdScreenHeight * 2;
let halfScreenWidth = screen.width / 2;
window.setTopLeft({
x: screen.x,
y: twoThirdScreenHeight + 22,
});
window.setSize({
height: oneThirdScreenHeight,
width: halfScreenWidth,
});
}
}
Key.on('keypad1', ['ctrl', 'shift', 'alt'], bottomLeftThirdHeight);
// -----------------------------------------------------------------------------
// bottom right third height: width right 50%, height bottom 33%
// -----------------------------------------------------------------------------
function bottomRightThirdHeight() {
let window = Window.focused();
if (window) {
let screen = window.screen().flippedVisibleFrame();
let oneThirdScreenHeight = screen.height / 3;
let twoThirdScreenHeight = oneThirdScreenHeight * 2;
let halfScreenWidth = screen.width / 2;
window.setTopLeft({
x: screen.x + halfScreenWidth,
y: twoThirdScreenHeight + 22,
});
window.setSize({
height: oneThirdScreenHeight,
width: halfScreenWidth,
});
}
}
Key.on('keypad3', ['ctrl', 'shift', 'alt'], bottomRightThirdHeight);
// -----------------------------------------------------------------------------
// top left two third height: width right 50%, height top 66%
// -----------------------------------------------------------------------------
function topLeftTwoThirdHeight() {
let window = Window.focused();
if (window) {
let screen = window.screen().flippedVisibleFrame();
let oneThirdScreenHeight = screen.height / 3;
let twoThirdScreenHeight = oneThirdScreenHeight * 2;
let halfScreenWidth = screen.width / 2;
window.setTopLeft({
x: screen.x,
y: screen.y,
});
window.setSize({
height: twoThirdScreenHeight,
width: halfScreenWidth,
});
}
}
Key.on('keypad7', ['ctrl', 'shift', 'alt'], topLeftTwoThirdHeight);
// -----------------------------------------------------------------------------
// top right two third height: width right 50%, height top 66%
// -----------------------------------------------------------------------------
function topRightTwoThirdHeight() {
let window = Window.focused();
if (window) {
let screen = window.screen().flippedVisibleFrame();
let oneThirdScreenHeight = screen.height / 3;
let twoThirdScreenHeight = oneThirdScreenHeight * 2;
let halfScreenWidth = screen.width / 2;
window.setTopLeft({
x: screen.x + halfScreenWidth,
y: screen.y,
});
window.setSize({
height: twoThirdScreenHeight,
width: halfScreenWidth,
});
}
}
Key.on('keypad9', ['ctrl', 'shift', 'alt'], topRightTwoThirdHeight);
// -----------------------------------------------------------------------------
// left two third: width left 66%, height 100%
// -----------------------------------------------------------------------------
function leftTwoThird() {
let window = Window.focused();
if (window) {
let screen = window.screen().flippedVisibleFrame();
let twoThirdScreenWidth = (screen.width / 3) * 2;
window.setTopLeft({
x: screen.x,
y: screen.y,
});
window.setSize({
height: screen.height,
width: twoThirdScreenWidth,
});
}
}
Key.on('keypad4', ['ctrl', 'shift', 'alt'], leftTwoThird);
// -----------------------------------------------------------------------------
// right two third: width right 66%, height 100%
// -----------------------------------------------------------------------------
function rightTwoThird() {
let window = Window.focused();
if (window) {
let screen = window.screen().flippedVisibleFrame();
let oneThirdScreenWidth = screen.width / 3;
let twoThirdScreenWidth = oneThirdScreenWidth * 2;
window.setTopLeft({
x: screen.x + oneThirdScreenWidth,
y: screen.y,
});
window.setSize({
height: screen.height,
width: twoThirdScreenWidth,
});
}
}
Key.on('keypad6', ['ctrl', 'shift', 'alt'], rightTwoThird);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment