Closed DomT4 closed 6 months ago
I've encountered a bug: #71 The new brew-autoupdate.app
notifier "steals the focus" from the prior window when displaying a notification.
Edit: and the fix is ready. #72
I've been fairly generous on the timeline (IMO) but moves towards Fully deprecate terminal-notifier, as it seems to be dead upstream at this point and provides a pretty suboptimal experience compared to native macOS notifications
are underway, which will allow/help facilitate adding more features to the newer style of notification without so much code sitting around for terminal-notifier
support: https://github.com/Homebrew/homebrew-autoupdate/commit/2574d2332d0e223150c788d36870ded4e0943574, https://github.com/Homebrew/homebrew-autoupdate/commit/2761e385524f8a3cf3645058fb24199d0e73f3fd.
Hey, great that a new notification system is being developed, as of the state of terminal-notifier.
I have two questions about the new notification system that is under development here.
Would it be possible to make it so that the icon of brew-autoupdate.app
does not show up in the Dock? I find it a bit disruptive to have visually things going on in the dock at the same time as notification in the uppe right corner. Ideally only the notification should pop up, no icon in the Dock.
I managed to capture it in a screenshot this time:
The notification shows one line of the update logs. I guess the last line? However just one chopped line is not very informative. At least a few lines would be needed for this to be informative.
When I click the notification with the logs, my expectation is that the full log file would open, maybe in macOS' Console.app
or TextEdit.app
. Instead the brew-autoupdate.app
opens in the dock and produces the same notification once more.
Now what actually would be really informative to have in the notification would be e.g.
Upgraded:
formula-1: from v1.2.3 to v1.3.0
formula-2 from v2.3.4 to v2.4.0
...
Thanks for a great tool keeping our systems up-to-date! :)
@erikw I'll try to answer your first question:
Would it be possible to make it so that the icon of
brew-autoupdate.app
does not show up in the Dock? I find it a bit disruptive to have visually things going on in the dock at the same time as notification in the uppe right corner. Ideally only the notification should pop up, no icon in the Dock.I managed to capture it in a screen shot this time:
If you check my PR #72, you can see that I added the -g
flag to launch the notifier in the background in order to not steal the focus from the current foreground application.
man open
tells me that besides -g
, there also is a -j
flag:
-g
Do not bring the application to the foreground.-j
Launches the app hidden.
You could try adding the -j
flag in addition to -g
to prevent the icon from showing up in the dock.
@buschtoens thanks, this looked promising from the manual. Unfortunately the command
$ /usr/bin/open -g -j /usr/local/Homebrew/Library/Taps/homebrew/homebrew-autoupdate/notifier/brew-autoupdate.app
still shows the icon in the Dock in the same way. I also tried with using just -j
which gave the same result. I'm on macOS 12.3.2
BTW.
From the first post in this issue
- using the one AppleScript applet
I understand this as brew-autoupdate.app
is a wrapper around and AppleScript? For applications in Obj-C and Swift I found some resources (#1, #2) showing how to hide the Dock icon, however these would not apply when the main application is an AppleScript I guess.
When I searched for solutions I found that one can add to brew-autoupdate.app/Contents/Info.plist
<key>LSUIElement</key>
<string>1</string>
This indeed hid the icon in the Dock, but unfortunately no notification was shown either :(
Any other ideas?
TO-DO:
[ ] Do a tighter match on the notification output so it only updates the intended part of the log, rather than getting a little overly enthusiastic and sharing the wrong lines.
[ ] Consider utilising
brew cleanup
or tweak this tool itself to periodically remove the log file so it doesn't become too large in size and/or increasingly slow to machine-read.[ ] Consider adding a notification for the start of the update process, i.e.
Homebrew Autoupdate Starting
or such.[ ] Consider adding a notification for background failures, even if we don't get too elaborate about it. This command logs the entire output to a file anyway, so it'd be easy enough to alert the user to the fact the command failed and to look at the log file to work out why if we wanted to keep it barebones. Ref: https://github.com/Homebrew/homebrew-autoupdate/issues/42.
[ ] Investigate whether the above can be achieved using the one AppleScript applet or whether because of the somewhat limited & finicky nature of applets I'd need to add unique applets for each case (which wouldn't really be a big burden, but isn't ideal).
[ ] Fully deprecate
terminal-notifier
, as it seems to be dead upstream at this point and provides a pretty suboptimal experience compared to native macOS notifications. This might involve waiting until macOS 12 (assuming whatever comes after Big Sur is called macOS 12) so that there's at least two recent versions of macOS supported by the new notifier.This issue supersedes https://github.com/Homebrew/homebrew-autoupdate/issues/25, https://github.com/Homebrew/homebrew-autoupdate/issues/15 & https://github.com/Homebrew/homebrew-autoupdate/issues/42.