DEPRECATED. Primitives for drawing on the screen in various ways.
hs.drawing is now deprecated and will be removed in a future release. Its functionality is now implemented by hs.canvas and you should migrate your code to using that directly. The API docs for hs.drawing remain here as a convenience.
Signature | hs.drawing.windowBehaviors[] |
---|---|
Type | Constant |
Description | Array of window behavior labels for determining how an hs.drawing object is handled in Spaces and Exposé |
Notes |
|
Source | extensions/drawing/drawing.lua line 690 |
Signature | hs.drawing.windowLevels |
---|---|
Type | Constant |
Description | A table of predefined window levels usable with |
Notes |
|
Source | extensions/drawing/drawing.lua line 707 |
Signature | hs.drawing.defaultTextStyle() -> |
---|---|
Type | Function |
Description | Returns a table containing the default font, size, color, and paragraphStyle used by |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 774 |
Signature | hs.drawing.disableScreenUpdates() -> None |
---|---|
Type | Function |
Description | Tells the OS X window server to pause updating the physical displays for a short while. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 85 |
Signature | hs.drawing.enableScreenUpdates() -> None |
---|---|
Type | Function |
Description | Tells the OS X window server to resume updating the physical displays after a previous pause. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 101 |
Signature | hs.drawing.getTextDrawingSize(styledTextObject or theText, [textStyle]) -> sizeTable | nil |
---|---|
Type | Function |
Description | Get the size of the rectangle necessary to fully render the text with the specified style so that is will be completely visible. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 787 |
Signature | hs.drawing.appImage(sizeRect, bundleID) -> drawingObject or nil |
---|---|
Type | Constructor |
Description | Creates a new image object with the icon of a given app |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 38 |
Signature | hs.drawing.arc(centerPoint, radius, startAngle, endAngle) -> drawingObject or nil |
---|---|
Type | Constructor |
Description | Creates a new arc object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 69 |
Signature | hs.drawing.circle(sizeRect) -> drawingObject or nil |
---|---|
Type | Constructor |
Description | Creates a new circle object |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 116 |
Signature | hs.drawing.ellipticalArc(sizeRect, startAngle, endAngle) -> drawingObject or nil |
---|---|
Type | Constructor |
Description | Creates a new elliptical arc object |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 126 |
Signature | hs.drawing.image(sizeRect, imageData) -> drawingObject or nil |
---|---|
Type | Constructor |
Description | Creates a new image object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 170 |
Signature | hs.drawing.line(originPoint, endPoint) -> drawingObject or nil |
---|---|
Type | Constructor |
Description | Creates a new line object |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 148 |
Signature | hs.drawing.rectangle(sizeRect) -> drawingObject or nil |
---|---|
Type | Constructor |
Description | Creates a new rectangle object |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 138 |
Signature | hs.drawing.text(sizeRect, message) -> drawingObject or nil |
---|---|
Type | Constructor |
Description | Creates a new text object |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 159 |
Signature | hs.drawing:alpha() -> number |
---|---|
Type | Method |
Description | Get the alpha level of the window containing the hs.drawing object. |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 650 |
Signature | hs.drawing:behavior() -> number |
---|---|
Type | Method |
Description | Returns the current behavior of the hs.drawing object with respect to Spaces and Exposé for the object. |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 754 |
Signature | hs.drawing:behaviorAsLabels() -> table |
---|---|
Type | Method |
Description | Returns a table of the labels for the current behaviors of the object. |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 59 |
Signature | hs.drawing:bringToFront([aboveEverything]) -> drawingObject |
---|---|
Type | Method |
Description | Places the drawing object on top of normal windows |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 627 |
Signature | hs.drawing:clickCallbackActivating([false]) -> drawingObject or current value |
---|---|
Type | Method |
Description | Get or set whether or not clicking on a drawing with a click callback defined should bring all of Hammerspoon's open windows to the front. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 567 |
Signature | hs.drawing:clippingRectangle([rect]) -> drawingObject or current value |
---|---|
Type | Method |
Description | Set the screen area in which the drawing contents are visible. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 284 |
Signature | hs.drawing:delete() |
---|---|
Type | Method |
Description | Destroys the drawing object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 614 |
Signature | hs.drawing:frame() -> hs.geometry object |
---|---|
Type | Method |
Description | Gets the frame of a drawingObject in absolute coordinates |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 310 |
Signature | hs.drawing:getStyledText() -> |
---|---|
Type | Method |
Description | Gets the text of a drawing object as an |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 216 |
Signature | hs.drawing:hide([fadeOutTime]) -> drawingObject |
---|---|
Type | Method |
Description | Hides the drawing object |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 604 |
Signature | hs.drawing:imageAlignment([type]) -> drawingObject or current value |
---|---|
Type | Method |
Description | Get or set the alignment of an image that doesn't fully fill the drawing objects frame. |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 548 |
Signature | hs.drawing:imageAnimates([flag]) -> drawingObject or current value |
---|---|
Type | Method |
Description | Get or set whether or not an animated GIF image should cycle through its animation. |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 520 |
Signature | hs.drawing:imageFrame([type]) -> drawingObject or current value |
---|---|
Type | Method |
Description | Get or set what type of frame should be around the drawing frame of the image. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 530 |
Signature | hs.drawing:imageScaling([type]) -> drawingObject or current value |
---|---|
Type | Method |
Description | Get or set how an image is scaled within the frame of a drawing object containing an image. |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 506 |
Signature | hs.drawing:orderAbove([object2]) -> object |
---|---|
Type | Method |
Description | Moves drawing object above drawing object2, or all drawing objects in the same presentation level, if object2 is not provided. |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 670 |
Signature | hs.drawing:orderBelow([object2]) -> object1 |
---|---|
Type | Method |
Description | Moves drawing object below drawing object2, or all drawing objects in the same presentation level, if object2 is not provided. |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 680 |
Signature | hs.drawing:rotateImage(angle) -> drawingObject |
---|---|
Type | Method |
Description | Rotates an image clockwise around its center |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 493 |
Signature | hs.drawing:sendToBack() -> drawingObject |
---|---|
Type | Method |
Description | Places the drawing object behind normal windows, between the desktop wallpaper and desktop icons |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 640 |
Signature | hs.drawing:setAlpha(level) -> object |
---|---|
Type | Method |
Description | Sets the alpha level of the window containing the hs.drawing object. |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 660 |
Signature | hs.drawing:setArcAngles(startAngle, endAngle) -> drawingObject |
---|---|
Type | Method |
Description | Changes the starting and ending angles for an arc drawing object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 377 |
Signature | hs.drawing:setBehavior(behavior) -> object |
---|---|
Type | Method |
Description | Sets the window behaviors represented by the number provided for the window containing the hs.drawing object. |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 764 |
Signature | hs.drawing:setBehaviorByLabels(table) -> object |
---|---|
Type | Method |
Description | Sets the window behaviors based upon the labels specified in the table provided. |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 49 |
Signature | hs.drawing:setClickCallback(mouseUpFn, mouseDownFn) -> drawingObject |
---|---|
Type | Method |
Description | Sets a callback for mouseUp and mouseDown click events |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 580 |
Signature | hs.drawing:setFill(doFill) -> drawingObject |
---|---|
Type | Method |
Description | Sets whether or not to fill a drawing object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 444 |
Signature | hs.drawing:setFillColor(color) -> drawingObject |
---|---|
Type | Method |
Description | Sets the fill color of a drawing object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 363 |
Signature | hs.drawing:setFillGradient(startColor, endColor, angle) -> drawingObject |
---|---|
Type | Method |
Description | Sets the fill gradient of a drawing object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 391 |
Signature | hs.drawing:setFrame(rect) -> drawingObject |
---|---|
Type | Method |
Description | Sets the frame of the drawingObject in absolute coordinates |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 300 |
Signature | hs.drawing:setImage(image) -> drawingObject |
---|---|
Type | Method |
Description | Sets the image of a drawing object |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 483 |
Signature | hs.drawing:setImageASCII(ascii) -> drawingObject |
---|---|
Type | Method |
Description | Sets the image of a drawing object from an ASCII representation |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 25 |
Signature | hs.drawing:setImageFromPath(imagePath) -> drawingObject |
---|---|
Type | Method |
Description | Sets the image path of a drawing object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 10 |
Signature | hs.drawing:setLevel(theLevel) -> drawingObject |
---|---|
Type | Method |
Description | Sets the window level more precisely than sendToBack and bringToFront. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 740 |
Signature | hs.drawing:setRoundedRectRadii(xradius, yradius) -> drawingObject |
---|---|
Type | Method |
Description | Sets the radii of the corners of a rectangle drawing object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 428 |
Signature | hs.drawing:setSize(size) -> drawingObject |
---|---|
Type | Method |
Description | Resizes a drawing object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 271 |
Signature | hs.drawing:setStroke(doStroke) -> drawingObject |
---|---|
Type | Method |
Description | Sets whether or not to stroke a drawing object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 457 |
Signature | hs.drawing:setStrokeColor(color) -> drawingObject |
---|---|
Type | Method |
Description | Sets the stroke color of a drawing object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 415 |
Signature | hs.drawing:setStrokeWidth(width) -> drawingObject |
---|---|
Type | Method |
Description | Sets the stroke width of a drawing object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 470 |
Signature | hs.drawing:setStyledText(message) -> drawingObject |
---|---|
Type | Method |
Description | Sets the text of a drawing object from an |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 203 |
Signature | hs.drawing:setText(message) -> drawingObject |
---|---|
Type | Method |
Description | Sets the text of a drawing object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 189 |
Signature | hs.drawing:setTextColor(color) -> drawingObject |
---|---|
Type | Method |
Description | Sets the default text color for a drawing object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 348 |
Signature | hs.drawing:setTextFont(fontname) -> drawingObject |
---|---|
Type | Method |
Description | Sets the default font for a drawing object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 320 |
Signature | hs.drawing:setTextSize(size) -> drawingObject |
---|---|
Type | Method |
Description | Sets the default text size for a drawing object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 334 |
Signature | hs.drawing:setTextStyle([textStyle]) -> drawingObject |
---|---|
Type | Method |
Description | Sets some simple style parameters for the entire text of a drawing object. For more control over style including having multiple styles within a single text object, use |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/drawing/drawing.lua line 229 |
Signature | hs.drawing:setTopLeft(point) -> drawingObject |
---|---|
Type | Method |
Description | Moves the drawingObject to a given point |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 261 |
Signature | hs.drawing:show([fadeInTime]) -> drawingObject |
---|---|
Type | Method |
Description | Displays the drawing object |
Parameters |
|
Returns |
|
Source | extensions/drawing/drawing.lua line 594 |