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

Conky looks different on autostart than with manual start using XFCE #218

Closed
mxmlnkn opened this issue Feb 21, 2016 · 19 comments
Closed

Conky looks different on autostart than with manual start using XFCE #218

mxmlnkn opened this issue Feb 21, 2016 · 19 comments
Labels
bug Bug report or bug fix PR Stale Issue/PR that requires attention because it hasn't been updated in over a year

Comments

@mxmlnkn
Copy link
Contributor

mxmlnkn commented Feb 21, 2016

I added conky in xfce4-session-settings -> Application Autostart add with conky -c /home/mxmlnkn/etc/conky.conkyrc

When logging in to XFCE using e.g. slim login manager (I think it shouldn't matter), then conky looks different than when starting conky manually with the above command.
conky-autostart-vs-manual-start
One frame was made with the autostarted version of conky, which was already running more than a day. The other frame was made 3 seconds later after pkill conky; conky -c /home/mxmlnkn/etc/conky.conkyrc.

Differences in the manually started version:

  • the font is a tad larger
  • overall the conky window is 262px wide instead of 258px
  • in the HDD section there is a spacing of 2 pixels between two fs_bar statements instead of 0 pixels
  • the cpu_graphs in the CPU-section have a overlap of 4 pixels instead of being a perfect fit (the lower 1px border of the upper graph lies on top of the 1px upper border of the lower graph, resulting in a perfect 1 px border between the two graphs)

Also there is something I never noticed, but I guess this is a different bug:

  • The total traffic changed from 60GiB to 69GiB after restarting conky ... Maybe this is because while conky is running instead of getting the total traffic anew from the network adapter it is calculated from the cumulative bandwidth. If that is so, then maybe GiB and GB are intermixed, resulting in this discrepancy. I will observe if this also happens when restarting the manually started conky and file another bug for that problem.

This bug could be related to #199

This is my conkyrc:

conky.config = {
--http://conky.sourceforge.net/config_settings.html
--http://conky.sourceforge.net/variables.html
--start with e.g.: pkill conky; conky -c $USER/etc/conky.conkyrc

    background = true,-- if true, Conky will be forked to background when started
    double_buffer = true,-- eliminates flicker

    alignment = 'bottom_right',-- where to count from when specifiying gap_x,y
    gap_x = 20,-- distance in pixels from alignment
    gap_y = 60,

    draw_borders = false,-- draws simple non-rounded one-colored borders around widget
    border_width = 6,-- no effect if draw_borders set to no
    border_inner_margin = 0,-- if not 0, then goto 0 will jump before default beginning of line
--default_outline_color white
--default_shade_color white
--draw_graph_borders yes
--draw_outline no
    draw_shades = false,-- default would draw bad shades for text -.- looking like the text shifted by 1 line and in black
--default_color white        # for (graph) border and background

    cpu_avg_samples = 2,-- conky setting
    net_avg_samples = 2,
    no_buffers = true,-- Subtract (file system) buffers from used memory?
    out_to_console = false,
    out_to_stderr = false,
--extra_newline no

    own_window = true,
    own_window_type = 'normal',
--own_window_transparent yes  # if yes, show background (isn't actually transparent, as it won't show underlying other windows, only the wallpaper, always ...
--own_window_colour 000000   # no effect if own_window_transparent yes
    own_window_argb_visual = true,
    own_window_argb_value = 130,-- (transparent) 0..255 (opaque) is ignored if own_window_transparent yes !
    own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',

    minimum_width = 170, minimum_height = 0,-- default is roughly 100px when tested, so this is necessary
--stippled_borders 0
    update_interval = 1,-- in seconds
    uppercase = false,-- default is no (?)
    use_spacer = 'none',

    show_graph_scale = false,-- shows scale in upper left corner of graphs, if no custom scale specified
    show_graph_range = false,-- shows e.g. "2m" for the network graph's horizontal axis

    use_xft = true,-- antialiased fonts
    xftalpha = 0.1,
    font = 'Droid Sans:size=8',
    color0 = 'white',
    color1 = '#EAEAEA',
--color2 FFA300               # orange
    color2 = '#0ABFFF',-- turquese
    color3 = 'grey',

    pad_percents = 3,
    temperature_unit = 'celsius',
    top_cpu_separate = false,-- if false, use sum of cpu usage over all cores

--interface eth0   # user variable to set which interface to listen to
-- ^ doesn't work, use LUA ...
-- @TODO: use LUA to merge Download and Upload Panel like in Netbalancer by using different colors
-- @Note: all halfgraphs are 120px wide! (would like variable for this -.-)


};

conky.text = [[
${voffset -8}\
#-------------------------------------------------------------------------------
#                                   CPU
#-------------------------------------------------------------------------------
${color2}${voffset 2}${hr 1}$color
${color2}${alignc}Processor$color
${color2}${voffset -5}${hr 1}$color
# cpu0 is Total Usage
#${color2}CPU ${color0}
${color0}${cpubar cpu0 10,210}${alignr}${cpu cpu0}%
#${cpugraph cpu0 50,300}${voffset -19}
#${font}${voffset -37}${color0}${goto 258}${freq_g (2)}GHz${voffset 35}
${cpugraph cpu1 25,120}${cpugraph cpu2 25,120}${voffset 6}
${font}${voffset -37}${color0}${goto 78}${freq_g 1}GHz ${goto 198}${freq_g 2}GHz${voffset 5}
${cpugraph cpu3 25,120}${cpugraph cpu4 25,120}${voffset 6}
${font}${voffset -37}${color0}${goto 78}${freq_g 3}GHz ${goto 198}${freq_g 4}GHz${voffset 10}
# top processes hogging CPU time: top_time (cumulative time) may be more interesting ...
${color2}${voffset 5}Name${goto 122}PID${goto 163}CPU%${goto 210}Mem%$color${voffset 3}
${top name 1}${goto 115}${top pid 1}${goto 160}${top cpu 1}${goto 205}${top mem 1}
${top name 2}${goto 115}${top pid 2}${goto 160}${top cpu 2}${goto 205}${top mem 2}
${top name 3}${goto 115}${top pid 3}${goto 160}${top cpu 3}${goto 205}${top mem 3}
${top name 4}${goto 115}${top pid 4}${goto 160}${top cpu 4}${goto 205}${top mem 4}
#-------------------------------------------------------------------------------
#                                   GPU
#-------------------------------------------------------------------------------
# commands to try: scroll, tail
${color2}${voffset 2}${hr 1}$color
${color2}${alignc}GPU$color
${color2}${voffset -5}${hr 1}$color
${color2}GPU Temp${goto 70}${color0}${nvidia temp}C${goto 125}${color2}Fan Speed${goto 195}${color0}${execi 10 nvidia-settings -q [fan:0]/GPUCurrentFanSpeed -t} %
${color2}GPU Clock${goto 70}${color0}${nvidia gpufreq} MHz${goto 125}${color2}Mem Clock${goto 195}${color0}${nvidia memfreq} MHz
${color2}Mem Used${goto 70}${color0}${execi 10 nvidia-settings -q [gpu:0]/UsedDedicatedGPUMemory -t} / ${exec nvidia-settings -q [gpu:0]/TotalDedicatedGPUMemory -t} MiB
#-------------------------------------------------------------------------------
#                                  Memory
#-------------------------------------------------------------------------------
${color2}${voffset 2}${hr 1}$color
${color2}${alignc}Memory$color
${color2}${voffset -5}${hr 1}$color
#${color2}Memory used$color${alignr}${mem} / ${memmax}
${color0}${membar 10,110}${alignr}${mem} / ${memmax}  [${memperc}%]
${color2}${voffset 5}Name${goto 122}PID${goto 163}CPU%${goto 210}Mem%$color${voffset 3}
${top_mem name 1}${goto 115}${top_mem pid 1}${goto 160}${top_mem cpu 1}${goto 205}${top_mem mem 1}
${top_mem name 2}${goto 115}${top_mem pid 2}${goto 160}${top_mem cpu 2}${goto 205}${top_mem mem 2}
${top_mem name 3}${goto 115}${top_mem pid 3}${goto 160}${top_mem cpu 3}${goto 205}${top_mem mem 3}
${top_mem name 4}${goto 115}${top_mem pid 4}${goto 160}${top_mem cpu 4}${goto 205}${top_mem mem 4}
#-------------------------------------------------------------------------------
#                                  Logging
#-------------------------------------------------------------------------------
${color2}${voffset 2}${hr 1}$color
${color2}${alignc}Syslog$color
${color2}${voffset -5}${hr 1}$color
${voffset 5}${execi 10 tail -n 4 /var/log/syslog | fold -w 47}
#-------------------------------------------------------------------------------
#                                  Logging
#-------------------------------------------------------------------------------
${color2}${voffset 2}${hr 1}$color
${color2}${alignc}Authentication Log$color
${color2}${voffset -5}${hr 1}$color
${voffset 5}${execi 10 tail -n 4 /var/log/auth.log | fold -w 47}
#-------------------------------------------------------------------------------
#                                    HDD
#-------------------------------------------------------------------------------
${color2}${voffset 2}${hr 1}$color
${color2}${alignc}HDD$color
${color2}${voffset -5}${hr 1}$color
${if_mounted /}\
/${goto 30}${fs_type /}${goto 70}${fs_bar 10,50}${alignr}${fs_used /} / ${fs_size /} [${fs_used_perc /}%]
${endif}\
${if_mounted /media/c}\
C:\${goto 30}${fs_type /media/c}${goto 70}${fs_bar 10,50 /media/c}\
${alignr}${fs_used /media/c} / ${fs_size /media/c} [${fs_used_perc /media/c}%]
${endif}\
# commented out because of: https://github.com/brndnmtthws/conky/issues/208
#${if_existing /media/mxmlnkn/Transcend}${if_mounted /media/mxmlnkn/Transcend}\
#Usb${goto 30}${fs_type /media/mxmlnkn/Transcend}${goto 70}${fs_bar 10,50 /media/mxmlnkn/Transcend}\
#${alignr}${fs_used /media/mxmlnkn/Transcend} / ${fs_size /media/mxmlnkn/Transcend} [${fs_used_perc /media/mxmlnkn/Transcend}%]
#${endif}${endif}
#${if_existing /media/mxmlnkn/SANSA CLIPZ/}${if_mounted /media/mxmlnkn/SANSA CLIPZ/}\
#Sansa${goto 30}${fs_type /media/mxmlnkn/SANSA CLIPZ}${goto 70}${fs_bar 10,50 /media/mxmlnkn/SANSA CLIPZ}\
#${alignr}${fs_used /media/mxmlnkn/SANSA CLIPZ} / ${fs_size /media/mxmlnkn/SANSA CLIPZ} [${fs_used_perc /media/mxmlnkn/SANSA CLIPZ}%]
#${endif}${endif}
#-------------------------------------------------------------------------------
#                                  Network
#-------------------------------------------------------------------------------
${color2}${voffset 2}${hr 1}$color
${color2}${alignc}Network$color
${color2}${voffset -5}${hr 1}$color
#
# public ip address
# this command creates traffic permanently, not good :S
${color2}Public IP${color0}${alignr}${execi 3600 wget -q -O /dev/stdout http://checkip.dyndns.org/ | cut -d : -f 2- | cut -d \< -f -1}
# Arguably this may not find the public IP, if behind a NAT or Router, but what use would the IP have then
#${color2}Public${color0}${alignr}${LANG=c ifconfig eth0 | grep "inet addr" | awk -F: '{print $2}' | awk '{print $1}'}
#
#${color2}${voffset 5}Hostname: $color$alignr$nodename
######## wlan0 #########
${if_up wlan0}\
${color2}wlan0: $color$alignr${addr wlan0}
${color2}SSID: ${color}${wireless_essid wlan0}${alignr}\
#conky[5596]: segfault at 0 ip 00000000004541a2 sp 00007ffc214c8db8 error 4 in conky[400000+d3000]
${wireless_bitrate} ${color2}Quality: ${color}${wireless_link_bar} ${wireless_link_qual} [${wireless_link_qual_perc}%]
${color2}Down: $color${downspeedf wlan0} kiB/s ${alignr}${color2}Up:$color ${upspeedf wlan0} kiB/s${voffset -3}
${downspeedgraph wlan0 50,120} ${alignr}${upspeedgraph wlan0 50,120}$color
${voffset -6}${color2}Total:$color ${totaldown wlan0} ${alignr}${color2}Total:$color ${totalup wlan0}${voffset 5}
${endif}\
######## eth0 ########
${if_up eth0}\
${color2}eth0: $color$alignr${addr eth0}
${color2}Down: $color${downspeedf eth0} kiB/s ${alignr}${color2}Up:$color ${upspeedf eth0} kiB/s${voffset -3}
${downspeedgraph eth0 50,120} ${alignr}${upspeedgraph eth0 50,120}$color
${voffset -6}${color2}Total:$color ${totaldown eth0} ${alignr}${color2}Total:$color ${totalup eth0}\
${endif}\
]];
@Rojikku
Copy link

Rojikku commented Mar 8, 2016

I'm just some random person- but it's possible that your resolution changes in some way after conky is loaded. You could try adding sleep 5; or something before the command in xfce, but I don't know how xfce loads, so that could delay everything instead of just conky.
It's also possible to setup a systemctl user service that runs after a delay, or call a script that has a delay, I imagine. Good luck!

@mxmlnkn
Copy link
Contributor Author

mxmlnkn commented Mar 8, 2016

Well yes, it actually does work to change conky ... into bash -csleep 0.1s && conky ...`, but I would only call this a workaround, not a solution. Also there are still maybe 10% where it doesn't work, maybe because I didn't set it all the way to 5s. Also I would like to know, what goes wrong here.

I tried rearranging the order in my /etc/xdg/xfce4/xinitrc, but it seems that something started after this is the underlying cause, because my changes didn't have any effect. Basically I moved the start of autostarts almost to the end and inserted a sleep 1s before that. If this doesn't work it's something else.

If the order of ps aux (process id ordered) is at all an indicator of the order processes are started, then the following order works:

/usr/lib/xorg/Xorg -nolisten tcp -auth /var/run/slim.auth
/usr/sbin/ntpd -p /var/run/ntpd.pid -g -c /var/lib/ntp/ntp.conf.dhcp -u 106:114
/bin/sh /etc/xdg/xfce4/xinitrc -- /etc/X11/xinit/xserverrc
/usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session x-session-manager
/usr/bin/dbus-launch --exit-with-session x-session-manager
/usr/bin/dbus-daemon --fork --print-pid 6 --print-address 8 --session
xfce4-session
/usr/lib/x86_64-linux-gnu/xfce4/xfconf/xfconfd
xfwm4
xfce4-panel
Thunar --daemon
xfdesktop
xfsettingsd
/usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-1.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libwhiskermenu.so 5 14680097 whiskermenu Whisker Menu Show a menu to easily access installed applications
/usr/lib/gvfs/gvfsd
conky -c /etc/.conkyrc
/usr/lib/x86_64-linux-gnu/tumbler-1/tumblerd

This also works:

/usr/bin/pulseaudio --start --log-target=syslog
/usr/lib/xorg/Xorg -nolisten tcp -auth /var/run/slim.auth
/bin/sh /etc/xdg/xfce4/xinitrc -- /etc/X11/xinit/xserverrc
/usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session x-session-manager
/usr/bin/dbus-launch --exit-with-session x-session-manager
/usr/bin/dbus-daemon --fork --print-pid 6 --print-address 8 --session
xfce4-session
/usr/lib/x86_64-linux-gnu/xfce4/xfconf/xfconfd
xfwm4
xfce4-panel
Thunar --daemon
xfdesktop
xfsettingsd
/usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-1.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libwhiskermenu.so 5 16777249 whiskermenu Whisker Menu Show a menu to easily access installed applications
/usr/lib/gvfs/gvfsd
/usr/lib/x86_64-linux-gnu/tumbler-1/tumblerd
/usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-2.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libpulseaudio-plugin.so 9 16777259 pulseaudio PulseAudio Plugin Adjust the audio volume of the PulseAudio sound system
conky -c /etc/Luyomi.conkyrc
/usr/lib/x86_64-linux-gnu/xfce4/panel-plugins/xfce4-xkb-plugin  1 16777260 xkb-plugin Keyboard Layouts Keyboard layouts setup and switch plugin
/usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-1.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libwavelan.so 17 16777261 wavelan Wavelan View the status of a wireless network

But these orders don't

/usr/lib/xorg/Xorg -nolisten tcp -auth /var/run/slim.auth
/bin/sh /etc/xdg/xfce4/xinitrc -- /etc/X11/xinit/xserverrc
/usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session x-session-manager
/usr/bin/dbus-launch --exit-with-session x-session-manager
/usr/bin/dbus-daemon --fork --print-pid 6 --print-address 8 --session
xfce4-session
/usr/lib/x86_64-linux-gnu/xfce4/xfconf/xfconfd
xfwm4
xfce4-panel
Thunar --daemon
xfdesktop
xfsettingsd
conky -c /etc/Luyomi.conkyrc
/usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-1.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libwhiskermenu.so 5 14680097 whiskermenu Whisker Menu Show a menu to easily access installed applications
/usr/lib/gvfs/gvfsd
/usr/lib/x86_64-linux-gnu/tumbler-1/tumblerd
/usr/lib/gvfs/gvfs-udisks2-volume-monitor
/usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-2.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libpulseaudio-plugin.so 9 14680107 pulseaudio PulseAudio Plugin Adjust the audio volume of the PulseAudio sound system
/usr/lib/x86_64-linux-gnu/xfce4/panel-plugins/xfce4-xkb-plugin  1 14680108 xkb-plugin Keyboard Layouts Keyboard layouts setup and switch plugin
/usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-1.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libwavelan.so 17 14680109 wavelan Wavelan View the status of a wireless network

and this

/usr/lib/xorg/Xorg -nolisten tcp -auth /var/run/slim.auth
[kworker/2:1]
/bin/sh /etc/xdg/xfce4/xinitrc -- /etc/X11/xinit/xserverrc
/usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session x-session-manager
/usr/bin/dbus-launch --exit-with-session x-session-manager
/usr/bin/dbus-daemon --fork --print-pid 6 --print-address 8 --session
xfce4-session
/usr/lib/x86_64-linux-gnu/xfce4/xfconf/xfconfd
xfwm4
xfce4-panel
Thunar --daemon
xfdesktop
xfsettingsd
conky -c /etc/Luyomi.conkyrc
/usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-1.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libwhiskermenu.so 5 18874401 whiskermenu Whisker Menu Show a menu to easily access installed applications
/usr/lib/gvfs/gvfsd
/usr/lib/x86_64-linux-gnu/tumbler-1/tumblerd
/usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-2.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libpulseaudio-plugin.so 9 18874411 pulseaudio PulseAudio Plugin Adjust the audio volume of the PulseAudio sound system
/usr/lib/x86_64-linux-gnu/xfce4/panel-plugins/xfce4-xkb-plugin  1 18874412 xkb-plugin Keyboard Layouts Keyboard layouts setup and switch plugin
/usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-1.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libwavelan.so 17 18874413 wavelan Wavelan View the status of a wireless network
/usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-1.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libsystray.so 6 18874414 systray Notification Area Area where notification icons appear
/usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-1.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/liborageclock.so 18 18874415 xfce4-orageclock-plugin Orage Panel Clock Show time and date?

This seems to indicate, that one of these two are the reason:

/usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-1.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libwhiskermenu.so 5 14680097 whiskermenu Whisker Menu Show a menu to easily access installed applications
/usr/lib/gvfs/gvfsd

I fairly doubt it's gvfsd, but whiskermenu also doesn't make any sense, meaning ps aux may not have been the best indicator.

As the problem doesn't appear on consecutive refreshs the bug should be inside some initialization routine of conky.

Btw: Everything, Slim, Virtual terminals, should have 1920x1080 pixel, so I don't think this is a problem with changing resolution.

@Rojikku
Copy link

Rojikku commented Mar 8, 2016

Hmm~. Personally, I have conky in my i3 startup config with no delays, and it works fine. Does SLIM have the correct resolution and everything? Meaning having it the same as your login.
Another possibility I might entertain is that when you load whiskermenu it refreshes the panels, which might potentially change how conky determines screen size and cause some sort of issue. Again, I have no reason to believe that's true, it's just an idea.
Another test I might suggest is adding a comment to your conkyrc while conky is in the incorrect mode. If it updates to the correct mode when it automatically reloads itself with the updated config, then I'd say it's an issue with initialization and detecting screen size.
If you change the delay to 0.2s does it give you a more consistent result, or is it the same as at 0.1s?
Either way, I'm glad my work around did something for you. I'd get annoyed if my conky was acting like yours.

@mxmlnkn
Copy link
Contributor Author

mxmlnkn commented Mar 9, 2016

Of all the bugs I encounter daily since switching to Linux, this is one of the least obnoxious ones :). But thank you for your empathy. Other bugs like having to append 'i915.modeset=0' in GRUB every time I boot, or gvfsd-trash hogging 80% CPU on all cores forever after deleting too many files at a time, e.g. with trash ./* or Thunar crashing every now and then on cut and pasting files or xfce-session-logout killing all programs instead of closing them properly, ...

In order to not let this go offtopic I did some tests, too:
If I apply the following diff I can reproduce the behavior almost exactly even when it is not in autostarted:

diff --git a/src/fonts.h b/src/fonts.h
index 00b2265..017c4da 100644
--- a/src/fonts.h
+++ b/src/fonts.h
@@ -57,12 +57,13 @@ struct font_list {

 #ifdef BUILD_XFT

-#define font_height() (use_xft.get(*state) ? (fonts[selected_font].xftfont->ascent + \
-       fonts[selected_font].xftfont->descent) \
-       : (fonts[selected_font].font->max_bounds.ascent + \
-       fonts[selected_font].font->max_bounds.descent))
-#define font_ascent() (use_xft.get(*state) ? fonts[selected_font].xftfont->ascent \
-       : fonts[selected_font].font->max_bounds.ascent)
+/* Changing this to e.g. 10 will only result in smaller conky window, but the
+ * text and graphs are rendered correctly, especially with the correct distance
+ * from each other, meaning only things down will not be displayed ... */
+#define font_height() 11
+/* Changing this to e.g. 8 will affect the spacing between lines. Even if
+ * those lines contain graphs. It's comparable to \baselineskip in LaTeX */
+#define font_ascent() 8
 #define font_descent() (use_xft.get(*state) ? fonts[selected_font].xftfont->descent \
        : fonts[selected_font].font->max_bounds.descent)

But this is weird, because font_ascent() is called every drawing cycle inside conky.cc's draw_each_line_inner, meaning, I'm not entirely sure why this won't correct after some cycles.

use_xft.get(*state) is true, so what normally should be returned is fonts[selected_font].xftfont->ascent, although I need to test what this returns on autostart. xftfont is set inside load_fonts inside fonts.cc. The .font version is also set by this function, but at the very end.

So I added some debug printfs and I changed my autostart command to bash -c '/opt/conky/build/src/conky -c /etc/.conkyrc 2>&1 > /tmp/conky.log'

Init X11
update_workarea
init_windowupdate_workarea
Init X11
update_workarea
init_windowupdate_workarea
[load_fonts] use_xft.get(*state) == true
[load_fonts] fonts[0].xftfont = XftFontOpenName( display=0xad1700(display_width=1920, display_height=1080), screen=0, fonts[0].name.c_str()=Droid Sans:size=8 );
[load_fonts][a] fonts[0].xftfont->ascent = 9
[main_loop] font_ascent() = 9, font_descent() = 2, font_height() = 11
[load_fonts] use_xft.get(*state) == true
[load_fonts] use_xft.get(*state) == true
[load_fonts] use_xft.get(*state) == true
[load_fonts] use_xft.get(*state) == true
[load_fonts] use_xft.get(*state) == true
[...]

On a manual start the output is this:

Init X11
update_workarea
init_windowupdate_workarea
Init X11
update_workarea
init_windowupdate_workarea
[load_fonts] use_xft.get(*state) == true
[load_fonts] fonts[0].xftfont = XftFontOpenName( display=0x1efa700(display_width=1920, display_height=1080), screen=0, fonts[0].name.c_str()=Droid Sans:size=8 );
[load_fonts][a] fonts[0].xftfont->ascent = 10
[main_loop] font_ascent() = 10, font_descent() = 3, font_height() = 13
[load_fonts] use_xft.get(*state) == true
[load_fonts] use_xft.get(*state) == true
[load_fonts] use_xft.get(*state) == true
[load_fonts] use_xft.get(*state) == true
[load_fonts] use_xft.get(*state) == true
[load_fonts] use_xft.get(*state) == true
[...]

Actually it turns out load_fonts is actually called on every draw, I guess by generate_text_internal in conky.cc. But load_fonts checks with if(not fonts[i].xftfont) if it really has to load the font or not, meaning it is set only on start.

There is no error about "font couldn't be opened". In both cases the font is loaded by the same line:

fonts[i].xftfont = XftFontOpenName(display, screen, fonts[i].name.c_str());

In both cases the parameters given seem to be similar, except the display pointer, but the display size which was returned by that display object is the same,... Still the returned font has a different font_height. Is this a bug with the X FreeType interface library ?

The display is set by x11.cc I assume:

static void init_X11()
{
    if (!display) {
        const std::string &dispstr = display_name.get(*state).c_str();
        // passing NULL to XOpenDisplay should open the default display
        const char *disp = dispstr.size() ? dispstr.c_str() : NULL;
        if ((display = XOpenDisplay(disp)) == NULL) {
            throw std::runtime_error(std::string("can't open display: ") + XDisplayName(disp));
        }
    }

The display pointers changes on every manual start, so I don't think it matters much if they are different.

@Rojikku
Copy link

Rojikku commented Mar 9, 2016

Looking over everything I could grasp, it seems like something is changing how X FreeType responds to conky in the initial stages of launching. Because with a bit of a delay it does this less often, yes?
I'm not sure what distro you're on, or what versions you have. I believe that info is necessary?
I believe the latest Conky is around 1.10.1, as that's what I have. I also believe the latest libxft is 2.3.2 .
Assuming you have at least those two versions, you might be stuck with a work around until someone patches this bug fix (Unless one of the existing pull requests attempts to fix something that coincidentally fixes this). If you don't have those two, upgrading to them could potentially solve the issue. Particularly with libxft.

I'm not sure what that grub line does, but I've had no such issue. Might be distro specific. You can also just append that line directly to /boot/grub/grub.cfg in the place that looks the same as where you normally add it, then it should show up when you boot, thus preventing you from having to manually append it.
I've noticed that as well with thunar, though I haven't had it happen in a while, so it could be fixed at thunar 1.6.10 .
I haven't ever used the trash command from terminal before, but tested it just now with about six screenshots, and it was instant, with no real processor usage. I have gvfs 1.26.3 though.

Personally, I use i3wm, and manually close the majority of my programs before shutting down each day, and haven't noticed such an issue. I assume that's for performance, as people would get annoyed if xfce took forever to logout. I might suggest closing them manually, or writing your own script that closes them all, then executes the logout command.
I use ArchLinux, so if your versions are drastically different, that's possibly why.

I'll try doing some edits to my conkyrc, test your conky rc file, and see if I get any similar issues at all.

@mxmlnkn
Copy link
Contributor Author

mxmlnkn commented Mar 9, 2016

With delay conky works (I currently have 1s delay).
I'm using:

  • Debian mostly sid, but also some stretch packages which I didn't get around to update
  • Linux version 4.4.0-1-amd64 (debian-kernel@lists.debian.org) (gcc version 5.3.1 20160205 (Debian 5.3.1-8) ) #1 SMP Debian 4.4.2-2 (2016-02-19)
  • xfce 4.12.2
  • xfwm4 4.12.3-1
  • libx11-dev:amd64 2:1.6.3-1
  • conky b38ab11 which should be almost the latest commit
  • libxft-dev 2.3.2-1
  • libxft2 2.3.2-1
  • thunar 1.6.10-2
  • compton 0.1~beta2-1 I need this, because without I have terrible screen tearing in firefox. Compton is started with a 5s delay, so it starts after conky. Without compton conky doesn't have transparency for some reason. Killing compton and then starting conky won't result in this font_height bug. I don't think compton is at fault here.

@Rojikku
Copy link

Rojikku commented Mar 9, 2016

In your config, you have use_xft to true. If you set this to false, can you reproduce the issue? If you can't, that would tell us it has more to do with libxft than anything, yes?
I'm running conky as well. I used your config- and except for the fact that it takes forever to get my public ip the first time, and thus doesn't update until it does, it ran fine. I wasn't able to easily replicate the issue.
Your versions all seem to be the same or newer- though my kernel is a bit newer, but I don't think that would result in a difference.
I'm not sure why you have both libxft-dev and libxft2. Could it be you're running two of them, and you get a different result depending on which one responds?
Again, I'm not sure on how that works.

Glad the delay works for you. It might not be relevant, but out of curiosity, what graphics driver are you using? I'm running nvidia, so there could be a difference there as well. Though it'd be kind of odd if that caused it, it doesn't seem impossible to me.

@mxmlnkn
Copy link
Contributor Author

mxmlnkn commented Mar 9, 2016

Wow thanks for mentioning of the public IP! I noticed that sometimes conky seemed to never load or takes a very long time. But the bug was so unspecific I couldn't open an issue.

libxft-dev is just the developer package i.e. the headers, e.g. for compiling conky, and libxft2 is the runtime. E.g. see dpkg -L libxft-dev and dpkg -L libxft2

With use_xft = false the bug doesn't appear, good spotting that! But the fonts don't look quite to my liking.

Also I'm using the NVIDIA proprietary drivers:

| NVIDIA-SMI 361.28     Driver Version: 361.28         |

@Rojikku
Copy link

Rojikku commented Mar 9, 2016

Glad my comment helped. xP

Alright. I only have a singular libxft package, so I wasn't sure. To be fair, I'm also not compiling conky from source.

I agree completely that the fonts aren't nearly as pretty. I tried the option and instantly changed it back. However, that does give us way more certainty that the interaction with xft is the issue.

As your nvidia driver is the same as mine, and I don't experience the issue, I'll say that's not it.

Now, there's a few questions I have. For example: Why does the 1s delay fix the issue?
Can you reproduce the bug in another desktop environment?
If not, can you reproduce it in the same desktop environment, but with a different window manager?
If you set own_window_type = override, can you reproduce the issue in your original desktop environment? That might be easiest to test first, since it requires the least amount of fiddling. As I understand it, it spawns conky outside of the control of your window manager- and if that's somehow influencing the issue, it would tell us so.

I realize these seem pretty irrelevant to the issue we've pinned down, but as the 1s delay helps, it might be worth testing to see if we can find out "why" it helps.

@mxmlnkn
Copy link
Contributor Author

mxmlnkn commented Mar 9, 2016

override doesn't fix the bug, moreover when started manually transparency doesn't work, and if started by autostart, it is shown shortly and I guess after the wallpaper is loaded conky isn't visible anymore, maybe overwritten by the wallpaper ... As I wouldn't use this option anyway, I'm not in the mood to open multiple bugs.

As for the different desktop environments and window managers. I could try this in some days, currently this is too much time.

This 1s offset also intrigued me, that's why I did try to get some info about started process order with ps aux, but it doesn't seem enough. I also very very shortly tried auditd as recommend here, but it hogged full CPU and slowed down the start at least hundredfold, I had to deinstal it in a virtual terminal and reboot.

@Rojikku
Copy link

Rojikku commented Mar 9, 2016

That's interesting. I actually use override, as i3WM otherwise completely fucks conky and makes it into a cute little window that gets in my way. I don't have any issues with transparency, either. Wonder what the difference is. Might be something else in my config.

That's fine, it was just a suggestion worth testing. I'd assume something is being done in the first second, and using a different desktop environment might do it faster, and thus not display the issue. I'm not sure the test will give us any valuable data beyond that, though.

You could try disabling a bunch of other startup stuff, and see if you find something specific. But I believe you mentioned you tried setting conky to start last, and it still had the issue sometimes. I can't think of anything else at the moment. I believe most, if not all, of the information needed to debug the issue should be somewhere in this issue now, though, so hopefully the dev will take a peek.

Good luck with your other bugs!

@lasers
Copy link
Contributor

lasers commented Aug 9, 2018

2 years 6 months passed. Can you determine if you're still having this problem today on 1.10.8 or preferably 1.10.9_pre (git)? The older versions are not trustworthy due to too many changes that can be hard to track. Thank you.

@npyl
Copy link
Collaborator

npyl commented Aug 9, 2018

I think this issue is probably happening to me too (macOS). The weird thing is that if you kill conky and run it again it shows up correctly. (The second time is always correct.)

@lasers
Copy link
Contributor

lasers commented Aug 9, 2018

To make things a bit easier, the diff between @mxmlnkn's debug printfs is...

diff --git a/mx-a b/mx-b
index 93734ea..00c346b 100644
--- a/mx-a
+++ b/mx-b
@@ -5,9 +5,10 @@ Init X11
 update_workarea
 init_windowupdate_workarea
 [load_fonts] use_xft.get(*state) == true
-[load_fonts] fonts[0].xftfont = XftFontOpenName( display=0xad1700(display_width=1920, display_height=1080), screen=0, fonts[0].name.c_str()=Droid Sans:size=8 );
-[load_fonts][a] fonts[0].xftfont->ascent = 9
-[main_loop] font_ascent() = 9, font_descent() = 2, font_height() = 11
+[load_fonts] fonts[0].xftfont = XftFontOpenName( display=0x1efa700(display_width=1920, display_height=1080), screen=0, fonts[0].name.c_str()=Droid Sans:size=8 );
+[load_fonts][a] fonts[0].xftfont->ascent = 10
+[main_loop] font_ascent() = 10, font_descent() = 3, font_height() = 13
+[load_fonts] use_xft.get(*state) == true
 [load_fonts] use_xft.get(*state) == true
 [load_fonts] use_xft.get(*state) == true
 [load_fonts] use_xft.get(*state) == true

Noticing use_xft in the diff along with font changes... I'm on i3wm so things may be a bit more consistent than KDE or XFCE4. With @mxmlnkn's config out of the box, I had to use use_xft=false to get the left side or I will always get the right side (which is use_xft=true). I don't think this changed anything much, but to acknowledge that it might be something wrong with session initialization during session startup.

43904485-5bc58a88-9bb4-11e8-8053-0fc47356e90b

I wonder what happen when you edit the config to force conky reload, does it give you correct output this time or do we explicitly have to kill it restart conky first?

@lasers
Copy link
Contributor

lasers commented Dec 10, 2018

Hello everyone. Can you try this again on 1.11.0? This may have been fixed indirectly. Thanks.

@pkkid
Copy link

pkkid commented Mar 29, 2022

The issue still exists on Ubuntu 22.04 with Conky 1.12.2. A sleep in the startup script fixes the font issue.

@d01
Copy link

d01 commented Jul 18, 2022

Yes, interestingly I started seeing this bug after the upgrade from 20.04 to 22.04.

Copy link

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment, or this issue will be closed in 30 days.

@github-actions github-actions bot added the Stale Issue/PR that requires attention because it hasn't been updated in over a year label Dec 14, 2023
Copy link

This issue was closed because it has been stalled for 30 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report or bug fix PR Stale Issue/PR that requires attention because it hasn't been updated in over a year
Projects
None yet
Development

No branches or pull requests

6 participants