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

add find_by_pid #142

Merged
merged 2 commits into from
Jan 4, 2020
Merged

add find_by_pid #142

merged 2 commits into from
Jan 4, 2020

Conversation

geeseven
Copy link
Contributor

@geeseven geeseven commented Jan 2, 2020

Add a way to find a container based on pid.

In [1]: import i3ipc                                               

In [2]: i3 = i3ipc.Connection()                                    

In [3]: x = i3.get_tree().find_by_pid(1337)                        

In [4]: x.pid                                                      
Out[4]: 1337

@acrisci
Copy link
Member

acrisci commented Jan 3, 2020

I think this is a case where you could expect multiple windows for one pid.

@geeseven
Copy link
Contributor Author

geeseven commented Jan 3, 2020

@acrisci, thanks for the timely reply. That is a good point. I have made the requested change.

In [1]: import i3ipc                                                                                                                    

In [2]: i3 = i3ipc.Connection()                                                                                                         

In [3]: y = i3.get_tree().find_by_pid(1384)                                                                                             

In [4]: y[0].id                                                                                                                         
Out[4]: 11

In [5]: y[0].workspace().name                                                                                                           
Out[5]: '1'

In [6]: y[1].id                                                                                                                         
Out[6]: 344

In [7]: y[1].workspace().name                                                                                                           
Out[7]: '10'

@acrisci
Copy link
Member

acrisci commented Jan 4, 2020

👍

@acrisci acrisci merged commit 16906a0 into altdesktop:master Jan 4, 2020
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

Successfully merging this pull request may close these issues.

2 participants