Skip to content

Add percentage width to Todo Mode#1616

Merged
rxhanson merged 6 commits intorxhanson:mainfrom
tomdaly:tomdaly/1613/add-pct-width-todo-mode
Jul 11, 2025
Merged

Add percentage width to Todo Mode#1616
rxhanson merged 6 commits intorxhanson:mainfrom
tomdaly:tomdaly/1613/add-pct-width-todo-mode

Conversation

@tomdaly
Copy link
Contributor

@tomdaly tomdaly commented Jul 9, 2025

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

  • adds a new default todoSidebarWidthUnit with default value .pixels
    • can be set in terminal via defaults write com.knollsoft.Rectangle todoSidebarWidthUnit -int 1 (1 for pixels, 2 for percentage)
  • updates Todo with calculations to allow existing value todoSidebarWidth to be specified as a percentage value
    • adds handling for values over 100 when % selected (i.e. does nothing instead of resizing to >100%)
  • adds UI drop-down for 'px' or '%' selection

screenshots

before after (% selected) after (interaction)
Screenshot 2025-07-09 at 21 01 28 Screenshot 2025-07-09 at 21 02 38 Screenshot 2025-07-09 at 17 08 08

happy to drop back to just the terminal command if this is too much change for one PR!

Comment on lines +182 to +184
if (Defaults.todoSidebarWidth.cgFloat > 100) {
return;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 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!

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice! Good catch on using the Todo screen rather than the main screen.

@rxhanson rxhanson merged commit fba83c1 into rxhanson:main Jul 11, 2025
1 check passed
@tomdaly tomdaly deleted the tomdaly/1613/add-pct-width-todo-mode branch July 11, 2025 10:52
liangyuetian added a commit to liangyuetian/Rectangle.For.Windows that referenced this pull request Mar 19, 2026
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants