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

@ -100,32 +100,32 @@ in
google-cloud-sdk google-cloud-sdk
]; ];
home.activation = { # home.activation = {
aliasApplications = # aliasApplications =
let # let
apps = pkgs.buildEnv { # apps = pkgs.buildEnv {
name = "home-manager-applications"; # name = "home-manager-applications";
paths = config.home.packages; # paths = config.home.packages;
pathsToLink = "/Applications"; # pathsToLink = "/Applications";
}; # };
in # in
lib.hm.dag.entryAfter [ "writeBoundary" ] '' # lib.hm.dag.entryAfter [ "writeBoundary" ] ''
# Install MacOS applications to the user environment. # # Install MacOS applications to the user environment.
HM_APPS="$HOME/Applications/Home Manager Apps" # HM_APPS="$HOME/Applications/Home Manager Apps"
# Reset current state # # Reset current state
[ -e "$HM_APPS" ] && $DRY_RUN_CMD rm -r "$HM_APPS" # [ -e "$HM_APPS" ] && $DRY_RUN_CMD rm -r "$HM_APPS"
$DRY_RUN_CMD mkdir -p "$HM_APPS" # $DRY_RUN_CMD mkdir -p "$HM_APPS"
# .app dirs need to be actual directories for Finder to detect them as Apps. # # .app dirs need to be actual directories for Finder to detect them as Apps.
# The files inside them can be symlinks though. # # The files inside them can be symlinks though.
$DRY_RUN_CMD cp --recursive --symbolic-link --no-preserve=mode -H ${apps}/Applications/* "$HM_APPS" || true # can fail if no apps exist # $DRY_RUN_CMD cp --recursive --symbolic-link --no-preserve=mode -H ${apps}/Applications/* "$HM_APPS" || true # can fail if no apps exist
# Modes need to be stripped because otherwise the dirs wouldn't have +w, # # Modes need to be stripped because otherwise the dirs wouldn't have +w,
# preventing us from deleting them again # # preventing us from deleting them again
# In the env of Apps we build, the .apps are symlinks. We pass all of them as # # In the env of Apps we build, the .apps are symlinks. We pass all of them as
# arguments to cp and make it dereference those using -H # # arguments to cp and make it dereference those using -H
''; # '';
}; # };
}; };

View file

@ -475,22 +475,33 @@ hs.hotkey.bind(modifiers.window, "f", facileCaptpure)
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
local notmuchTaskRunning = false local notmuchTaskRunning = false
local function refreshNotmuchMenubar() local function refreshNotmuchMenubar(currentlyRunning)
hs.task.new("@notmuchMails@", function(exitCode, stdout, stderr) hs.task.new("@notmuchMails@", function(exitCode, stdout, stderr)
if currentlyRunning then
stdout = "R: " .. stdout
end
print(stdout) print(stdout)
notmuchMenubar:setTitle(hs.styledtext.new(stdout)) notmuchMenubar:setTitle(hs.styledtext.new(stdout))
end):start() end):start()
end end
notmuchMenubar = hs.menubar.new() local function notmuchTimerFunction()
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()
if not notmuchTaskRunning then if not notmuchTaskRunning then
refreshNotmuchMenubar(true)
notmuchTaskRunning = true notmuchTaskRunning = true
hs.task.new("/etc/profiles/per-user/ragon/bin/zsh", 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() function() return false end, { "-c", "syncmail" }):start()
end 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) end)
notmuchTimer = hs.timer.doEvery(300, notmuchTimerFunction)