notmuch indicator tuning

This commit is contained in:
Philipp Hochkamp 2022-11-15 00:07:53 +01:00
parent 42ddb294ef
commit 89fdc7570e
No known key found for this signature in database
GPG key ID: 3676AB4CB36E5641
2 changed files with 42 additions and 31 deletions

View file

@ -475,22 +475,33 @@ hs.hotkey.bind(modifiers.window, "f", facileCaptpure)
----------------------------------------------------------------------------------------------------
local notmuchTaskRunning = false
local function refreshNotmuchMenubar()
local function refreshNotmuchMenubar(currentlyRunning)
hs.task.new("@notmuchMails@", function(exitCode, stdout, stderr)
if currentlyRunning then
stdout = "R: " .. stdout
end
print(stdout)
notmuchMenubar:setTitle(hs.styledtext.new(stdout))
end):start()
end
notmuchMenubar = hs.menubar.new()
notmuchMenubar:setClickCallback(function() hs.task.new("@myEmacs@/bin/emacsclient", nil, function() return false end,
{ "-a", "", "--eval", "(=notmuch)" }):start()
end)
notmuchTimer = hs.timer.doEvery(300, function()
local function notmuchTimerFunction()
if not notmuchTaskRunning then
refreshNotmuchMenubar(true)
notmuchTaskRunning = true
hs.task.new("/etc/profiles/per-user/ragon/bin/zsh",
function() notmuchTaskRunning = false; refreshNotmuchMenubar() end,
function() notmuchTaskRunning = false; refreshNotmuchMenubar(false) end,
function() return false end, { "-c", "syncmail" }):start()
end
end
notmuchMenubar = hs.menubar.new()
notmuchMenubar:setClickCallback(function(options)
if options.shift then
notmuchTimerFunction()
else
hs.task.new("@myEmacs@/bin/emacsclient", nil, function() return false end,
{ "-c", "-a", "", "--eval", "(=notmuch)" }):start()
end
end)
notmuchTimer = hs.timer.doEvery(300, notmuchTimerFunction)