Add percentage width to Todo Mode#1616
Add percentage width to Todo Mode#1616rxhanson merged 6 commits intorxhanson:mainfrom tomdaly:tomdaly/1613/add-pct-width-todo-mode
Conversation
| if (Defaults.todoSidebarWidth.cgFloat > 100) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
💬 this is pretty weak error handling (here and in ScreenDetection#L166)
I didn't want to edit the UI too much to display any error text/add a negative interaction, but if this lack of feedback might be unclear for the user then I'm happy to change this!
There was a problem hiding this comment.
Thanks for the PR, this is great!
The existing pixel input doesn't include any feedback for values that don't make sense, so to me it's acceptable to add this in without guardrails. If you're inclined to add anything in, though, I see no reason to turn it down. The other edge case that's weird (pre-existing) is if you delete the value or make it really small then the window is unnecessarily small until the value is changed.
One thing that might make sense to do as part of this PR is to automatically handle conversion between pixels and percentage when the dropdown is changed. This should be simple, since you can just grab the main screen dimensions and use those.
Let me know if you want to add more to the PR, otherwise I'm good with merging it.
There was a problem hiding this comment.
thank you for the feedback! it's really appreciated
converting between pixels and percentage is a great idea -- added this in 646a400
this is ready to merge once you're good with the new changes :)
There was a problem hiding this comment.
Oh nice! Good catch on using the Todo screen rather than the main screen.
* feat: add new default for Todo Mode sidebar width unit * feat: add calculations for percentage-based Todo Mode width * feat: allow changing Todo Mode width unit in Settings view * feat: handle Todo Mode width over 100% * feat: align Todo width drop-down with nearby components * feat: auto-convert pixels to percentage on Todo Mode unit change
resolves #1613
problem
the 'Todo Mode' setting allows for a fixed sidebar width for the selected Todo app, but this can cause problems if moving between different screen sizes (e.g. docking/undocking a laptop with a large monitor)
this can currently be worked around by changing the size manually each time, but becomes inconvenient if doing it often
solution
todoSidebarWidthUnitwith default value.pixelsdefaults write com.knollsoft.Rectangle todoSidebarWidthUnit -int 1(1for pixels,2for percentage)todoSidebarWidthto be specified as a percentage value100when%selected (i.e. does nothing instead of resizing to >100%)screenshots
happy to drop back to just the terminal command if this is too much change for one PR!