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

Feature: Only one instance of albert #158

Closed
wants to merge 10 commits into from

Conversation

idkCpp
Copy link
Contributor

@idkCpp idkCpp commented Apr 25, 2016

Solving issue #23 and #123:
Write the PID into the running-indicator file.
If the file already exists check if the PID is still valid.
If so, send SIGUSR1 to cause the running instance to bring its widget to front and terminate the new instance.
If the PID is invalid, start normally and print the error message.

Also there is a little update for the Query object.
If you want to launch shell applications from albert you have case-sensitive input. So I implemented Query::originalSearchTerm() which returns the original user input untrimmed.

idkCpp added 10 commits April 22, 2016 22:33
Added method
  const QString &originalSearchTerm() const;
to the Query and QueryPrivate class.
This is intended for plugins that have case sensitive functionality.
E.g. a shell launcher.
Now writing the pid into the running-indicator-file.
If the file already exists check if the pid is still running.
If so, terminate.
If not, proceed with "not graciously terminated" message.
If the file does not exist, create it and proceed.
If the pid in the running-indicator-file is valid.
Send SIGUSR1 to this pid.
When receiving SIGUSR1 bring the widget to front.
It is unnecessary to send two signals to the other albert instance.
One is enough to get the functionality.

Bug fix:
If albert was not terminated cleanly the file has still the invalid PID.
If albert starts and detects an invalid PID it will proceed but not update
the PID. So if a second instance is started the invalid PID will be detected
agail and still not updated and so multiple alberts will be running.
To fix this, invalid PIDs will simply be updated.
Conflicts:
	src/application/albertapp.cpp
@idkCpp idkCpp closed this Apr 29, 2016
@idkCpp idkCpp deleted the feature_only_one_instance branch October 7, 2016 08:16
@liul85
Copy link

liul85 commented Nov 2, 2016

Hi,
will this feature be included in next release?

thanks!

@idkCpp
Copy link
Contributor Author

idkCpp commented Nov 2, 2016

Hi, if you're coming to this via the issue 123, I'm sorry but this was a mistake at my side. This issue is completely unrelated to 123.
The part concerning 23 is already implemented.

@liul85
Copy link

liul85 commented Nov 2, 2016

Hi there,

Thanks for the clarification, got it! looking forward for the fix of issue 123.

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

Successfully merging this pull request may close these issues.

3 participants