From 4b6329c23a563579d91a77ba1a8700aaf51fa07e Mon Sep 17 00:00:00 2001 From: ashfinal Date: Wed, 15 Nov 2017 18:17:06 +0800 Subject: [PATCH] fix moveToScreen --- Spoons/WinWin.spoon/docs.json | 274 +++++++++++++++++----------------- Spoons/WinWin.spoon/init.lua | 10 +- 2 files changed, 142 insertions(+), 142 deletions(-) diff --git a/Spoons/WinWin.spoon/docs.json b/Spoons/WinWin.spoon/docs.json index 1b0ff0ea..56b73b02 100644 --- a/Spoons/WinWin.spoon/docs.json +++ b/Spoons/WinWin.spoon/docs.json @@ -11,14 +11,14 @@ ], "Variable" : [ { + "doc" : "An integer specifying how many gridparts the screen should be divided into. Defaults to 30.", + "desc" : "An integer specifying how many gridparts the screen should be divided into. Defaults to 30.", "parameters" : [ ], "stripped_doc" : [ "An integer specifying how many gridparts the screen should be divided into. Defaults to 30." ], - "name" : "gridparts", - "doc" : "An integer specifying how many gridparts the screen should be divided into. Defaults to 30.", "notes" : [ ], @@ -28,7 +28,7 @@ ], "def" : "WinWin.gridparts", - "desc" : "An integer specifying how many gridparts the screen should be divided into. Defaults to 30." + "name" : "gridparts" } ], "stripped_doc" : [ @@ -42,48 +42,73 @@ "Constructor" : [ ], - "items" : [ + "doc" : "Windows manipulation\n\nDownload: [https:\/\/github.com\/Hammerspoon\/Spoons\/raw\/master\/Spoons\/WinWin.spoon.zip](https:\/\/github.com\/Hammerspoon\/Spoons\/raw\/master\/Spoons\/WinWin.spoon.zip)", + "Method" : [ { + "doc" : "Move the focused window in the `direction` by on step. The step scale equals to the width\/height of one gridpart.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`.", + "desc" : "Move the focused window in the `direction` by on step. The step scale equals to the width\/height of one gridpart.", "parameters" : [ + " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`." + ], + "stripped_doc" : [ + "Move the focused window in the `direction` by on step. The step scale equals to the width\/height of one gridpart.", + "" + ], + "notes" : [ + ], + "signature" : "WinWin:stepMove(direction)", + "type" : "Method", + "returns" : [ + + ], + "def" : "WinWin:stepMove(direction)", + "name" : "stepMove" + }, + { + "doc" : "Resize the focused window in the `direction` by on step.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`.", + "desc" : "Resize the focused window in the `direction` by on step.", + "parameters" : [ + " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`." ], "stripped_doc" : [ - "An integer specifying how many gridparts the screen should be divided into. Defaults to 30." + "Resize the focused window in the `direction` by on step.", + "" ], - "name" : "gridparts", - "doc" : "An integer specifying how many gridparts the screen should be divided into. Defaults to 30.", "notes" : [ ], - "signature" : "WinWin.gridparts", - "type" : "Variable", + "signature" : "WinWin:stepResize(direction)", + "type" : "Method", "returns" : [ ], - "def" : "WinWin.gridparts", - "desc" : "An integer specifying how many gridparts the screen should be divided into. Defaults to 30." + "def" : "WinWin:stepResize(direction)", + "name" : "stepResize" }, { + "doc" : "Stash current windows's position and size.", + "desc" : "Stash current windows's position and size.", "parameters" : [ ], "stripped_doc" : [ - "Center the cursor on the focused window." + "Stash current windows's position and size." ], - "name" : "centerCursor", - "doc" : "Center the cursor on the focused window.", "notes" : [ ], - "signature" : "WinWin:centerCursor()", + "signature" : "WinWin:stash()", "type" : "Method", "returns" : [ ], - "def" : "WinWin:centerCursor()", - "desc" : "Center the cursor on the focused window." + "def" : "WinWin:stash()", + "name" : "stash" }, { + "doc" : "Move and resize the focused window.\n\nParameters:\n * option - A string specifying the option, valid strings are: `halfleft`, `halfright`, `halfup`, `halfdown`, `cornerNW`, `cornerSW`, `cornerNE`, `cornerSE`, `center`, `fullscreen`, `expand`, `shrink`.", + "desc" : "Move and resize the focused window.", "parameters" : [ " * option - A string specifying the option, valid strings are: `halfleft`, `halfright`, `halfup`, `halfdown`, `cornerNW`, `cornerSW`, `cornerNE`, `cornerSE`, `center`, `fullscreen`, `expand`, `shrink`." ], @@ -91,8 +116,6 @@ "Move and resize the focused window.", "" ], - "name" : "moveAndResize", - "doc" : "Move and resize the focused window.\n\nParameters:\n * option - A string specifying the option, valid strings are: `halfleft`, `halfright`, `halfup`, `halfdown`, `cornerNW`, `cornerSW`, `cornerNE`, `cornerSE`, `center`, `fullscreen`, `expand`, `shrink`.", "notes" : [ ], @@ -102,9 +125,11 @@ ], "def" : "WinWin:moveAndResize(option)", - "desc" : "Move and resize the focused window." + "name" : "moveAndResize" }, { + "doc" : "Move the focused window between all of the screens in the `direction`.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`, `next`.", + "desc" : "Move the focused window between all of the screens in the `direction`.", "parameters" : [ " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`, `next`." ], @@ -112,8 +137,6 @@ "Move the focused window between all of the screens in the `direction`.", "" ], - "name" : "moveToScreen", - "doc" : "Move the focused window between all of the screens in the `direction`.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`, `next`.", "notes" : [ ], @@ -123,283 +146,260 @@ ], "def" : "WinWin:moveToScreen(direction)", - "desc" : "Move the focused window between all of the screens in the `direction`." + "name" : "moveToScreen" }, { + "doc" : "Undo the last window manipulation. Only those \"moveAndResize\" manipulations can be undone.", + "desc" : "Undo the last window manipulation. Only those \"moveAndResize\" manipulations can be undone.", "parameters" : [ ], "stripped_doc" : [ - "Redo the window manipulation. Only those \"moveAndResize\" manipulations can be undone." + "Undo the last window manipulation. Only those \"moveAndResize\" manipulations can be undone." ], - "name" : "redo", - "doc" : "Redo the window manipulation. Only those \"moveAndResize\" manipulations can be undone.", "notes" : [ ], - "signature" : "WinWin:redo()", + "signature" : "WinWin:undo()", "type" : "Method", "returns" : [ ], - "def" : "WinWin:redo()", - "desc" : "Redo the window manipulation. Only those \"moveAndResize\" manipulations can be undone." + "def" : "WinWin:undo()", + "name" : "undo" }, { + "doc" : "Redo the window manipulation. Only those \"moveAndResize\" manipulations can be undone.", + "desc" : "Redo the window manipulation. Only those \"moveAndResize\" manipulations can be undone.", "parameters" : [ ], "stripped_doc" : [ - "Stash current windows's position and size." + "Redo the window manipulation. Only those \"moveAndResize\" manipulations can be undone." ], - "name" : "stash", - "doc" : "Stash current windows's position and size.", "notes" : [ ], - "signature" : "WinWin:stash()", + "signature" : "WinWin:redo()", "type" : "Method", "returns" : [ ], - "def" : "WinWin:stash()", - "desc" : "Stash current windows's position and size." + "def" : "WinWin:redo()", + "name" : "redo" }, { + "doc" : "Center the cursor on the focused window.", + "desc" : "Center the cursor on the focused window.", "parameters" : [ - " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`." + ], "stripped_doc" : [ - "Move the focused window in the `direction` by on step. The step scale equals to the width\/height of one gridpart.", - "" + "Center the cursor on the focused window." ], - "name" : "stepMove", - "doc" : "Move the focused window in the `direction` by on step. The step scale equals to the width\/height of one gridpart.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`.", "notes" : [ ], - "signature" : "WinWin:stepMove(direction)", + "signature" : "WinWin:centerCursor()", "type" : "Method", "returns" : [ ], - "def" : "WinWin:stepMove(direction)", - "desc" : "Move the focused window in the `direction` by on step. The step scale equals to the width\/height of one gridpart." - }, + "def" : "WinWin:centerCursor()", + "name" : "centerCursor" + } + ], + "Field" : [ + + ], + "items" : [ { + "doc" : "An integer specifying how many gridparts the screen should be divided into. Defaults to 30.", + "desc" : "An integer specifying how many gridparts the screen should be divided into. Defaults to 30.", "parameters" : [ - " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`." + ], "stripped_doc" : [ - "Resize the focused window in the `direction` by on step.", - "" + "An integer specifying how many gridparts the screen should be divided into. Defaults to 30." ], - "name" : "stepResize", - "doc" : "Resize the focused window in the `direction` by on step.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`.", "notes" : [ ], - "signature" : "WinWin:stepResize(direction)", - "type" : "Method", + "signature" : "WinWin.gridparts", + "type" : "Variable", "returns" : [ ], - "def" : "WinWin:stepResize(direction)", - "desc" : "Resize the focused window in the `direction` by on step." + "def" : "WinWin.gridparts", + "name" : "gridparts" }, { + "doc" : "Center the cursor on the focused window.", + "desc" : "Center the cursor on the focused window.", "parameters" : [ ], "stripped_doc" : [ - "Undo the last window manipulation. Only those \"moveAndResize\" manipulations can be undone." + "Center the cursor on the focused window." ], - "name" : "undo", - "doc" : "Undo the last window manipulation. Only those \"moveAndResize\" manipulations can be undone.", "notes" : [ ], - "signature" : "WinWin:undo()", + "signature" : "WinWin:centerCursor()", "type" : "Method", "returns" : [ ], - "def" : "WinWin:undo()", - "desc" : "Undo the last window manipulation. Only those \"moveAndResize\" manipulations can be undone." - } - ], - "Field" : [ - - ], - "Command" : [ - - ], - "doc" : "Windows manipulation\n\nDownload: [https:\/\/github.com\/Hammerspoon\/Spoons\/raw\/master\/Spoons\/WinWin.spoon.zip](https:\/\/github.com\/Hammerspoon\/Spoons\/raw\/master\/Spoons\/WinWin.spoon.zip)", - "Method" : [ + "def" : "WinWin:centerCursor()", + "name" : "centerCursor" + }, { + "doc" : "Move and resize the focused window.\n\nParameters:\n * option - A string specifying the option, valid strings are: `halfleft`, `halfright`, `halfup`, `halfdown`, `cornerNW`, `cornerSW`, `cornerNE`, `cornerSE`, `center`, `fullscreen`, `expand`, `shrink`.", + "desc" : "Move and resize the focused window.", "parameters" : [ - " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`." + " * option - A string specifying the option, valid strings are: `halfleft`, `halfright`, `halfup`, `halfdown`, `cornerNW`, `cornerSW`, `cornerNE`, `cornerSE`, `center`, `fullscreen`, `expand`, `shrink`." ], "stripped_doc" : [ - "Move the focused window in the `direction` by on step. The step scale equals to the width\/height of one gridpart.", + "Move and resize the focused window.", "" ], - "name" : "stepMove", - "doc" : "Move the focused window in the `direction` by on step. The step scale equals to the width\/height of one gridpart.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`.", "notes" : [ ], - "signature" : "WinWin:stepMove(direction)", + "signature" : "WinWin:moveAndResize(option)", "type" : "Method", "returns" : [ ], - "def" : "WinWin:stepMove(direction)", - "desc" : "Move the focused window in the `direction` by on step. The step scale equals to the width\/height of one gridpart." + "def" : "WinWin:moveAndResize(option)", + "name" : "moveAndResize" }, { + "doc" : "Move the focused window between all of the screens in the `direction`.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`, `next`.", + "desc" : "Move the focused window between all of the screens in the `direction`.", "parameters" : [ - " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`." + " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`, `next`." ], "stripped_doc" : [ - "Resize the focused window in the `direction` by on step.", + "Move the focused window between all of the screens in the `direction`.", "" ], - "name" : "stepResize", - "doc" : "Resize the focused window in the `direction` by on step.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`.", "notes" : [ ], - "signature" : "WinWin:stepResize(direction)", + "signature" : "WinWin:moveToScreen(direction)", "type" : "Method", "returns" : [ ], - "def" : "WinWin:stepResize(direction)", - "desc" : "Resize the focused window in the `direction` by on step." + "def" : "WinWin:moveToScreen(direction)", + "name" : "moveToScreen" }, { + "doc" : "Redo the window manipulation. Only those \"moveAndResize\" manipulations can be undone.", + "desc" : "Redo the window manipulation. Only those \"moveAndResize\" manipulations can be undone.", "parameters" : [ ], "stripped_doc" : [ - "Stash current windows's position and size." + "Redo the window manipulation. Only those \"moveAndResize\" manipulations can be undone." ], - "name" : "stash", - "doc" : "Stash current windows's position and size.", "notes" : [ ], - "signature" : "WinWin:stash()", + "signature" : "WinWin:redo()", "type" : "Method", "returns" : [ ], - "def" : "WinWin:stash()", - "desc" : "Stash current windows's position and size." + "def" : "WinWin:redo()", + "name" : "redo" }, { + "doc" : "Stash current windows's position and size.", + "desc" : "Stash current windows's position and size.", "parameters" : [ - " * option - A string specifying the option, valid strings are: `halfleft`, `halfright`, `halfup`, `halfdown`, `cornerNW`, `cornerSW`, `cornerNE`, `cornerSE`, `center`, `fullscreen`, `expand`, `shrink`." - ], - "stripped_doc" : [ - "Move and resize the focused window.", - "" - ], - "name" : "moveAndResize", - "doc" : "Move and resize the focused window.\n\nParameters:\n * option - A string specifying the option, valid strings are: `halfleft`, `halfright`, `halfup`, `halfdown`, `cornerNW`, `cornerSW`, `cornerNE`, `cornerSE`, `center`, `fullscreen`, `expand`, `shrink`.", - "notes" : [ - ], - "signature" : "WinWin:moveAndResize(option)", - "type" : "Method", - "returns" : [ - - ], - "def" : "WinWin:moveAndResize(option)", - "desc" : "Move and resize the focused window." - }, - { - "parameters" : [ - " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`, `next`." ], "stripped_doc" : [ - "Move the focused window between all of the screens in the `direction`.", - "" + "Stash current windows's position and size." ], - "name" : "moveToScreen", - "doc" : "Move the focused window between all of the screens in the `direction`.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`, `next`.", "notes" : [ ], - "signature" : "WinWin:moveToScreen(direction)", + "signature" : "WinWin:stash()", "type" : "Method", "returns" : [ ], - "def" : "WinWin:moveToScreen(direction)", - "desc" : "Move the focused window between all of the screens in the `direction`." + "def" : "WinWin:stash()", + "name" : "stash" }, { + "doc" : "Move the focused window in the `direction` by on step. The step scale equals to the width\/height of one gridpart.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`.", + "desc" : "Move the focused window in the `direction` by on step. The step scale equals to the width\/height of one gridpart.", "parameters" : [ - + " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`." ], "stripped_doc" : [ - "Undo the last window manipulation. Only those \"moveAndResize\" manipulations can be undone." + "Move the focused window in the `direction` by on step. The step scale equals to the width\/height of one gridpart.", + "" ], - "name" : "undo", - "doc" : "Undo the last window manipulation. Only those \"moveAndResize\" manipulations can be undone.", "notes" : [ ], - "signature" : "WinWin:undo()", + "signature" : "WinWin:stepMove(direction)", "type" : "Method", "returns" : [ ], - "def" : "WinWin:undo()", - "desc" : "Undo the last window manipulation. Only those \"moveAndResize\" manipulations can be undone." + "def" : "WinWin:stepMove(direction)", + "name" : "stepMove" }, { + "doc" : "Resize the focused window in the `direction` by on step.\n\nParameters:\n * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`.", + "desc" : "Resize the focused window in the `direction` by on step.", "parameters" : [ - + " * direction - A string specifying the direction, valid strings are: `left`, `right`, `up`, `down`." ], "stripped_doc" : [ - "Redo the window manipulation. Only those \"moveAndResize\" manipulations can be undone." + "Resize the focused window in the `direction` by on step.", + "" ], - "name" : "redo", - "doc" : "Redo the window manipulation. Only those \"moveAndResize\" manipulations can be undone.", "notes" : [ ], - "signature" : "WinWin:redo()", + "signature" : "WinWin:stepResize(direction)", "type" : "Method", "returns" : [ ], - "def" : "WinWin:redo()", - "desc" : "Redo the window manipulation. Only those \"moveAndResize\" manipulations can be undone." + "def" : "WinWin:stepResize(direction)", + "name" : "stepResize" }, { + "doc" : "Undo the last window manipulation. Only those \"moveAndResize\" manipulations can be undone.", + "desc" : "Undo the last window manipulation. Only those \"moveAndResize\" manipulations can be undone.", "parameters" : [ ], "stripped_doc" : [ - "Center the cursor on the focused window." + "Undo the last window manipulation. Only those \"moveAndResize\" manipulations can be undone." ], - "name" : "centerCursor", - "doc" : "Center the cursor on the focused window.", "notes" : [ ], - "signature" : "WinWin:centerCursor()", + "signature" : "WinWin:undo()", "type" : "Method", "returns" : [ ], - "def" : "WinWin:centerCursor()", - "desc" : "Center the cursor on the focused window." + "def" : "WinWin:undo()", + "name" : "undo" } + ], + "Command" : [ + ], "name" : "WinWin" } diff --git a/Spoons/WinWin.spoon/init.lua b/Spoons/WinWin.spoon/init.lua index bffdfea6..ef7204cc 100644 --- a/Spoons/WinWin.spoon/init.lua +++ b/Spoons/WinWin.spoon/init.lua @@ -176,15 +176,15 @@ function obj:moveToScreen(direction) local cwin = hs.window.focusedWindow() if cwin then local cscreen = cwin:screen() - if option == "up" then + if direction == "up" then cwin:moveOneScreenNorth() - elseif option == "down" then + elseif direction == "down" then cwin:moveOneScreenSouth() - elseif option == "left" then + elseif direction == "left" then cwin:moveOneScreenWest() - elseif option == "right" then + elseif direction == "right" then cwin:moveOneScreenEast() - elseif option == "next" then + elseif direction == "next" then cwin:moveToScreen(cscreen:next()) end else