glenreesor / HammerBar

A Windows-Like Taskbar for MacOS
GNU General Public License v3.0
16 stars 4 forks source link

HammerBar - A Windows-Like Taskbar for MacOS

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.

HammerBar example

Contents

Quick Start

You should now have a basic taskbar. Yay!

But of course there's more. Read on....

Widgets, Screens and BundleIds

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()

BundleIds

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.

Keybindings

Why does HammerBar sometimes respond slowly?

Good 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!