You are not logged in.

#1 2017-03-23 08:29:02

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

[solved] Non-linear conky output

I am using conky to produce panel on my i3-desktop.

image.jpg

But output as can be seen in above image is not linear, fonts on the right side are one step lower.

Here is my conky config

conky.config = {
    alignment = 'bottom_left',
    background = true,
    border_width = 0,
    cpu_avg_samples = 2,
    default_color = 'white',
    default_outline_color = 'white',
    default_shade_color = 'white',
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,
    use_xft = true,
    font = 'Inconsolata:bold:size=10',
    use_spacer = left,
    gap_x = 0,
    gap_y = 0,
    minimum_height = 10,
    minimum_width = 1366,
    maximum_width = 1366,
    net_avg_samples = 2,
    double_buffer = true,
    out_to_console = false,
    out_to_stderr = false,
    extra_newline = false,
    own_window = true,
    own_window_class = 'Conky',
    own_window_type = 'panel',
    own_window_transparent = false,
    pad_percents = 0,
    stippled_borders = 0,
    update_interval = 1.0,
    uppercase = false,
    use_spacer = 'none',
    show_graph_scale = false,
    show_graph_range = false,
    override_utf8_locale = true,
    if_up_strictness = "address",
}

conky.text = [[
 ${color white}${font}${exec ~/bin/workspace}\
$alignc${color yellow}${font 01 DigitGraphics:bold:size=10}${time %I}:${time %M}${color light yellow} ${time %S}"$font\
$alignr${font FontAwesome:bold:size=10}${color red}${exec ~/bin/novolume}\
${font FontAwesome:bold:size=10}${color green}${exec ~/bin/volume}$font\
${color}${execpi 1 pamixer --get-volume}\
 ${if_existing /sys/class/power_supply/AC/online 1}\
${color orange}${font FontAwesome:bold:size=10}$font\
${color}${battery_percent}${endif}\
${if_existing /sys/class/power_supply/AC/online 0}\
${if_match ${battery_percent} >= 90}${color green}${font FontAwesome:size=10}$font${battery_percent}${endif}\
${if_match ${battery_percent} <= 89}${if_match ${battery_percent} >= 60}${color yellow}${font FontAwesome:size=10}$font ${battery_percent}${endif}${endif}\
${if_match ${battery_percent} <= 59}${if_match ${battery_percent} >= 40}${color orange}${font FontAwesome:size=10}$font ${battery_percent}${endif}${endif}\
${if_match ${battery_percent} <= 39}${if_match ${battery_percent} >= 20}${color red}${font FontAwesome:size=10}$font ${battery_percent}${endif}${endif}\
${if_match ${battery_percent} <= 19}${color black}${font FontAwesome:size=10}${color red}$font ${battery_percent}${endif}${endif}$font\
 ${if_up wlan0}${color green}${font ConkySymbols:size=11}g${endif}$font\
${if_up ppp0}${color green}${font FontAwesome:size=11}${endif}$font]]

Last edited by Docbroke (2017-03-23 14:48:14)

Offline

#2 2017-03-23 11:01:57

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,576
Website

Re: [solved] Non-linear conky output

I suspect it is due to switching fonts which moves the baseline.  Try using a smaller size for FontAwesome or put at least 1 FontAwesome symbol at the start of the line.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2017-03-23 11:44:41

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: [solved] Non-linear conky output

There is no doubt about that. Whenever there is regular font after fontawesome, baseline goes one step down, and it remains down for next fontawesome symbol. I tried putting various combinations of $font at different places but it doesn't work.
This entire conky is single line, so I don't get where you want me to put fontawesome symbol?
I am already using small fonts as if I go larger, last symbol will go below the lower margin of display.

Offline

#4 2017-03-23 12:22:13

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,576
Website

Re: [solved] Non-linear conky output

Docbroke wrote:

This entire conky is single line, so I don't get where you want me to put fontawesome symbol?

At the start of each alignment block.

Docbroke wrote:

I am already using small fonts as if I go larger, last symbol will go below the lower margin of display.

In the config you pasted, both fonts are size 10.  My suggestion was to use a smaller FontAwesome relative to your base font.

The problem seems to be that FontAwesome may have a larget ascent (or related font metric) than Inconsolata.  When only inconsolata is used in a block of text, the font is inconsolata.ascent pixels down from the top of the screen.  But when FontAwesome is used in the block, the entire block is placed FontAwesome.ascent pixels down from the top of the screen and inconsolata elements get their baseline aligned to the baseline of the FontAwesome content, so they are lower than the other inconsolata elements.

This will happen any time you use fonts with different metrics.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2017-03-23 13:17:14

jaergenoth
Member
Registered: 2015-01-16
Posts: 85

Re: [solved] Non-linear conky output

You might want to use ${voffset N} where N is a number of pixels for vertical offset. Negative values will make the text render higher.

Offline

#6 2017-03-23 14:47:29

Docbroke
Member
From: India
Registered: 2015-06-13
Posts: 1,433

Re: [solved] Non-linear conky output

Thanks Trilby & Jaergenoth.
I change some font sizes and used ${voffset -1}, at 3 places and now this conky bar is looking good.

Offline

Board footer

Powered by FluxBB