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

Use 'pgrep -o' instead of 'pidof -s' to get the PID of status bar #190

Merged
merged 1 commit into from
Oct 15, 2021
Merged

Use 'pgrep -o' instead of 'pidof -s' to get the PID of status bar #190

merged 1 commit into from
Oct 15, 2021

Conversation

UtkarshVerma
Copy link
Contributor

This is being done to extend compatibility to dwmblocks-async which creates a subprocess, because of which pidof -s dwmblocks returns the PID of the subprocess, instead of the parent, which handles the signals.

Without this PR, dwmblocks-async doesn't get click events.

Below is a quick comparison of both commands. The PID of the parent is 21677.

❯ pidof dwmblocks
21678 21677
❯ pgrep dwmblocks
21677
21678
❯ pidof -s dwmblocks
21678
❯ pgrep -o dwmblocks
21677

@bakkeby
Copy link
Owner

bakkeby commented Oct 15, 2021

This would break for anyone not using your version of dwmblocks though.

@UtkarshVerma
Copy link
Contributor Author

UtkarshVerma commented Oct 15, 2021

No, it's backwards compatible.
pidof -s just gets the PID of the latest instance of dwmblocks. As long as only one instance of dwmblocks is running, pgrep -o does the same job.

@bakkeby
Copy link
Owner

bakkeby commented Oct 15, 2021

Yes that should be fine then. Even if you were have more than one instance of dwmblocks running then using pidof wouldn't reliably give you the right instance either.

@bakkeby bakkeby merged commit ce270a3 into bakkeby:master Oct 15, 2021
@UtkarshVerma
Copy link
Contributor Author

@bakkeby could you please label this PR as 'hacktoberfest-accepted'?

@bakkeby
Copy link
Owner

bakkeby commented Oct 15, 2021

Done.

SunJukebox pushed a commit to SunJukebox/dwm that referenced this pull request Aug 6, 2022
Use 'pgrep -o' instead of 'pidof -s' to get the PID of status bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants