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

Fix spacing for inline widgets #866

Merged
merged 4 commits into from
Oct 19, 2020
Merged

Fix spacing for inline widgets #866

merged 4 commits into from
Oct 19, 2020

Conversation

DCsunset
Copy link
Contributor

I have added a spacing setting for each widget that can control the spacing.
The Inline setting will remove the leading space, which is very useful for sub-widget in some blocks.
The Hidden setting will remove both the leading space and trailing space, which is useful for hidden blocks.

To demonstrate the usage, I have also fixed the spacing for nvidia_gpu block.

This PR should resolve the issue #800.

@ammgws
Copy link
Collaborator

ammgws commented Oct 15, 2020

Can you paste the before and after nvidia-gpu block output here (i.e. the raw output from i3status-rs when run from a commandline)?

src/widget.rs Outdated Show resolved Hide resolved
src/widget.rs Show resolved Hide resolved
@DCsunset
Copy link
Contributor Author

Before:

{"background":"#000000FF","color":"#CCCCCCFF","full_text":"  GeForce MX150 ","markup":"pango","name":"f6a82f89f0f241dd838918b61a6deb6c","separator":false,"separator_block_width":0},
{"background":"#000000FF","color":"#CCCCCCFF","full_text":" 0 % ","separator":false,"separator_block_width":0},
{"background":"#000000FF","color":"#CCCCCCFF","full_text":" 52°C ","separator":false,"separator_block_width":0}

After:

{"background":"#000000FF","color":"#CCCCCCFF","full_text":"  GeForce MX150 ","markup":"pango","name":"547e37d81bae45cd9e96ecfc4713ac12","separator":false,"separator_block_width":0},
{"background":"#000000FF","color":"#CCCCCCFF","full_text":"0 % ","separator":false,"separator_block_width":0},
{"background":"#000000FF","color":"#CCCCCCFF","full_text":"41°C ","separator":false,"separator_block_width":0}

Leading spaces of both the temperature and utilization are removed.
Besides, when the name of the GPU is hidden, its trailing spaces will also be removed.

@DCsunset
Copy link
Contributor Author

DCsunset commented Oct 15, 2020

I have also fixed the comment and squashed it into the first commit.

Copy link
Collaborator

@ammgws ammgws left a comment

Choose a reason for hiding this comment

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

Apply to other blocks as well. Might as well fix them all at once.

@DCsunset
Copy link
Contributor Author

I have fixed some blocks that I found with inconsistent spacing. Are there other blocks that need fixing as well?

@ammgws
Copy link
Collaborator

ammgws commented Oct 19, 2020

IIRC one would be the music block (the buttons at least).

@ammgws
Copy link
Collaborator

ammgws commented Oct 19, 2020

We can handle those in another PR

Thanks for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants