To use Nerd Fonts with Conky, you need to ensure that:
- Nerd Font is installed on your system.
- Conky is configured to use the font via the
font setting in your Conky config.
- Icons/glyphs from the Nerd Font are used in your Conky script or text.
✅ Step 1: Install a Nerd Font
If you haven’t already, install a Nerd Font like FiraCode Nerd Font, Hack Nerd Font, or JetBrainsMono Nerd Font.
On Arch Linux:
yay -S ttf-fira-code-nerd
On Ubuntu/Debian:
Download from Nerd Fonts GitHub or use:
mkdir -p ~/.fonts
cd ~/.fonts && wget https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FiraCode.zip
unzip FiraCode.zip
fc-cache -fv
On macOS (with Homebrew):
brew tap homebrew/cask-fonts
brew install --cask font-fira-code-nerd-font
✅ Step 2: Configure Conky to Use the Font
In your Conky config file (~/.conkyrc or ~/.conky/time_widget.conkyrc), set the font parameter to use your Nerd Font. For example:
conky.config = {
font = 'FiraCode Nerd Font Mono:size=12',
use_xft = true,
xftalpha = 0.8,
override_utf8_locale = true,
uppercase = false,
own_window_type = 'desktop',
own_window = true,
double_buffer = true,
update_interval = 1,
...
}
Notes:
- Replace
'FiraCode Nerd Font Mono:size=12' with your preferred Nerd Font and size.
use_xft = true is required for anti-aliased fonts.
override_utf8_locale = true ensures UTF-8 (and emoji) support.
✅ Step 3: Use Nerd Font Glyphs in Conky
Nerd Fonts include icons (e.g., weather, CPU, RAM, etc.). You can insert them directly in your Conky text using Unicode glyphs or via ${font} tags.
Example: Add icons to your widget
conky.text = [[
${font FiraCode Nerd Font:size=14}${font} Time: ${time %H:%M}
${font FiraCode Nerd Font:size=14}${font} Date: ${time %A, %B %d}
]]
Common Nerd Font Glyphs (prepend with ${font} tag):
| Icon | Glyph | Example Usage |
|---|
| Clock | | ${font FiraCode Nerd Font:size=14}${font} |
| Calendar | | ${font FiraCode Nerd Font:size=14}${font} |
| CPU | | ${font FiraCode Nerd Font:size=14}${font} |
| RAM | | ${font FiraCode Nerd Font:size=14}${font} |
| Battery | | ${font FiraCode Nerd Font:size=14}${font} |
| Network | | ${font FiraCode Nerd Font:size=14}${font} |
✅ Step 4: Full Example with Nerd Font
Here’s a full Conky config using Nerd Fonts:
conky.config = {
background = true,
own_window = true,
own_window_type = 'desktop',
double_buffer = true,
no_buffers = true,
update_interval = 1,
alignment = 'top_right',
gap_x = 20,
gap_y = 20,
minimum_width = 300,
minimum_height = 200,
maximum_width = 300,
own_window_argb_visual = true,
own_window_argb_value = 0,
own_window_colour = '000000',
own_window_transparent = true,
draw_shades = false,
draw_outline = false,
draw_borders = false,
use_xft = true,
font = 'FiraCode Nerd Font Mono:size=12',
xftalpha = 0.8,
override_utf8_locale = true,
uppercase = false,
};
conky.text = [[
${font FiraCode Nerd Font:size=14}${font} Time: ${time %H:%M:%S}
${font FiraCode Nerd Font:size=14}${font} Date: ${time %A, %B %d}
${font FiraCode Nerd Font:size=14}${font} CPU: ${cpu}% ${cpubar}
${font FiraCode Nerd Font:size=14}${font} RAM: $memperc% ${membar}
${font FiraCode Nerd Font:size=14}${font} Battery: ${battery_percent}% ${battery_bar}
${font FiraCode Nerd Font:size=14}${font} Network: ${downspeed enp3s0}/s down, ${upspeed enp3s0}/s up
]]
🔍 Troubleshooting
1. Font Not Found
- Run
fc-list | grep -i "FiraCode Nerd" to check if the font is installed.
- Use
xfontsel to test available fonts.
2. Icons Not Showing
- Ensure you're using the correct glyph (e.g.,
for clock).
- Confirm the font is set correctly in Conky:
font = 'FiraCode Nerd Font Mono:size=12'.
3. Conky Crashes
- Use
conky -c ~/.conkyrc -v to debug font issues.
- Avoid mixing font styles like
FiraCode Nerd Font:bold:size=12 if it causes crashes.
📝 Final Tips
- Use Nerd Fonts Cheatsheet to find glyphs.
- Test your Conky config with
conky -c ~/.conkyrc before autostarting.
- For advanced use, combine with Lua scripts to dynamically generate icons and progress bars.
Let me know if you want a custom widget with icons or need help with icon alignment!