htop icon indicating copy to clipboard operation
htop copied to clipboard

Add options to display parents and children processes of filtered pro…

Open yurenchen000 opened this issue 3 years ago • 10 comments

This PR based on @ashamza 's work https://github.com/hishamhm/htop/pull/973#issue-356794743 https://github.com/htop-dev/htop/issues/76#issuecomment-749169626

// co-authors added in commits seem doesn't link to github users

The only thing I did was update the patch to fit the current version code.

yurenchen000 avatar Nov 27 '22 08:11 yurenchen000

Exactly what I wanted. Works good for me.

vlada-dudr avatar Jan 14 '23 20:01 vlada-dudr

Very nice work @yurenchen000. This should have a key binding to be quickly toggled as well. May be Shift-F4 + Ctrl-F4? (Marked the typo Childern, please fix)

got it, I'll fix typo right now.

but I'm not sure if I can add keybinding for it

yurenchen000 avatar Jan 15 '23 19:01 yurenchen000

I think those options should probably be exclusive: Either show parents or children, but showing both does not make any sense with filtering.

I think it has practical uses, imagine this scenario:

  • filter by bash
    • view It's parents (ancestors): who opened it, a ssh or tmux
    • view It's children (descendants): what's it doing, run vim or some service

// equivalent to viewing its family tree

yurenchen000 avatar Jan 16 '23 04:01 yurenchen000

I was assuming this refered to the whole tree, not just the next level in each direction. In that case having both makes sense.

BenBE avatar Jan 16 '23 07:01 BenBE

Also, do these options make sense in flat view or are they intended for tree mode only?

tanriol avatar Jan 16 '23 14:01 tanriol

I was assuming this refered to the whole tree, not just the next level in each direction. In that case having both makes sense.

@BenBE agree, use whole tree is my primary usage, if matched item can highlight it'll perfect

yurenchen000 avatar Jan 17 '23 15:01 yurenchen000

Also, do these options make sense in flat view or are they intended for tree mode only?

@tanriol yes, The current implementation can filter normally in non-tree view, But I also think it doesn't make much sense in non-tree view.

Did you mean that limit this functionality to tree view mode, And figure out a way to reuse the process tree information from the tree view?

yurenchen000 avatar Jan 17 '23 15:01 yurenchen000

Also, do these options make sense in flat view or are they intended for tree mode only?

Depending on the task it can make sense to have this available outside tree view too.

BenBE avatar Oct 08 '23 22:10 BenBE

anyone working on this ?

for now I am achieving similar with:

process_name=tmux; 
watch -n 1 -d "pgrep $process_name | xargs -I {} pstree -p {}"

thapakazi avatar Jul 04 '24 11:07 thapakazi