Add desktop icon label width scaling at runtime#3736
Open
mg-code-solutions wants to merge 1 commit intolinuxmint:masterfrom
Open
Add desktop icon label width scaling at runtime#3736mg-code-solutions wants to merge 1 commit intolinuxmint:masterfrom
mg-code-solutions wants to merge 1 commit intolinuxmint:masterfrom
Conversation
Contributor
|
Is this change intended only for nemo-desktop? |
Author
Yes, this change is intended only for nemo-desktop, not nemo (file manager). The last two images were meant to show how the nemo (file manager) had not changed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This pull request addresses the issue where desktop icon labels can overlap when horiztonal grid spacing is reduced (typically when trying to get the icons closer together and/or closer to the left hand edge of the desktop).
Change Target
This change is only for nemo-desktop, nemo's (file manager) behaviour should be unchanged.
Background
The issue of overlapping desktop icon labels has been raised in the following bug #2700 (linuxmint locked as too heated and limited conversation to collaborators on May 30, 2021).
Discovery
The width of the desktop icon label is currently hard coded in libnemo-private/nemo-icon-info.h; for each particular zoom level (e.g. #define NEMO_DESKTOP_TEXT_WIDTH_STANDARD 110).
The layout system (pango) uses these values to set the maximum width for which the label name is to be formatted.
If the text is short, then the layout rectangle is generally less than the maximum width.
If the text is long, then the text displayed is capped at the hard coded width maximum and is broken down over multiple lines.
The desktop icons will display a maximum of two lines, with an ellipsis added at the end of the second line in lieu of any omitted text, if required. The omitted text becomes visible when the mouse enters the icon / label area.
As icons are brought closer together, these hard coded maximum width values cause the labels to start to overlap. Aesthetically, a displeasing outcome.
Solution (tentative)
The solution presented is to add the ability to scale the width of the desktop label at runtime, via the "desktop overlay" window that appears when right-clicking on the desktop and selecting "Customise".
Much like the horizontal and vertical grid spacing sliders, a new "Icon Label Width Scale" (feel free to rename) slider has been added. This new slider allows the user to control the maximum width of the desktop icon label. Currently, from 50% to 200% of the hard coded values.
Also, like the horizontal and vertical grid adjusts, the desktop label width scale adjust value is stored in and loaded from the ~/.config/nemo/desktop.metadata file.
All the plumbing has been implemented to replicate the same behaviour produced when interacting with the existing grid spacing sliders.
Screenshots
The following imagines show a portion of a 1080x1920 desktop with a background image of a 96x104 pixel grid (effectively giving 10 icons down and 20 icons across).
A variety of long and short label texts are on display.
The grid spacing has been set to horizontally: center the desktop icons within its "grid cell", and vertically: place the icons near the top of their respective "grid cell".
Image shows the modified "customise" window.
Image shows the current layout with hard coded maximum desktop icon label widths, where the longer labels overlap.
Image show the new layout with the desktop icon label scaling set to reduce the maximum desktop icon label width, where the longer labels do not overlap.
Image shows Nemo (unmodified) file explorer running showing the Desktop icons
Image shows Nemo (modified) file explorer running showing the Desktop icons
Images 4. and 5. are effectively the same, just shown for visual reference.
First time attempting to contribute to an open source project. Valid, constructive criticisms welcomed.