diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e43b0f9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.DS_Store
diff --git a/macos/.hammerspoon/images/homebrew-color.png b/macos/.hammerspoon/images/homebrew-color.png
new file mode 100644
index 0000000..d0bc201
Binary files /dev/null and b/macos/.hammerspoon/images/homebrew-color.png differ
diff --git a/macos/.hammerspoon/images/homebrew-color.svg b/macos/.hammerspoon/images/homebrew-color.svg
new file mode 100644
index 0000000..ebe27a9
--- /dev/null
+++ b/macos/.hammerspoon/images/homebrew-color.svg
@@ -0,0 +1,16 @@
+
+
+
\ No newline at end of file
diff --git a/macos/.hammerspoon/images/homebrew-white.png b/macos/.hammerspoon/images/homebrew-white.png
new file mode 100644
index 0000000..3977869
Binary files /dev/null and b/macos/.hammerspoon/images/homebrew-white.png differ
diff --git a/macos/.hammerspoon/images/homebrew-white.svg b/macos/.hammerspoon/images/homebrew-white.svg
new file mode 100644
index 0000000..eeb1f37
--- /dev/null
+++ b/macos/.hammerspoon/images/homebrew-white.svg
@@ -0,0 +1,79 @@
+
+
diff --git a/macos/.hammerspoon/images/slack-color.png b/macos/.hammerspoon/images/slack-color.png
new file mode 100644
index 0000000..b6dc3aa
Binary files /dev/null and b/macos/.hammerspoon/images/slack-color.png differ
diff --git a/macos/.hammerspoon/images/slack-color.svg b/macos/.hammerspoon/images/slack-color.svg
new file mode 100644
index 0000000..d9accdf
--- /dev/null
+++ b/macos/.hammerspoon/images/slack-color.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/macos/.hammerspoon/images/slack-white.png b/macos/.hammerspoon/images/slack-white.png
new file mode 100644
index 0000000..89252b3
Binary files /dev/null and b/macos/.hammerspoon/images/slack-white.png differ
diff --git a/macos/.hammerspoon/images/slack-white.svg b/macos/.hammerspoon/images/slack-white.svg
new file mode 100644
index 0000000..da1d12b
--- /dev/null
+++ b/macos/.hammerspoon/images/slack-white.svg
@@ -0,0 +1,78 @@
+
+
diff --git a/macos/.hammerspoon/init.lua b/macos/.hammerspoon/init.lua
index 35387a0..6fce839 100644
--- a/macos/.hammerspoon/init.lua
+++ b/macos/.hammerspoon/init.lua
@@ -66,7 +66,12 @@ end)
-- Homebrew Update Indicator
--------------------------------------------------------------------------------
+local homebrewIconWhite = hs.image
+ .imageFromPath('~/.hammerspoon/images/homebrew-white.png')
+ :setSize(hs.geometry.size(16, 16))
+
local homebrewMenubar = hs.menubar.new()
+homebrewMenubar:setIcon(homebrewIconWhite)
homebrewMenubar:setClickCallback(function()
hs.applescript.applescript([[
@@ -82,12 +87,53 @@ function updateHomebrewMenubar()
local _, numOutdated = outdated:gsub('\n', '\n')
if numOutdated > 0 then
- homebrewMenubar:setTitle(string.format('🍺 %s', numOutdated))
+ homebrewMenubar:setTitle(string.format(' %s', numOutdated))
homebrewMenubar:setTooltip(outdated)
else
- homebrewMenubar:delete()
+ homebrewMenubar:setTitle('')
+ homebrewMenubar:setTooltip('Up to date')
end
end
updateHomebrewMenubar()
hs.timer.doEvery(3600, updateHomebrewMenubar)
+
+--------------------------------------------------------------------------------
+-- Slack Message Indicator
+--------------------------------------------------------------------------------
+
+local slackIconWhite = hs.image
+ .imageFromPath('~/.hammerspoon/images/slack-white.png')
+ :setSize(hs.geometry.size(16, 16))
+
+local slackMenubar = hs.menubar.new()
+slackMenubar:setIcon(slackIconWhite)
+
+slackMenubar:setClickCallback(function()
+ hs.application.launchOrFocus('Slack')
+end)
+
+function updateSlackMenubar()
+ local dock = hs.axuielement.applicationElement('Dock')
+ local children = dock:attributeValue('AXChildren')
+
+ if children and children[1] and children[1]:attributeValue('AXRole') == 'AXList' then
+ local list = children[1]:attributeValue('AXChildren')
+ for _, v in pairs(list) do
+ if v:attributeValue('AXTitle') == 'Slack' then
+ local label = v:attributeValue('AXStatusLabel') or '0'
+
+ if label == '0' then
+ slackMenubar:setTitle('')
+ slackMenubar:setTooltip('No unread messages')
+ else
+ slackMenubar:setTitle(string.format(' %s', label))
+ slackMenubar:setTooltip(string.format('%s unread message(s)', label))
+ end
+ end
+ end
+ end
+end
+
+updateSlackMenubar()
+hs.timer.doEvery(60, updateSlackMenubar)