HammerBar is a "Spoon" for HammerSpoon that displays a clickable taskbar along the bottom of your screen with support for app launchers and "widgets" that can show the output of arbitrary lua functions.
install Hammerspoon
create the directory ~/.hammerspoon/Spoons/HammerBar.spoon/
copy appMenuButton.png
and init.lua
from the current release
to ~/.hammerspoon/Spoons/HammerBar.spoon/
add the following lines to ~/.hammerspoon/init.lua
:
hs.loadSpoon("HammerBar") spoon.HammerBar:start()
set your Dock to autohide, otherwise the HammerBar taskbar will be above the dock.
restart Hammerspoon
You should now have a basic taskbar. Yay!
But of course there's more. Read on....
Other than the actual taskbar, all other functionality is provided by Widgets. Widgets are explicitly added to the Primary screen and Secondary screens using the HammerBar API.
For example, to add a Safari launcher to the left side of the primary screen and
a clock to the right side, change your ~/.hammerspoon/init.lua
to:
hs.loadSpoon("HammerBar")
spoon.HammerBar:addWidgetsPrimaryScreenLeft({
spoon.HammerBar.widgets:appLauncher('com.apple.Safari'),
});
spoon.HammerBar:addWidgetsPrimaryScreenRight({
spoon.HammerBar.widgets.clock(),
})
spoon.HammerBar:start()
Or perhaps you want the Safari launcher only on your primary screen but the clock on all your screens:
hs.loadSpoon("HammerBar")
spoon.HammerBar:addWidgetsPrimaryScreenLeft({
spoon.HammerBar.widgets:appLauncher('com.apple.Safari'),
});
spoon.HammerBar:addWidgetsPrimaryScreenRight({
spoon.HammerBar.widgets.clock(),
})
spoon.HammerBar:addWidgetsSecondaryScreenRight({
spoon.HammerBar.widgets.clock(),
})
spoon.HammerBar:start()
What the heck are BundleIds? Those are strings used by MacOS to identify applications.
For example in the examples above we used the BundleId com.apple.Safari
.
So you want to add a different application launcher, how do you determine its
BundleId? Easy. Make sure the Hammerspoon console is open (click the Hammerspoon
icon in the MacOS menu bar and select Console...
), then launch your application
the normal MacOS way. After it starts, Shift + Click its button in the HammerBar taskbar to
get debug information, including the BundleId, printed to the Hammerspoon console.
bundleId
if you want to add the app to an App MenuGood question! It will be a combination of the internal workings of Hammerspoon (the toolkit used by HammerBar) as well as the fact that window lists are generated by polling individual applications and window objects.
HammerBar is definitely not an optimal implementation of a MacOS taskbar, however the use of Hammerspoon and Lua provided a pretty low bar for me to create something that does the trick (for me, at least).
Remember that HammerBar is written in an interpreted language (Lua), it has:
If you have performance suggestions drop me a note!