diff --git a/slate.js b/slate.js index 38de9b1..7f72605 100644 --- a/slate.js +++ b/slate.js @@ -28,10 +28,9 @@ var middleThird = slate.operation("move", { }); var bottomThird = slate.operation("move", { x: "screenOriginX", - y: "screenOriginY+screenSizeY*0.66666", + y: "screenOriginY+(screenSizeY*(2/3))", width: "screenSizeX", height: "screenSizeY/3" - }); var topHalf = slate.operation("move", { x: "screenOriginX", @@ -53,6 +52,27 @@ var full = slate.operation("move", { width: "screenSizeX", height: "screenSizeY" }); +var topLeft = S.op("corner", { + "direction": "top-left", + "width": "screenSizeX/2", + "height": "screenSizeY/2" +}); + +var topRight = S.op("corner", { + "direction": "top-right", + "width": "screenSizeX/2", + "height": "screenSizeY/2" +}); +var bottomLeft = S.op("corner", { + "direction": "bottom-left", + "width": "screenSizeX/2", + "height": "screenSizeY/2" +}); +var bottomRight = S.op("corner", { + "direction": "bottom-right", + "width": "screenSizeX/2", + "height": "screenSizeY/2" +}); var moveScreen0 = slate.operation("throw", { screen: "0" @@ -80,12 +100,9 @@ function googleChromeLayout(windowObject) { var title = windowObject.title(); slate.log(title); if (title !== undefined && title.match(/^Grafana.+$/)) { - windowObject.doOperation(moveScreen1); - windowObject.doOperation(full); - }else if (title !== undefined && title.match(/Google Play Music.+$/)) { windowObject.doOperation(moveScreen0); - windowObject.doOperation(middleThird); - } else if (title !== undefined && title == "Postman") { + windowObject.doOperation(full); + } else if (title !== undefined && title == "Postman") { //do nothing } else { windowObject.doOperation(moveScreen1); @@ -93,106 +110,6 @@ function googleChromeLayout(windowObject) { } } -slate.bind("down:cmd,alt", function (win) { - if (!win) { - return; - } - win.doOperation(bottomHalf); -}); - - -slate.bind("up:cmd,ctrl", function (win) { - if (!win) { - return; - } - win.doOperation(topThird); -}); -slate.bind("down:cmd,ctrl", function (win) { - if (!win) { - return; - } - win.doOperation(bottomThird); -}); - -slate.bind("m:cmd,ctrl", function (win) { - if (!win) { - return; - } - win.doOperation(middleThird); -}); - - -slate.bind("up:cmd,alt", function (win) { - if (!win) { - return; - } - win.doOperation(topHalf); -}); - -slate.bind("left:cmd,alt", function (win) { - if (!win) { - return; - } - win.doOperation(leftHalf); -}); - -slate.bind("right:cmd,alt", function (win) { - if (!win) { - return; - } - win.doOperation(rightHalf); -}); - -slate.bind("left:ctrl,alt,cmd", function (win) { - if (!win) { - return; - } - - var screen = win.screen().id() - 1; - - if (screen < 0) { - screen = 5; - } - slate.log(screen); - var op = slate.operation("throw", { - screen: screen.toString() - }); - win.doOperation(op); - -}); - -slate.bind("right:ctrl,alt,cmd", function (win) { - if (!win) { - return; - } - - var screen = win.screen().id() + 1; - - if (screen > 5) { - screen = 0; - } - slate.log(screen); - var op = slate.operation("throw", { - screen: screen.toString() - }); - win.doOperation(op); - -}); - - -slate.bind("f:cmd,alt", function (win) { - if (!win) { - return; - } - win.doOperation(full); -}); - -slate.bind("0:cmd,alt", function (win) { - if (!win) { - return; - } - win.doOperation(moveScreen0); -}); slate.config("orderScreensLeftToRight", true); @@ -226,21 +143,39 @@ var screen4Full = slate.operation("move", { }); -var threeMonitorLayout= slate.layout("threeMonitor", { +var threeMonitorLayout = slate.layout("threeMonitor", { "Slack": { - "operations": [moveScreen0, topThird], + "operations": [function(wo) { + wo.doOperation(moveScreen0); + wo.doOperation(topLeft); + }], "main-first": true, "ignore-fail": true, "repeat": true }, "Microsoft Outlook": { - "operations": [moveScreen0, bottomThird], + "operations": [function(wo) { + wo.doOperation(moveScreen0); + wo.doOperation(bottomLeft); + }], "main-first": true, - "ignore-fail": true, + "ignore-fail": false, + "repeat": true + }, + "Google Play Music Desktop Player": { + "operations": [function(wo) { + wo.doOperation(moveScreen0); + wo.doOperation(bottomRight); + }], + "main-first": true, + "ignore-fail": false, "repeat": true }, "VMware Fusion": { - "operations": [moveScreen1, full], + "operations": [function(wo) { + wo.doOperation(moveScreen1); + wo.doOperation(full); + }], "main-first": true, "ignore-fail": true, "repeat": true @@ -250,14 +185,20 @@ var threeMonitorLayout= slate.layout("threeMonitor", { "repeat": true, "ignore-fail": true }, - "PyCharm": { - "operations": [moveScreen2, full], + "PyCharm Community Edition": { + "operations": [function(wo) { + wo.doOperation(moveScreen2); + wo.doOperation(topHalf); + }], "main-first": true, "ignore-fail": true, "repeat": true }, "WebStorm": { - "operations": [moveScreen2, full], + "operations": [function(wo) { + wo.doOperation(moveScreen2); + wo.doOperation(topHalf); + }], "main-first": true, "ignore-fail": true, "repeat": true @@ -280,6 +221,6 @@ if (slate.screenCount() == 3) { } slate.log("screen count " + slate.screenCount()); -slate.eachScreen(function (screenObject) { +slate.eachScreen(function(screenObject) { slate.log(screenObject.id() + " " + JSON.stringify(screenObject.rect())); });