Skip to content

Instantly share code, notes, and snippets.

@yvesvanbroekhoven
Last active February 10, 2020 08:26
Show Gist options
  • Save yvesvanbroekhoven/e2d65f4c98ed14b7331d3b2ec20bd24a to your computer and use it in GitHub Desktop.
Save yvesvanbroekhoven/e2d65f4c98ed14b7331d3b2ec20bd24a to your computer and use it in GitHub Desktop.
Phoenix Window Manager configuration
/**
* Useful links:
*
* INSTALL:
* - https://github.com/kasper/phoenix#install
*
* API DOCS
* - https://github.com/kasper/phoenix/blob/master/docs/API.md
*
* EXAMPLE CONFIGURATIONS
* - https://github.com/kasper/phoenix/wiki
* - https://github.com/Jaredk3nt/phoenix-padding
*/
Phoenix.set({
daemon: true,
openAtLogin: true,
});
const ACTION_KEYS = [ 'control', 'option' ];
var mainScreenSize = Screen.main().flippedVisibleFrame();
const positions = {
bottomCentered: function() {
Window.focused().setFrame({
height: (mainScreenSize.height / 5) * 2,
x: mainScreenSize.width / 4,
y: (mainScreenSize.height / 5) * 3.1,
width: mainScreenSize.width / 2,
});
},
bottomHalf: function() {
Window.focused().setFrame({
height: mainScreenSize.height / 2,
x: 0,
y: mainScreenSize.height / 2,
width: mainScreenSize.width,
});
},
leftHalf: function() {
Window.focused().setFrame({
height: mainScreenSize.height,
x: 0,
y: 0,
width: mainScreenSize.width / 2,
});
},
leftThird: function() {
Window.focused().setFrame({
height: mainScreenSize.height,
x: 0,
y: 0,
width: (mainScreenSize.width / 3) * 2,
});
},
rightHalf: function() {
Window.focused().setFrame({
height: mainScreenSize.height,
x: mainScreenSize.width / 2,
y: 0,
width: mainScreenSize.width / 2,
});
},
rightThird: function() {
Window.focused().setFrame({
height: mainScreenSize.height,
x: mainScreenSize.width / 3,
y: 0,
width: (mainScreenSize.width / 3) * 2,
});
},
topCentered: function() {
Window.focused().setFrame({
height: (mainScreenSize.height / 5) * 2,
x: mainScreenSize.width / 4,
y: 0,
width: mainScreenSize.width / 2,
});
},
topHalf: function() {
Window.focused().setFrame({
height: mainScreenSize.height / 2,
x: 0,
y: 0,
width: mainScreenSize.width,
});
},
};
var keypad1 = new Key('keypad1', ACTION_KEYS, function(){});
var keypad2 = new Key('keypad2', ACTION_KEYS, positions.bottomCentered);
var keypad3 = new Key('keypad3', ACTION_KEYS, function(){});
var keypad4 = new Key('keypad4', ACTION_KEYS, positions.leftThird);
var keypad5 = new Key('keypad5', ACTION_KEYS, function(){});
var keypad6 = new Key('keypad6', ACTION_KEYS, positions.rightThird);
var keypad7 = new Key('keypad7', ACTION_KEYS, function(){});
var keypad8 = new Key('keypad8', ACTION_KEYS, positions.topCentered);
var keypad9 = new Key('keypad9', ACTION_KEYS, function(){});
var down = new Key('down', ACTION_KEYS, positions.bottomHalf);
var left = new Key('left', ACTION_KEYS, positions.leftHalf);
var l = new Key('l', ACTION_KEYS, positions.leftThird);
var right = new Key('right', ACTION_KEYS, positions.rightHalf);
var r = new Key('r', ACTION_KEYS, positions.rightThird);
var up = new Key('up', ACTION_KEYS, positions.topHalf);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment