tonsky / AnyBar

OS X menubar status indicator
Eclipse Public License 1.0
5.92k stars 159 forks source link

Start automatically on traffic #92

Open WhyNotHugo opened 2 years ago

WhyNotHugo commented 2 years ago

launchd has a functionality where it can bind to a socket, and when there's incoming traffic, it starts a service and passes that on. It should be usable by Anybar.

I'm not sure on the details. On Linux, systemd allows this, and I know they copied this design feature from macOS, and that's the extent of my familiarity on it. This link seems very useful. plist is a keyword here.

With such a setup, AnyBar could be set up to start automatically when an application attempts to connect to it, without requiring any change on client's side.

tonsky commented 2 years ago

Sounds cool, would be great if you could provide a PR to README

onderweg commented 1 year ago

launchd has a functionality where it can bind to a socket, and when there's incoming traffic, it starts a service and passes that on. It should be usable by Anybar.

I'm not sure on the details. On Linux, systemd allows this, and I know they copied this design feature from macOS, and that's the extent of my familiarity on it. This link seems very useful. plist is a keyword here.

With such a setup, AnyBar could be set up to start automatically when an application attempts to connect to it, without requiring any change on client's side.

I don't think this would be really applicable to AnyBar. What launchd (and systemd) can do is: listen to a network port, spawn a new instance of a process when a connection is made and send the incoming data to the standard input of the spawned process (AnyBar in this case)

But that would mean that for every incoming UDP connection (every status change), a new AnyBar instance will start. Also AnyBar would nee to be able to accept input from stdin.