fastfetch icon indicating copy to clipboard operation
fastfetch copied to clipboard

[BUG] Terminal font detection issue on Alacritty

Open K404mi opened this issue 1 year ago • 1 comments

Read the FAQ first

  • [x] I have checked the FAQ but the issue is not covered

Description

When running Fastfetch in Alacritty, the font detection module incorrectly reports the font name as "alacritty" instead of the actual configured font family.

Image

This happens when the Alacritty configuration is in the newer TOML format and uses nested tables for font definition like this:

[font]
size = 12.0
normal = { family = "Maple Mono NL NF CN", style = "Regular" }
bold = { family = "Maple Mono NL NF CN", style = "Bold" }
italic = { family = "Maple Mono NL NF CN", style = "Italic" }
bold_italic = { family = "Maple Mono NL NF CN", style = "Bold Italic" }

According to detectAlacritty(), it looks like the current code only queries for top-level keys "family" and "size"

        FFpropquery fontQueryToml[] = {
            {"family =", &fontName},
            {"size =", &fontSize},
        };

resulting in the fallback being triggered

    if(fontName.length == 0)
        ffStrbufAppendS(&fontName, "alacritty");

The top-level key "family" is not valid in the latest Alacritty configuration whatsoever, and since people can use multiple style-specific fonts at the same time, the parsing logic might be better off handling the entire [font] table and merge the result?

Version used

fastfetch 2.55.1 (aarch64)

Bug prevalence

Always

Regression

Not sure

Installation

Package manager

Package manager

pacman

Screenshots

No response

Configuration

fresh install with no config

System information

[
  {
    "type": "Title",
    "result": {
      "userName": "root",
      "fullUserName": "",
      "hostName": "kiwi",
      "homeDir": "/root/",
      "exePath": "/usr/bin/fastfetch",
      "userShell": "/usr/bin/zsh"
    },
    "stat": 0.024462000001221895
  },
  {
    "type": "Separator",
    "error": "Unsupported for JSON format",
    "stat": 0.0010000001639127731
  },
  {
    "type": "OS",
    "result": {
      "buildID": "rolling",
      "codename": "",
      "id": "archarm",
      "idLike": "arch",
      "name": "Arch Linux ARM",
      "prettyName": "Arch Linux ARM",
      "variant": "",
      "variantID": "",
      "version": "",
      "versionID": ""
    },
    "stat": 0.0720369997434318
  },
  {
    "type": "Host",
    "result": {
      "family": "",
      "name": "Raspberry Pi 4 Model B Rev 1.2",
      "version": "",
      "sku": "",
      "vendor": "",
      "serial": "100000000873b1ee",
      "uuid": ""
    },
    "stat": 0.1282770000398159
  },
  {
    "type": "BIOS",
    "result": {
      "date": "",
      "release": "",
      "vendor": "",
      "version": "",
      "type": "BIOS"
    },
    "stat": 0.06438899971544743
  },
  {
    "type": "Bootmgr",
    "error": "Failed to read efivar: BootCurrent",
    "stat": 0.007166000083088875
  },
  {
    "type": "Board",
    "result": {
      "name": "4-model-b",
      "vendor": "raspberrypi",
      "version": "",
      "serial": ""
    },
    "stat": 0.07207399979233742
  },
  {
    "type": "Chassis",
    "error": "chassis_type is not set by O.E.M.",
    "stat": 0.041851000394672155
  },
  {
    "type": "Kernel",
    "result": {
      "architecture": "aarch64",
      "name": "Linux",
      "release": "6.17.9-1-aarch64-ARCH",
      "version": "#1 SMP PREEMPT_DYNAMIC Tue Nov 25 13:30:17 UTC 2025",
      "pageSize": 4096
    },
    "stat": 0.004036999773234129
  },
  {
    "type": "InitSystem",
    "result": {
      "name": "systemd",
      "exe": "/usr/lib/systemd/systemd",
      "version": "258.2-2-arch",
      "pid": 1
    },
    "stat": 1.009887000080198
  },
  {
    "type": "Uptime",
    "result": {
      "uptime": 4003890,
      "bootTime": "2025-11-28T01:59:21.123+0800"
    },
    "stat": 0.11773999966681004
  },
  {
    "type": "Loadavg",
    "result": [
      0.07,
      0.04,
      0.01
    ],
    "stat": 0.04735200013965368
  },
  {
    "type": "Processes",
    "result": 169,
    "stat": 0.4411100000143051
  },
  {
    "type": "Packages",
    "result": {
      "all": 285,
      "amSystem": 0,
      "amUser": 0,
      "apk": 0,
      "brew": 0,
      "brewCask": 0,
      "choco": 0,
      "dpkg": 0,
      "emerge": 0,
      "eopkg": 0,
      "flatpakSystem": 0,
      "flatpakUser": 0,
      "guixSystem": 0,
      "guixUser": 0,
      "guixHome": 0,
      "hpkgSystem": 0,
      "hpkgUser": 0,
      "linglong": 0,
      "mport": 0,
      "nixDefault": 0,
      "nixSystem": 0,
      "nixUser": 0,
      "opkg": 0,
      "pacman": 285,
      "pacstall": 0,
      "paludis": 0,
      "pisi": 0,
      "pkg": 0,
      "pkgtool": 0,
      "pkgsrc": 0,
      "macports": 0,
      "rpm": 0,
      "scoopUser": 0,
      "scoopGlobal": 0,
      "snap": 0,
      "soar": 0,
      "sorcery": 0,
      "winget": 0,
      "xbps": 0,
      "pacmanBranch": ""
    },
    "stat": 1.2587559996172786
  },
  {
    "type": "Shell",
    "result": {
      "exe": "/usr/bin/zsh",
      "exeName": "zsh",
      "exePath": "/usr/bin/zsh",
      "pid": 507,
      "ppid": 499,
      "processName": "zsh",
      "prettyName": "zsh",
      "version": "5.9",
      "tty": 0
    },
    "stat": 0.3724250001832843
  },
  {
    "type": "Editor",
    "error": "$VISUAL or $EDITOR not set",
    "stat": 0.0034260000102221966
  },
  {
    "type": "Display",
    "result": [
      {
        "id": 34,
        "name": "ARZOPA",
        "primary": false,
        "output": {
          "width": 1920,
          "height": 1080,
          "refreshRate": 60.0,
          "drrStatus": null
        },
        "scaled": {
          "width": 0,
          "height": 0
        },
        "preferred": {
          "width": 1920,
          "height": 1080,
          "refreshRate": 60.0
        },
        "physical": {
          "width": 360,
          "height": 200
        },
        "rotation": 0,
        "bitDepth": 8,
        "hdrStatus": "Supported",
        "type": "External",
        "manufactureDate": {
          "year": 2023,
          "week": 47
        },
        "serial": 825364997,
        "platformApi": "libdrm"
      }
    ],
    "stat": 8.9461799999699
  },
  {
    "type": "Brightness",
    "result": [],
    "stat": 0.5634250002913177
  },
  {
    "type": "Monitor",
    "error": "Monitor module is an alias of Display module",
    "stat": 0.002518000081181526
  },
  {
    "type": "LM",
    "error": "Failed to get $XDG_SESSION_ID",
    "stat": 0.02783399960026145
  },
  {
    "type": "DE",
    "error": "No DE found",
    "stat": 0.001815000083297491
  },
  {
    "type": "WM",
    "error": "No WM found",
    "stat": 0.002443999983370304
  },
  {
    "type": "WMTheme",
    "error": "WM Theme needs successful WM detection",
    "stat": 0.0023709996603429317
  },
  {
    "type": "Theme",
    "error": "No themes found",
    "stat": 0.23294400004670024
  },
  {
    "type": "Icons",
    "error": "No icons could be found",
    "stat": 0.0025369999930262566
  },
  {
    "type": "Font",
    "error": "No fonts found",
    "stat": 0.006426000036299229
  },
  {
    "type": "Cursor",
    "result": {
      "theme": "Adwaita",
      "size": ""
    },
    "stat": 0.0699809999205172
  },
  {
    "type": "Wallpaper",
    "error": "Failed to detect the current wallpaper path",
    "stat": 0.0020189997740089893
  },
  {
    "type": "Terminal",
    "result": {
      "processName": "alacritty",
      "exe": "alacritty",
      "exeName": "alacritty",
      "exePath": "/usr/bin/alacritty",
      "pid": 499,
      "ppid": 460,
      "prettyName": "alacritty",
      "version": "0.16.1",
      "tty": ""
    },
    "stat": 6.607075999956578
  },
  {
    "type": "TerminalFont",
    "result": {
      "font": {
        "name": "alacritty",
        "size": "11",
        "styles": [],
        "pretty": "alacritty (11pt)"
      },
      "fallback": {
        "name": "",
        "size": "",
        "styles": [],
        "pretty": ""
      }
    },
    "stat": 0.24246300011873245
  },
  {
    "type": "TerminalSize",
    "result": {
      "columns": 191,
      "rows": 46,
      "width": 1910,
      "height": 1012
    },
    "stat": 0.03001900017261505
  },
  {
    "type": "TerminalTheme",
    "result": {
      "fg": {
        "r": 169,
        "g": 177,
        "b": 214,
        "dark": false
      },
      "bg": {
        "r": 26,
        "g": 27,
        "b": 38,
        "dark": true
      }
    },
    "stat": 0.46512799989432096
  },
  {
    "type": "CPU",
    "result": {
      "cpu": "BCM2711",
      "vendor": "Broadcom",
      "packages": 1,
      "cores": {
        "physical": 4,
        "logical": 4,
        "online": 4
      },
      "frequency": {
        "base": 0,
        "max": 1500
      },
      "coreTypes": [
        {
          "count": 4,
          "freq": 1500
        }
      ],
      "temperature": 36.511,
      "march": "ARMv8-A"
    },
    "stat": 0.5671840002760291
  },
  {
    "type": "CPUCache",
    "result": {
      "l1": [
        {
          "size": 32768,
          "num": 4,
          "lineSize": 64,
          "type": "data"
        },
        {
          "size": 49152,
          "num": 4,
          "lineSize": 64,
          "type": "instruction"
        }
      ],
      "l2": [
        {
          "size": 1048576,
          "num": 1,
          "lineSize": 64,
          "type": "unified"
        }
      ]
    },
    "stat": 2.0409209998324513
  },
  {
    "type": "CPUUsage",
    "result": [
      0.0,
      0.0,
      0.0,
      0.0
    ],
    "stat": 200.2339679999277
  },
  {
    "type": "GPU",
    "result": [
      {
        "index": null,
        "coreCount": null,
        "coreUsage": null,
        "memory": {
          "dedicated": {
            "total": null,
            "used": null
          },
          "shared": {
            "total": null,
            "used": null
          },
          "type": null
        },
        "driver": "vc4-drm",
        "name": "bcm2711-vc5",
        "temperature": null,
        "type": "Integrated",
        "vendor": "Broadcom",
        "platformApi": "DRM (card1)",
        "frequency": null,
        "deviceId": 0
      },
      {
        "index": null,
        "coreCount": null,
        "coreUsage": null,
        "memory": {
          "dedicated": {
            "total": null,
            "used": null
          },
          "shared": {
            "total": null,
            "used": null
          },
          "type": null
        },
        "driver": "v3d",
        "name": "2711-v3d",
        "temperature": null,
        "type": "Integrated",
        "vendor": "Broadcom",
        "platformApi": "DRM (card0)",
        "frequency": null,
        "deviceId": 0
      }
    ],
    "stat": 0.34975899988785386
  },
  {
    "type": "Memory",
    "result": {
      "total": 3957964800,
      "used": 279666688
    },
    "stat": 0.03646300034597516
  },
  {
    "type": "PhysicalMemory",
    "error": "Failed to get SMBIOS data",
    "stat": 0.017185000237077475
  },
  {
    "type": "Swap",
    "result": [],
    "stat": 0.01738900039345026
  },
  {
    "type": "Disk",
    "result": [
      {
        "bytes": {
          "available": 113875963904,
          "free": 120232271872,
          "total": 124200345600,
          "used": 3968073728
        },
        "files": {
          "total": 7741440,
          "used": 65853
        },
        "filesystem": "ext4",
        "mountpoint": "/",
        "mountFrom": "/dev/mmcblk1p2",
        "name": "ROOT",
        "volumeType": [
          "Regular"
        ],
        "createTime": "2025-11-25T09:14:52.000+0800"
      }
    ],
    "stat": 0.49899799982085824
  },
  {
    "type": "Btrfs",
    "result": [],
    "stat": 0.03538799984380603
  },
  {
    "type": "Zpool",
    "error": "dlopen libzfs.so failed",
    "stat": 0.5431280001066625
  },
  {
    "type": "Battery",
    "result": [],
    "stat": 0.020925999619066715
  },
  {
    "type": "PowerAdapter",
    "result": [],
    "stat": 0.014481000136584044
  },
  {
    "type": "Player",
    "error": "Player module is an alias of Media module",
    "stat": 0.001221999991685152
  },
  {
    "type": "Media",
    "error": "Failed to connect to DBus",
    "stat": 1.4799219998531044
  },
  {
    "type": "PublicIp",
    "result": {
      "ip": "182.87.102.77",
      "location": "Nanchang, CN"
    },
    "stat": 386.99919300014153
  },
  {
    "type": "LocalIp",
    "result": [
      {
        "name": "end0",
        "defaultRoute": {
          "ipv4": true,
          "ipv6": true
        },
        "ipv4": "192.168.1.28/24",
        "ipv6": "240e:370:4f1b:c040:dea6:32ff:fe81:bd88/64,fe80::dea6:32ff:fe81:bd88/64",
        "mac": "dc:a6:32:81:bd:88",
        "mtu": 1500,
        "speed": 1000,
        "flags": "UP,BROADCAST,RUNNING,MULTICAST,LOWER_UP"
      }
    ],
    "stat": 0.3390919999219477
  },
  {
    "type": "DNS",
    "result": [
      "192.168.1.1",
      "fe80::1%2"
    ],
    "stat": 0.05949999997392297
  },
  {
    "type": "Wifi",
    "result": [
      {
        "inf": {
          "description": "wlan0",
          "status": "down"
        },
        "conn": {
          "status": "disconnected",
          "ssid": "",
          "bssid": "",
          "protocol": "",
          "security": "",
          "signalQuality": null,
          "rxRate": null,
          "txRate": null,
          "channel": 0,
          "frequency": 0
        }
      }
    ],
    "stat": 0.33181400038301945
  },
  {
    "type": "DateTime",
    "result": "2025-11-28T03:06:05.626+0800",
    "stat": 0.03524099988862872
  },
  {
    "type": "Locale",
    "result": "en_US.UTF-8",
    "stat": 0.0035740002058446407
  },
  {
    "type": "Vulkan",
    "error": "ffvkCreateInstance() failed: VK_ERROR_INCOMPATIBLE_DRIVER",
    "stat": 12.621635000221431
  },
  {
    "type": "OpenGL",
    "error": "Fastfetch was built without gl support.",
    "stat": 0.0030179996974766254
  },
  {
    "type": "OpenCL",
    "error": "dlopen libOpenCL.so failed",
    "stat": 0.2333149998448789
  },
  {
    "type": "Users",
    "result": [
      {
        "name": "kiwi",
        "hostName": "",
        "sessionName": "tty1",
        "clientIp": "",
        "loginTime": "2025-11-28T01:59:14.997+0800"
      }
    ],
    "stat": 0.15674000000581145
  },
  {
    "type": "Bluetooth",
    "result": [],
    "stat": 0.03725899988785386
  },
  {
    "type": "BluetoothRadio",
    "result": [
      {
        "name": "",
        "address": "",
        "lmpVersion": null,
        "lmpSubversion": null,
        "vendor": "Unknown",
        "enabled": false,
        "discoverable": false,
        "connectable": false
      }
    ],
    "stat": 0.6836090004071593
  },
  {
    "type": "Sound",
    "error": "Failed to load libpulse.so",
    "stat": 0.1993889999575913
  },
  {
    "type": "Camera",
    "result": [],
    "stat": 0.016462999861687422
  },
  {
    "type": "Gamepad",
    "result": [],
    "stat": 0.05279600014910102
  },
  {
    "type": "Mouse",
    "result": [
      {
        "serial": "",
        "name": "BenQ ZOWIE BenQ ZOWIE Gaming Mouse",
        "ignored": false
      }
    ],
    "stat": 0.17564800009131432
  },
  {
    "type": "Keyboard",
    "result": [
      {
        "serial": "C87ALight00A",
        "name": "USB Keyboard USB Keyboard",
        "ignored": false
      }
    ],
    "stat": 0.15638799965381622
  },
  {
    "type": "Weather",
    "error": "ffNetworkingSendHttpRequest() failed",
    "stat": 374.5898180003278
  },
  {
    "type": "NetIO",
    "result": [
      {
        "name": "end0",
        "defaultRoute": true,
        "txBytes": 496,
        "rxBytes": 1267,
        "txPackets": 6,
        "rxPackets": 9,
        "rxErrors": 0,
        "txErrors": 0,
        "rxDrops": 1,
        "txDrops": 0
      }
    ],
    "stat": 0.23109199991449714
  },
  {
    "type": "DiskIO",
    "result": [
      {
        "name": "mmcblk1",
        "devPath": "/dev/mmcblk1",
        "bytesRead": 339968,
        "bytesWritten": 0,
        "readCount": 10,
        "writeCount": 0
      }
    ],
    "stat": 0.24653599970042706
  },
  {
    "type": "PhysicalDisk",
    "result": [
      {
        "name": "mmcblk1",
        "devPath": "/dev/mmcblk1",
        "interconnect": "MMC",
        "kind": "SSD",
        "size": 127865454592,
        "serial": "0x47309d36",
        "removable": false,
        "readOnly": false,
        "revision": "",
        "temperature": null
      }
    ],
    "stat": 0.33240600023418665
  },
  {
    "type": "TPM",
    "error": "TPM device is not found",
    "stat": 0.01911100000143051
  },
  {
    "type": "Version",
    "result": {
      "projectName": "fastfetch",
      "sysName": "Linux",
      "architecture": "aarch64",
      "version": "2.55.1",
      "versionGit": "",
      "cmakeBuiltType": "RelWithDebInfo",
      "compileTime": "Nov 16 2025, 10:24:12",
      "compiler": "gcc 15.2.1",
      "debugMode": false,
      "libc": "glibc 2.42"
    },
    "stat": 0.004093000199645758
  },
  {
    "type": "Break",
    "error": "Unsupported for JSON format",
    "stat": 0.001703999936580658
  },
  {
    "type": "Colors",
    "error": "Unsupported for JSON format",
    "stat": 0.0016850000247359276
  }
]

Features built-in

threads
vulkan
wayland
xcb-randr
xrandr
drm
drm_amdgpu
gio
dconf
dbus
imagemagick7
chafa
zlib
sqlite3
opencl
libpulse
libddcutil
libelf
libzfs
Directx Headers
System yyjson
linux/videodev2
linux/wireless

K404mi avatar Nov 27 '25 20:11 K404mi

Did a quick implementation; please test.

The parser is very loose. I don't really want to introduce a new dependency of toml parser only for parsing Alacritty's config file.

CarterLi avatar Nov 28 '25 08:11 CarterLi