docs » MountedVolumes

Displays a list of mounted volumes and a pie chart for each indicating free space on the desktop

Download: https://github.com/Hammerspoon/Spoons/raw/master/Spoons/MountedVolumes.spoon.zip

API Overview

API Documentation

Variables

backgroundBorder
Signature MountedVolumes.backgroundBorder
Type Variable
Description

A table, as defined in hs.drawing.color, specifying the color of the volume lists border. Defaults to { alpha = .5 }

Changes will take effect when the next volume change occurs, when the next usage check occurs (see MountedVolumes.checkInterval), or when MountedVolumes:show is invoked, whichever occurs first.

backgroundColor
Signature MountedVolumes.backgroundColor
Type Variable
Description

A table, as defined in hs.drawing.color, specifying the color of the volume lists background. Defaults to { alpha = .7, white = .5 }

Changes will take effect when the next volume change occurs, when the next usage check occurs (see MountedVolumes.checkInterval), or when MountedVolumes:show is invoked, whichever occurs first.

capacityColor
Signature MountedVolumes.capacityColor
Type Variable
Description

A table, as defined in hs.drawing.color, specifying the color to use for the in use portion of the volume's capacity pie chart. Defaults to hs.drawing.color.x11.orangered

Changes will take effect when the next volume change occurs, when the next usage check occurs (see MountedVolumes.checkInterval), or when MountedVolumes:show is invoked, whichever occurs first.

checkInterval
Signature MountedVolumes.checkInterval
Type Variable
Description

A number, default 120, specifying how often in seconds the free space on mounted volumes should be polled for current usage data.

Changes will take effect when the next volume change occurs, when the next usage check occurs (see MountedVolumes.checkInterval), or when MountedVolumes:show is invoked, whichever occurs first.

cornerRadius
Signature MountedVolumes.cornerRadius
Type Variable
Description

A number, default 5, specifying how rounded the corners of the volume list background should be.

Changes will take effect when the next volume change occurs, when the next usage check occurs (see MountedVolumes.checkInterval), or when MountedVolumes:show is invoked, whichever occurs first.

enableEjectButton
Signature MountedVolumes.enableEjectButton
Type Variable
Description

A boolean, default true, indicating whether the eject button displayed next to removable volumes is enabled.

Changes will take effect when the next volume change occurs, when the next usage check occurs (see MountedVolumes.checkInterval), or when MountedVolumes:show is invoked, whichever occurs first.

freeColor
Signature MountedVolumes.freeColor
Type Variable
Description

A table, as defined in hs.drawing.color, specifying the color to use for the free portion of the volume's capacity pie chart. Defaults to hs.drawing.color.x11.mediumspringgreen

Changes will take effect when the next volume change occurs, when the next usage check occurs (see MountedVolumes.checkInterval), or when MountedVolumes:show is invoked, whichever occurs first.

growsDownwards
Signature MountedVolumes.growsDownwards
Type Variable
Description

A boolean, default true, indicating whether the displayed list grows downwards or upwards as more volumes are mounted. Note that if this value is true, then MountedVolumes.location specifies the upper left corner of the display. If this value is false, then MountedVolumes.location specifies the bottom left corner of the display.

Changes will take effect when the next volume change occurs, when the next usage check occurs (see MountedVolumes.checkInterval), or when MountedVolumes:show is invoked, whichever occurs first.

location
Signature MountedVolumes.location
Type Variable
Description

A table specifying the location on the screen of the starting corner of the display. Defaults to { x = 20, y = 22 }. See also MountedValues.growsDownwards.

Changes will take effect when the next volume change occurs, when the next usage check occurs (see MountedVolumes.checkInterval), or when MountedVolumes:show is invoked, whichever occurs first.

textStyle
Signature MountedVolumes.textStyle
Type Variable
Description

A table specifying the style as defined in hs.styledtext to display the volume name and usage details with. Defaults to:

{
    font = { name = "Menlo", size = 10 },
    color = { alpha = 1.0 },
    paragraphStyle = { alignment = "center" },
}

Changes will take effect when the next volume change occurs, when the next usage check occurs (see MountedVolumes.checkInterval), or when MountedVolumes:show is invoked, whichever occurs first.

unitsInSI
Signature MountedVolumes.unitsInSI
Type Variable
Description

Boolean, default false, indicating whether capacity is displayed in SI units (1 GB = 10^9 bytes) or Gibibytes (1 GiB = 2^30 bytes).

Changes will take effect when the next volume change occurs, when the next usage check occurs (see MountedVolumes.checkInterval), or when MountedVolumes:show is invoked, whichever occurs first.

Methods

bindHotkeys
Signature MountedVolumes:bindHotkeys(mapping)
Type Method
Description

Binds hotkeys for MountedVolumes

Parameters:

  • mapping - A table containing hotkey modifier/key details for one or more of the following commands:
    • "show" - Show the volume list
    • "hide" - Hide the volume list
    • "toggle" - If the volume list is visible then hide it; otherwise show the list.

Returns:

  • None

Notes:

  • the mapping table is a table of one or more key-value pairs of the format command = { { modifiers }, key } where:
    • command - is one of the commands listed above
    • modifiers - is a table containing keyboard modifiers, as specified in hs.hotkey.bind()
    • key - is a string containing the name of a keyboard key, as specified in hs.hotkey.bind()
hide
Signature MountedVolumes:hide()
Type Method
Description

Hide the volumes panel on the background and stop watching for volume changes

Parameters:

  • None

Returns:

  • The MountedVolumes object
show
Signature MountedVolumes:show()
Type Method
Description

Display the volumes panel on the background and update it as volumes are mounted and unmounted.

Parameters:

  • None

Returns:

  • The MountedVolumes object

Notes:

  • If you make a change to any of the variables defining the visual appearance of the volume list, you can force the change to take immediate effect by invoking this method, even if the volume list is already being displayed.