Description
While setting up display-switch I ran into an issue where i tried different configurations multiple times. I executed the program and exited it with ctrl c. However ctrl c doesn't seem to kill the process and just causes nothing to really happen. I tested this on Windows and I did expect ctrl c to just kill the process because if it should run in the background this is usually done by calling it with a systemd file or auto start in windows. This behavior caused me to have like 10 instances of display-switch running which seemed to race with each other.
So my proposal is to implement a function that checks if another instance of display-switch is already running and then terminates or prints a warning to the console.
I looked into this a bit and found this crate which can create advisory file locks in a cross-platform way https://docs.rs/fd-lock/latest/fd_lock/. I tried to get it to work but I couldn't figure it out, so I'm leaving an issue here. I hope you find this helpful.