-
Notifications
You must be signed in to change notification settings - Fork 57
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
Allow configuring sidebar default pane action (new pane vs replace) #74
Conversation
Thanks for the contribution! This looks great and makes sense. Regarding your question around config vs settings. Our Settings structs are the runtime settings that can be affected by user interactions and are persisted between sessions via persisting that dashboard state to disk. Since this is a purely config option, we can keep it isolated to You bring up a great point though and we don't have proper separation between our settings and config. We should probably separate these and have proper From implementations and convert them when dashboard / panes are created. This is probably good to go and we can follow up with a bigger refactor to enforce this separation of concerns. No reason to add that complexity here when this follows the existing setup we're currently using. |
Thanks for your feedback! I've passed down the config into the dashboard after the state restore which seems to avoid the problem of the state capturing the first config and then never allowing it to change. I've also then propagated to the sidebar via I've also renamed the option to Local testing seems to be good, please let me know if there's anything else. 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks good! Just one minor nit, we can avoid duplicating Config data across state since we can just pass it down during view
.
src/screen/dashboard.rs
Outdated
@@ -17,6 +17,7 @@ use crate::widget::{selectable_text, Element}; | |||
const SAVE_AFTER: Duration = Duration::from_secs(3); | |||
|
|||
pub struct Dashboard { | |||
config: dashboard::Config, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we don't plan to ever modify config at runtime, it can be a presentation only item. We can just pass it down during view
from our root state and reference it when building the view tree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean, how does it look now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for this contribution :D I'll follow up next week with a refactor to remove all Settings
from config with proper From conversions.
@casperstorm can you just do a quick test of this before we merge? I'm away from a computer for the next few days.
Happy to contribute, I'm very much enjoying Halloy. Keep up the great work! One final thing, do you prefer things to be rebased down into a single commit or shall I leave the history as-is? |
Commit history is fine :) The only preference I have is preferring rebasing a feature branch to master vs back-merging when resolving conflicts. But this isn't a hard rule or anything. |
This is great 👍🏻 |
4edb6e3
to
4b4df7d
Compare
4b4df7d
to
d7664a4
Compare
I've rebased on top of your most recent changes and updated the changelog/sample config. |
This is somewhat of an attempt to modify the default click behaviour of channels in the sidebar. Today, each channel clicked opens a new pane, which quickly clutters up when dealing with lots of channels. Ideally I'd like to be able to just replace the focused pane instead, allowing me to right-click to open new panes as needed, but to not clutter up the window otherwise.
I figured just changing the default behaviour without configurability is probably a bad thing, so in lieu of that, I've tried to add a new configuration option that lets you choose either
NewPane
(today's behaviour) orReplacePane
(my proposed behaviour):The fundamental new-vs-replace pane part works but I am struggling with the config side of things. I am not really a native Rustacean (please go easy on me) and I am not really sure of the best place to put this config item or how to pass it down the hierarchy.
It appears that the
Dashboard
state gets written out to a file, so that means that any config there also gets written into the state file and therefore later changes to the option inconfig.yaml
are ignored. I'd appreciate any pointers on what the best approach here should be or if it should go somewhere else.