I want to write a Java program that waits for an input and takes an action (for example, play an mp3 file) based on the input. Specifically, I want to know how I can tell my java program when/what desktop applications are launched/currently running.
Practical application of this is that I basically want to play a different sound file when different applications are launched.
Additionally, I'd like to know if it is possible to have a Java program do this by manipulating an existing program (for example, play a sound file from Groove music).
Please direct me to any resources that would help me with these goals, I don't know if Java is the best language for this but it's the only one I know. Thank you!