cjbassi / ytop

A TUI system monitor written in Rust
MIT License
2.16k stars 84 forks source link

[WIP] Ability to not follow a process #82

Closed crodjer closed 2 years ago

crodjer commented 4 years ago

This introduces an ability to not-follow a process in the proc widget. I having to do gg whenever I visit ytop to find out the process which is currently using high mem/CPU. It'd be great to have the ability to not always track the currently highlighted process.

This patch is a POC for that. What it does is:

I understand this cannot be merged as is, but I'd like to start a discussion. If this makes sense, I'd like suggestions on what can be changed in the patch to merge it in.

crodjer commented 4 years ago

@cjbassi I was wondering if you could take a quick glance at the idea? And if it makes sense, the implementation. I have been using this in my local ytop and finding it useful.

cjbassi commented 4 years ago

Yeah I've looked over it a bit but I'm going to need a bit more time. I'll get to it the next chance I get. Thanks for the pr btw.

cjbassi commented 4 years ago

Point number one looks good. I'm still debating on point number two, originally I was thinking of adding a key bind to disable and enable following the process. Also I'm not really a fan of point number three, if we do set up a key bind I think it should be a unique key.

Also, cc #53

crodjer commented 4 years ago

Point number one looks good.

Great.

I'm still debating on point number two, originally I was thinking of adding a key bind to disable and enable following the process.

Sure, I'll wait for what you think makes sense as the utilities behaviour, based on the philosophy. I have also made not following current process as the default, which you may want to make into a flag.

Also I'm not really a fan of point number three, if we do set up a key bind I think it should be a unique key.

I agree there. I went the path of least resistance for the POC. Any binding could work here, as long as it is a possibility.

Also, cc #53

crodjer commented 4 years ago

@cjbassi Made some more changes:

Support for toggling follow proc

cjbassi commented 4 years ago

Nice, I'm liking the changes. Couple things:

  1. We should add follow proc help to the README
  2. We need to increment the height of the help widget because part of it is cut off now
  3. I decided that I actually really like the way htop handles process selection, and I think we should replicate that. So whenever the cursor is moved, we stop sorting the processes for ten seconds and we stop following the current process. If you would be up for that :) Thanks for the work already by the way.
crodjer commented 4 years ago

Nice, I'm liking the changes. Couple things:

1. We should add follow proc help to the README

Sure, will do.

2. We need to increment the height of the help widget because part of it is cut off now

Ahh, okay. Will fix.

3. I decided that I actually really like the way htop handles process selection, and I think we should replicate that. So whenever the cursor is moved, we stop sorting the processes for ten seconds and we stop following the current process. If you would be up for that :) Thanks for the work already by the way.

I can take this up. I wasn't aware of this in htop. This totally makes sense and will make it more intuitive while managing processes, specially in bulk. I'll try to send a PR over the weekend.

crodjer commented 4 years ago

I switched my full time job this month and have been busy, so couldn't focus on this yet. I'll try to make the changes we discussed as soon as I find some time.