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

[Bug]: conky: can't parse hex color 'lightgrey' #1868

Closed
fernape opened this issue Apr 28, 2024 · 13 comments · Fixed by #1870
Closed

[Bug]: conky: can't parse hex color 'lightgrey' #1868

fernape opened this issue Apr 28, 2024 · 13 comments · Fixed by #1870
Labels
bug Bug report or bug fix PR

Comments

@fernape
Copy link
Contributor

fernape commented Apr 28, 2024

What happened?

When updating to 1.20.2 my conky window was using red color despite that I had my previous .conkyrc file with most colors in white, some black and some grey.
On launching from the console the error:

conky: can't parse hex color 'lightgrey'

shows up for multiple colors.
Using colorN (like color3) instead of the name seems to work.

This worked in 1.20.0 and I'm pretty sure it did in 1.20.1.
The only thing I think it might be related is this change

Version

1.20.2

Which OS/distro are you seeing the problem on?

Linux (other)

Conky config

conky.config = {                                                                                                                                       [50/1740]
-- Fork to background when started                                                                                                                              
        background = true,                                                      
                                        
        use_xft = true,-- Use Xft?      
--xftfont Bitstream Vera Sans Mono:size=8
        font = 'Terminus:size=8',
        xftalpha = 1,-- Text alpha when using Xft

        update_interval = 2.0,-- Update interval in seconds

        total_run_times = 0,

        own_window = true,
        own_window_type = 'desktop',
        own_window_transparent = true,
        own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',

        double_buffer = true,-- Use double buffering (reduces flicker, may not work for everyone)

        maximum_width = 300,

        draw_shades = false,
        draw_outline = false,
        draw_borders = false,
        stippled_borders = 8,

        border_inner_margin = 4,
        border_width = 1,

        --default_color = 'white',
        default_color = color3,
        default_shade_color = 'black',
        default_outline_color = color3,

        alignment = 'top_left',

        gap_x = 1,
        gap_y = 1,

        no_buffers = true,
        uppercase = false,

        cpu_avg_samples = 4,
        net_avg_samples = 5,

        override_utf8_locale = false,                                                                                                                   [4/1740]

        use_spacer = 'right',-- Add spaces to keep things from moving about?  This only affects certain objects.

};

conky.text = [[

${offset 10}${color slate grey}${time %Z}:${color }${time %a, %e %B %G %H:%M:%S} 
${offset 10}${color slate grey}UpTime: ${color }$uptime
${offset 10}${color slate grey}Kern:${color }$kernel
${offset 10}${color slate grey}CPU:${color } $cpu% | ${freq} MHz | ${acpitemp}C  
${offset 10}${color slate grey}Batt:${color }${battery}
${offset 10}${cpugraph 20,130 000055 ff0000}

${offset 10}${color slate grey}Highest CPU:
${offset 10}${color ddaa00} ${top name 1}${top cpu 1}
${offset 10}${color lightgrey} ${top name 2}${top cpu 2}
${offset 10}${color lightgrey} ${top name 3}${top cpu 3}
${offset 10}${color lightgrey} ${top name 4}${top cpu 4}
${offset 10}${color lightgrey} ${top name 5}${top cpu 5}
${offset 10}${color lightgrey} ${top name 6}${top cpu 6}
${offset 10}${color lightgrey} ${top name 7}${top cpu 7}
${offset 10}${color lightgrey} ${top name 8}${top cpu 8}
${offset 10}${color lightgrey} ${top name 9}${top cpu 9}

${offset 10}${color slate grey}Highest MEM:
${offset 10}${color ddaa00} ${top_mem name 1}${top_mem mem 1}
${offset 10}${color lightgrey} ${top_mem name 2}${top_mem mem 2}
${offset 10}${color lightgrey} ${top_mem name 3}${top_mem mem 3}
${offset 10}${color lightgrey} ${top_mem name 4}${top_mem mem 4}
${offset 10}${color lightgrey} ${top_mem name 5}${top_mem mem 5}
${offset 10}${color lightgrey} ${top_mem name 6}${top_mem mem 6}
${offset 10}${color lightgrey} ${top_mem name 7}${top_mem mem 7}
${offset 10}${color lightgrey} ${top_mem name 8}${top_mem mem 8}
${offset 10}${color lightgrey} ${top_mem name 9}${top_mem mem 9}

${offset 10}${color slate grey}MEM:  ${color } $memperc% $mem/$memmax
${offset 10}${membar 3,100}
${offset 10}${color slate grey}SWAP: ${color }$swapperc% $swap/$swapmax
${offset 10}${swapbar 3,100}
${offset 10}${color slate grey}/:    ${color }${fs_used /}/${fs_size /}
${offset 10}${fs_bar 3,100 /}
${offset 10}${color slate grey}/home:  ${color }${fs_used /home}/${fs_size /home}
${offset 10}${fs_bar 3,100 /home}
${offset 10}${diskiograph 20,130 000000 ffffff}
${offset 10}${color slate grey}NET: ${color}Up: ${color }${upspeed re0} k/s ${color}
${offset 10}${upspeedgraph re0 20,130 000000 ffffff}
${offset 10}     Down: ${color }${downspeed re0}k/s
${offset 10}${downspeedgraph re0 20,130 000000 ffffff}
]];

Stack trace

No response

Relevant log output

No response

@fernape fernape added bug Bug report or bug fix PR triage Issue that hasn't been verified labels Apr 28, 2024
@brndnmtthws
Copy link
Owner

How are you installing conky? Are you compiling it yourself from source? Most likely you need to install gperf for the colour lookups to work.

Currently we allow conky to compile without gperf, although it prints a warning. We should just make it a required dependency to prevent backward-incompatible silent failures like this. It's in most (if not all) of the major distros already, including macOS, so I think it's reasonable to just make it a hard requirement.

@brndnmtthws brndnmtthws removed the triage Issue that hasn't been verified label Apr 28, 2024
brndnmtthws added a commit that referenced this issue Apr 28, 2024
Rather than allowing the build to continue without gperf, we should
fail with an error so that the colour behaviour does not change in a
backward incompatible manner. The old colour behaviour should continue
to work going forward.

This resolves #1868.
brndnmtthws added a commit that referenced this issue Apr 28, 2024
Rather than allowing the build to continue without gperf, we should
fail with an error so that the colour behaviour does not change in a
backward incompatible manner. The old colour behaviour should continue
to work going forward.

This resolves #1868.
@fernape
Copy link
Contributor Author

fernape commented Apr 29, 2024

Yes, I'm building it from source.
gperf might be the issue:

CMake Warning at src/CMakeLists.txt:63 (message):
  'gperf' program not found, using stub colour-names.cc; colors names will
  not be parsed

Thanks

@ipaqmaster
Copy link

Same here from the official Archlinux repositories.

conky-1.20.2-1-x86_64.pkg.tar.zst cannot handle its colors properly but downgrading to conky-1.19.7-2-x86_64.pkg.tar.zst makes it work again just fine.

@Caellian
Copy link
Collaborator

Install gperf. PKGBUILD of conky-cli and I'm assuming others is missing it. It's been added as a build requirement, if you run conky -DD you'll see messages saying it hasn't been enabled during build (it's enabled by default in latest versions).

@AngryPhantom
Copy link

Adding gperf in PKGBUILD's makedepends and recompiling fixes the issue. Thanks @Caellian

@fvalenduc
Copy link

I have gentoo and gperf is installed. Nevertheless I still need to use hex codes.

@Caellian
Copy link
Collaborator

Caellian commented Oct 6, 2024

If you're trying to use one of supported colors with the latest conky it should work. Gperf can't be disabled anymore and conky won't compile without it. If you're using a prebuilt binary, compile it yourself. Gperf is only required at compile time, i.e. having it installed at runtime won't affect anything.

@fvalenduc
Copy link

Since I am using gentoo, gperf is obviously compiled from source. Is there a minimum version required ? I have the version 3.1.

@AngryPhantom
Copy link

AngryPhantom commented Oct 7, 2024

If you're trying to use one of supported colors with the latest conky it should work. Gperf can't be disabled anymore and conky won't compile without it. If you're using a prebuilt binary, compile it yourself. Gperf is only required at compile time, i.e. having it installed at runtime won't affect anything.

@Caellian So, it should be either light gray, light grey, LightGray or LightGrey instead of lightgrey? Right? Does the letter case matter now?

@AngryPhantom
Copy link

Since I am using gentoo, gperf is obviously compiled from source. Is there a minimum version required ? I have the version 3.1.

@fvalenduc Don't think so. The latest release is 3.1. Try using the supported colors as mentioned above.

@Caellian
Copy link
Collaborator

Caellian commented Oct 7, 2024

If you're trying to use one of supported colors with the latest conky it should work. Gperf can't be disabled anymore and conky won't compile without it. If you're using a prebuilt binary, compile it yourself. Gperf is only required at compile time, i.e. having it installed at runtime won't affect anything.

@Caellian So, it should be either light gray, light grey, LightGray or LightGrey instead of lightgrey? Right? Does the letter case matter now?

Lookup from the table should ignore color letter case. So any of those names and different capitalizations of them should work (i.e. Light Gray, Light Grey, lightgray, lightgrey, liGhTGreY).

If it doesn't, try building conky yourself bc package maintainers sometimes don't notice/handle changes like this the best (which is why gperf is no longer optional (packages didn't have it while being built which caused bug reports)).

@sloking
Copy link

sloking commented Oct 8, 2024

If you have gentoo then emerge conky with use-flag 'colour-name-map'...;)...and that work's for me.

hint:
echo "app-admin/conky colour-name-map" > /etc/portage/package.use/conky

@fvalenduc
Copy link

Indeed, setting this use flag solve the problem.
Thanks for the hint.

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants