DomT4 / homebrew-autoupdate

:tropical_drink: An easy, convenient way to automatically update Homebrew.
BSD 2-Clause "Simplified" License
987 stars 54 forks source link

Notification Rollout & Implementation [Tracking] #43

Closed DomT4 closed 6 months ago

DomT4 commented 3 years ago

TO-DO:

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.

buschtoens commented 3 years 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

DomT4 commented 2 years ago

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.

erikw commented 2 years ago

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.

1.

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: Screen Shot 2022-04-19 at 18 39 26

2.

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.

Screen Shot 2022-04-19 at 18 40 05

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.

Thanks for a great tool keeping our systems up-to-date! :)

buschtoens commented 2 years ago

@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:

Screen Shot 2022-04-19 at 18 39 26

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.

erikw commented 2 years ago

@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?