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 new menu layouts #29

Open
orhun opened this issue Nov 5, 2021 · 7 comments
Open

Add new menu layouts #29

orhun opened this issue Nov 5, 2021 · 7 comments
Labels
enhancement New feature or request

Comments

@orhun
Copy link
Owner

orhun commented Nov 5, 2021

Is your feature request related to a problem? Please describe.
It would be nice to have different menu layouts instead of having only one which is fixed. We already have the functionality for changing the block sizes and moving them around. This new menu(s) could be possibly change the overall layout for different use cases such as:

  • Kernel monitoring (dmesg) mode where the "Kernel Activities" block is maximized.
  • Inspection mode where only the module info is shown.

And a couple of other scenarios...

Describe the solution you'd like
Define a list of menu layouts and add a key binding for changing the current layout.

Describe alternatives you've considered
There could be a command-line argument for launching kmon with the given menu type. e.g. kmon --menu activities

Additional context
bpytop has something similar where you press m and the layout changes.

@orhun orhun added the enhancement New feature or request label Nov 5, 2021
@Muhammad-Owais-Warsi
Copy link
Contributor

I would love to contribute, but need a lot of help, as I have no idea on how to implement this. So any similar resources and docs would be of great help.

@orhun
Copy link
Owner Author

orhun commented Oct 10, 2024

@Muhammad-Owais-Warsi great to hear, I'm happy to help :)

You can start of by reading the Ratatui documentation/templates to get an idea how the project is structured: https://ratatui.rs/ (templates)

Then taking a look at the app.rs file would be a good idea. That's simply where the TUI state/drawing happens.

And then you can give a shot implementing it, ask any questions! 🙂

@Muhammad-Owais-Warsi
Copy link
Contributor

As per the docs, changing the constraints will effect the layour of the blocks. But when I changed the values and build it, I can't see any chnages. Let me know if a misunderstanding something.
Screenshot from 2024-10-11 15-48-45

@orhun
Copy link
Owner Author

orhun commented Oct 13, 2024

It depends on which constrains you are changing. Those seems to be the Table constraints, I think you need to look into lib.rs for the layout constraints.

@Muhammad-Owais-Warsi
Copy link
Contributor

In the lib.rs file on changing the constraints in lib.rs, for example on line number 42, it is written as Constraint::Percentage(100 - app.block_size.activities) which gives me the following output:

Screenshot from 2024-10-16 02-35-26

Changing the same line to Constraint::Percentage(50) gives me the following output:

Screenshot from 2024-10-16 02-35-56

Is this what we're trying to solve as per the issue? If I’m not mistaken, we also need to implement a key binding so that we can switch between different layouts. Let me know if I misunderstood something.

Thanks :)

@orhun
Copy link
Owner Author

orhun commented Oct 16, 2024

Yes, we want to change the constraints and also the order of the layouts. If you play around with the tool a bit, you might realize that sometimes the text does not fit the exact area - we want to provide multiple layout options for improving the user experience in those cases.

Take a look at bpytop's different UI modes (mini, detailed, etc) for inspiration :)

@Muhammad-Owais-Warsi
Copy link
Contributor

Yes, we want to change the constraints and also the order of the layouts. If you play around with the tool a bit, you might realize that sometimes the text does not fit the exact area - we want to provide multiple layout options for improving the user experience in those cases.

Take a look at bpytop's different UI modes (mini, detailed, etc) for inspiration :)

Thanks, I'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants