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

Support CSS text-align #366

Closed
pedrocr opened this issue Jun 3, 2019 · 18 comments
Closed

Support CSS text-align #366

pedrocr opened this issue Jun 3, 2019 · 18 comments
Labels
wontfix This will not be worked on

Comments

@pedrocr
Copy link
Contributor

pedrocr commented Jun 3, 2019

For things like sway/window it would be nice to have CSS support for text-align to be able to adjust how the text is displayed in the bar.

@Alexays
Copy link
Owner

Alexays commented Jun 11, 2019

Atm text-align is not supported on gtk label, we need to wait a gtk update

@Alexays Alexays added the wontfix This will not be worked on label Jun 11, 2019
@pedrocr
Copy link
Contributor Author

pedrocr commented Jun 11, 2019

Seems like gtk does that with something other than CSS:

https://developer.gnome.org/gtk3/stable/GtkLabel.html#gtk-label-set-justify

So maybe adding text-align is not in the plans.

@Alexays
Copy link
Owner

Alexays commented Jun 11, 2019

But for your case, why not simply move module to the left/right block?

@pedrocr
Copy link
Contributor Author

pedrocr commented Jun 11, 2019

The module is in the left block. But the actual text of the window title is centered and I wanted to make it left aligned. It's not too bad this way either, just a tweak to see if it felt better.

@Alexays
Copy link
Owner

Alexays commented Jun 11, 2019

Can you share me a screenshot?
Window title module width must not be larger than the text size

@pedrocr
Copy link
Contributor Author

pedrocr commented Jun 11, 2019

Sure, here it is:

waybar

Config is:

    "modules-left": ["sway/workspaces", "sway/window"],
    "modules-center": [],
    "modules-right": ["cpu", "memory", "temperature", "pulseaudio", "backlight", "network", "battery", "tray", 

I can add some CSS coloring on sway/window if that helps diagnose it.

@Alexays
Copy link
Owner

Alexays commented Jun 11, 2019

Fixed with 3c9b533

@Alexays Alexays closed this as completed Jun 11, 2019
@pedrocr
Copy link
Contributor Author

pedrocr commented Jun 11, 2019

Thanks. Just tested it. Now it's left aligned when put in modules-left and centered in the total bar when in modules-center, so seems to be working as intended. The previous behavior was actually not horrible though. It centered the window title in the space between left and right modules.

@krnl0138
Copy link

@pedrocr @Alexays Really sorry, but is it possible to get back to the previous state with centered and filled module between two others? Or to toggle between those options?

@MyNameIsCosmo
Copy link

Would using GtkJustification to get text-align: [left,center,right] be a course of action?

I'd be happy to start a PR implementing this if it would be accepted.

@Alexays
Copy link
Owner

Alexays commented Aug 14, 2019

@MyNameIsCosmo You can implement a justification for Label modules. it'll be a great improvement :)

@MatthiasGrandl
Copy link

So is there anything like this implemented? On a vertical bar, this would be very handy, as thing will look very messy if everything is left aligned.

@flipflop133
Copy link

flipflop133 commented Feb 12, 2021

Is there any progress on this? Doesn't GTK 4 fix the problem?
As you can see on the screenshot below, not having an align-center property makes things look quite ugly in this particular situation, isn't there any temporary workaround?
image
EDIT: as a temporary workaround I just removed the extra space between minutes and the AM/PM.
image

@Cornelius-Figgle
Copy link

image

same problem as @flipflop133, need to be able to center the text in the network module (specifically the signal strength, but ideally the whole module so it also applies to the Ethernet versions of this)

Any updates on how to do this?

@Runeword
Copy link

20230617_17h14m17s_grim
Same problem with any module.

@2hexed
Copy link

2hexed commented Feb 14, 2024

Hello, is there any workaround for this I can use?

@John-Dennehy
Copy link

Same alignment issue as others when using a vertical bar.

On a separate but related topic; is there somewhere I can find which css attributes do/not work? As far as I can see there is no mention of this in the styling wiki, so have lost days trying to get css working as expected (web dev by trade, but novice with linux).

@flipflop133
Copy link

Same alignment issue as others when using a vertical bar.

On a separate but related topic; is there somewhere I can find which css attributes do/not work? As far as I can see there is no mention of this in the styling wiki, so have lost days trying to get css working as expected (web dev by trade, but novice with linux).

afaik, waybar is using gtk 3 css, so you can look here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

10 participants