Homebrew / homebrew-bundle

📦 Bundler for non-Ruby dependencies from Homebrew, Homebrew Cask and the Mac App Store.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Auto-start a cask after installation

vraravam opened this issue · comments

I was hoping that once brew installs a cask, there would also be a mechanism to start the app. This is super useful proceed with using the app as soon as the installation is successful. This could be similar to the restart_service option in the Brewfile as an optional config parameter. If this is ok, I would be willing to raise a PR for the same. wdyt?

This is not the same as the at_exit hook imho, since that is run once at the end of ALL installations. But, what I'm requesting is for each cask line to have the ability to start the application (so it need not be done for all apps that get installed - leaving that to the user's choice). Also, I'm not sure if at_exit runs if there's an error at an earlier point while installing from a Brewfile

I think this first requires a way for brew to start a cask independently of brew bundle

I think this first requires a way for brew to start a cask independently of brew bundle

did you mean for such a feature to be supported from the cmd-line brew first, and only then from the Brewfile's DSL?

Yeah, since the Brewfile DSL just runs brew functions under the hood.

I see various references to Bundle.system in this repo. I was thinking that would be the way to use the open command on macos to start the application. Wouldn't that suffice?

But how does one start a cask. How do you know what to start?

But how does one start a cask. How do you know what to start?

open command on macos like so: open /Applications/KeePassXC.app

But a lot of casks are pkg files, or contain multiple apps. So that will create an experience where it's just a gamble if it'll work

if that's the case, then my suggestion would be to let the user specify a system command to execute upon successful completion of the installation of each cask. That allows the flexibility to the user and they can choose to open 1 or more of those apps. Could we pivot to that?

sorry, but I'm a 👎 on this feature request for a couple of reasons.

  1. you don't "start" a cask. you install a cask which then extracts all the nessecary parts into your system. what you're talking about here is more related to services and being able to launch them. if you want this, I'd suggest looking at the individual cask/formula and seeing if it can be included in there. this is something that is already supported.
  2. as @SMillerDev mentioned, a cask isn't always a single executable and expecting the user to know which they want to target is unreasonable. similarly, it's unreasonable for bundle to guess as getting the wrong information is worse than not doing it at all since you've then incorrectly taken the user down another path.

I am likewise not in favor of this for the same reasons that Jacob is.

The at_exit method in a Brewfile should adequately handle this for your particular use case. at_exit runs just before the process exits for any reason as long as the process is still running. That is, it won't run if the process was killed. Within the bounds of the normal operation of brew bundle, at_exit should always run.

Passing on this for now, sorry!