Xfce Forum

Sub domains
 

You are not logged in.

#1 2017-10-26 01:54:05

bodqhrohro
Member
Registered: 2013-05-22
Posts: 4

Can I align text horizontally in genmon plugin?

Pango Text Attribute Markup Language seems not to support such an attribute. I found an article about tables in Pango that support alignment but can't figure out how and if I can use them in genmon. Simply wrapping the txt body in || || does not have any effect, the bars are displayed as is.

Offline

#2 2017-10-26 15:30:00

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,950

Re: Can I align text horizontally in genmon plugin?

I don't believe that the Pango Markup supported by genmon supports tables.

Which version of the plugin are you using? The GTK2 version or the GTK3 one?

If you are using the GTK3 version , you can use CSS to pad any of the sides:

#genmon-XX* {
   padding-top: 10px;
   padding-left: 10px;
   padding-right: 10px;
   padding-bottom: 10px;
}

...where "XX" is the plugin designator (hover over the plugin in the Panel Properties, Items tab to get this value). Also note that the "#" at the beginning is not a comment marker but a widget identifier in CSS.

Or if you want to just affect the label element of the plugin only (and not all elements):

#genmon-XX>widget>box>box>label {
   padding-top: 10px;
   padding-left: 10px;
   padding-right: 10px;
   padding-bottom: 10px;
}

Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2017-10-26 16:00:45

bodqhrohro
Member
Registered: 2013-05-22
Posts: 4

Re: Can I align text horizontally in genmon plugin?

Thank you. Looks like this plugin is still using libgtk-x11-2.0.so.0 in my distribution. Waiting for updates…

Would it accept text-align: center; or margin: 0 auto; rules as well?

And does asterisk without preceding space have special meaning in GTK+ implementation of CSS or the space is accidentally omitted?

Offline

#4 2017-10-26 16:17:56

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,950

Re: Can I align text horizontally in genmon plugin?

bodqhrohro wrote:

Would it accept text-align: center; or margin: 0 auto; rules as well?

Unfortunately no because the GtkLabel widget automatically sizes itself for the space it needs. There is no easy way in GTK3 to specify a fixed size for the widget (or at least that I know of). I guess you could resort to using cairo and canvases to draw the text and images, but that seems overkill for what this plugin was initially designed to do. Right now, the only way to centre it is to pad the sides with spaces (GTK2) or use padding CSS directives (GTK3).

Are you trying to centre varying widths of text output in a pre-defined space? If so, there is an enhancement request for this already.

And does asterisk without preceding space have special meaning in GTK+ implementation of CSS or the space is accidentally omitted?

No that is correct. The "*" right after (no space) the widget designator means that it applies to all sub-widgets as well. The second css snippet option shows how to affect a certain widget within the plugin for the current GTK3 release of the plugin (version 4).

In development in the git tree, I have added some more CSS style classes so you can more easily affect certain elements of the plugin. See: this commit. However, this hasn't yet been released and is still in testing mode.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

Board footer

Powered by FluxBB