Skip to content

add find_by_pid - #142

Merged
acrisci merged 2 commits into
altdesktop:masterfrom
geeseven:find_by_pid
Jan 4, 2020
Merged

add find_by_pid#142
acrisci merged 2 commits into
altdesktop:masterfrom
geeseven:find_by_pid

Conversation

@geeseven

@geeseven geeseven commented Jan 2, 2020

Copy link
Copy Markdown
Contributor

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

acrisci commented Jan 3, 2020

Copy link
Copy Markdown
Member

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

@geeseven

geeseven commented Jan 3, 2020

Copy link
Copy Markdown
Contributor Author

@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

acrisci commented Jan 4, 2020

Copy link
Copy Markdown
Member

👍

@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