Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if another instance of display-switch is running and terminate #155

Open
jannikac opened this issue Dec 2, 2024 · 0 comments
Open

Comments

@jannikac
Copy link
Contributor

jannikac commented Dec 2, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant