Skip to content
Alex Claman edited this page Feb 27, 2023 · 13 revisions

You can control stackline by accessing the instance directly via Hammerspoon. Any stackline method may be called from the Hammerspoon console (or on your terminal via the hs cli or ipc port).

Likewise, any stackline method can be bound to a key combo in your Hammerspoon config. Toggling of configuration options such as appearance.showIcons is an obvious use-case, but any Stackline method may be bound to any key combo you wish.

Let's take a closer look at the typical scenario: toggling between indicator icons and indicator pills/blobs with cmd + alt + t.

Toggle indicator icons

To bind a key combo to toggle icons, add the following to your ~/.hammerspoon/init.lua file, after requiring the stackline module & assigning a local variable stackline:

stackline = require "stackline" -- you should already have this line ;-)

-- bind alt+ctrl+t to toggle stackline icons
hs.hotkey.bind({'alt', 'ctrl'}, 't', function()
    stackline.config:toggle('appearance.showIcons')
end)

Alternatively, if you use shkd, you can bind a key combo to toggle icons ~/.skhdrc file using the Hammerspoon cli we installed earlier.

# if this doesn't work, try using the absolute path to the hammerspoon cli: /usr/local/bin/hs
shift + alt - b :  hs -c 'stackline.config:toggle("appearance.showIcons")'

Next: Working with lua →