docs » TurboBoost

A spoon to load/unload the Turbo Boost Disable kernel extension from https://github.com/rugarciap/Turbo-Boost-Switcher.

Note: this spoon by default uses sudo to load/unload the kernel extension, so for it to work from Hammerspoon, you need to configure sudo to be able to load/unload the extension without a password, or configure the load_kext_cmd and unload_kext_cmd variables to use some other mechanism that prompts you for the credentials.

For example, the following configuration (stored in /etc/sudoers.d/turboboost) can be used to allow loading and unloading the module without a password:

Cmnd_Alias    TURBO_OPS = /sbin/kextunload /Applications/Turbo Boost Switcher.app/Contents/Resources/DisableTurboBoost.64bits.kext, /usr/bin/kextutil /Applications/Turbo Boost Switcher.app/Contents/Resources/DisableTurboBoost.64bits.kext

%admin ALL=(ALL) NOPASSWD: TURBO_OPS

If you use this, please support the author of Turbo Boost Disabler by purchasing the Pro version of the app!

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

API Overview

API Documentation

Variables

check_kext_cmd
Signature TurboBoost.check_kext_cmd
Type Variable
Description

Command to execute to check whether the DisableTurboBoost kernel extension is loaded. Default value: "/usr/sbin/kextstat | grep com.rugarciap.DisableTurboBoost"

disable_on_start
Signature TurboBoost.disable_on_start
Type Variable
Description

Boolean to indicate whether Turbo Boost should be disabled when the Spoon starts. Default value: false.

disabled_icon_path
Signature TurboBoost.disabled_icon_path
Type Variable
Description

Where to find the icon to use for the "Disabled" icon. Default value uses the icon from the Turbo Boost application: "/Applications/Turbo Boost Switcher.app/Contents/Resources/icon_off.tiff"

enabled_icon_path
Signature TurboBoost.enabled_icon_path
Type Variable
Description

Where to find the icon to use for the "Enabled" icon. Default value uses the icon from the Turbo Boost application: "/Applications/Turbo Boost Switcher.app/Contents/Resources/icon.tiff"

kext_path
Signature TurboBoost.kext_path
Type Variable
Description

Where the DisableTurboBoost.kext file is located. Default value: "/Applications/Turbo Boost Switcher.app/Contents/Resources/DisableTurboBoost.64bits.kext"

load_kext_cmd
Signature TurboBoost.load_kext_cmd
Type Variable
Description

Command to execute to load the DisableTurboBoost kernel extension. This command must execute with root privileges and either query the user for the credentials, or be configured (e.g. with sudo) to run without prompting. The string "%s" in this variable gets replaced with the value of TurboBoost.kext_path. Default value: "/usr/bin/sudo /usr/bin/kextutil '%s'"

logger
Signature TurboBoost.logger
Type Variable
Description

Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.

notify
Signature TurboBoost.notify
Type Variable
Description

Boolean indicating whether notifications should be generated when Turbo Boost is enabled/disabled. Default value: true

reenable_on_stop
Signature TurboBoost.reenable_on_stop
Type Variable
Description

Boolean to indicate whether Turbo Boost should be reenabled when the Spoon stops. Default value: true.

unload_kext_cmd
Signature TurboBoost.unload_kext_cmd
Type Variable
Description

Command to execute to unload the DisableTurboBoost kernel extension. This command must execute with root privileges and either query the user for the credentials, or be configured (e.g. with sudo) to run without prompting. The string "%s" in this variable gets replaced with the value of TurboBoost.kext_path. Default value: "/usr/bin/sudo /sbin/kextunload '%s'"

Methods

bindHotkeys
Signature TurboBoost:bindHotkeys(mapping)
Type Method
Description

Binds hotkeys for TurboBoost

Parameters:

  • mapping - A table containing hotkey objifier/key details for the following items:
    • hello - Say Hello
setState
Signature TurboBoost:setState(state)
Type Method
Description

Sets whether Turbo Boost should be disabled (kernel extension loaded) or enabled (normal state, kernel extension not loaded).

Parameters:

  • state - A boolean, false if Turbo Boost should be disabled (load kernel extension), true if it should be enabled (unload kernel extension if loaded).
  • notify - Optional boolean indicating whether a notification should be produced. If not given, the value of TurboBoost.notify is used.

Returns:

  • Boolean indicating new state
start
Signature TurboBoost:start()
Type Method
Description

Starts TurboBoost

Parameters:

  • None

Returns:

  • The TurboBoost object
status
Signature TurboBoost:status()
Type Method
Description

Check whether Turbo Boost is enabled

Returns:

  • true if TurboBoost is enabled (kernel ext not loaded), false otherwise.
stop
Signature TurboBoost:stop()
Type Method
Description

Stops TurboBoost

Parameters:

  • None

Returns:

  • The TurboBoost object
toggle
Signature TurboBoost:toggle()
Type Method
Description

Toggle TurboBoost status

Returns:

  • New TurboBoost status, after the toggle