Skip to content

Add Support for ENux#2391

Open
ENux-Distro wants to merge 2 commits into
fastfetch-cli:devfrom
ENux-Distro:enux-support
Open

Add Support for ENux#2391
ENux-Distro wants to merge 2 commits into
fastfetch-cli:devfrom
ENux-Distro:enux-support

Conversation

@ENux-Distro

Copy link
Copy Markdown

Add Support for ENux

What this does

  • Adds a builtin ASCII logo for ENux (src/logo/ascii/e/enux.txt) and registers it
    in src/logo/ascii/e.inc under the name enux. The logo, module keys, and title
    all render in black (FF_COLOR_FG_BLACK), matching ENux's all-black branding.
  • The logo is auto-selected by OS ID, so no extra wiring is needed: when
    /etc/os-release reports ID=enux, fastfetch picks this logo automatically.

How ENux is detected

ENux ships with Bedrock Linux pre-integrated, so the OS-release lookup needed a patch
in detectBedrock() (src/detection/os/os_linux.c). On a Bedrock system the default
os-release comes from the bedrock stratum, which would make fastfetch report
"Bedrock" instead of the actual distro. The patched logic checks for the enux stratum
first and reads its os-release when present:

if (ffPathExists(".../bedrock/strata/enux", FF_PATHTYPE_DIRECTORY))
    return parseOsRelease(".../bedrock/strata/enux/etc/os-release", os);
// otherwise fall back to the bedrock stratum
return parseOsRelease(".../bedrock/strata/bedrock/etc/os-release", os);

This makes fastfetch report ENux (ID=enux) on a Bedrock-based ENux install, which in
turn triggers the ENux logo.

@codacy-production

codacy-production Bot commented Jun 9, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

The PR introduces support for ENux, but the current implementation of the detectBedrock function contains a logic error that breaks the fallback mechanism. Specifically, if the ENux stratum directory is found but the os-release file within it is missing or unparseable, the function returns false immediately instead of attempting to detect the standard Bedrock stratum.

Additionally, the use of FF_COLOR_FG_BLACK for branding colors poses a significant accessibility risk. On the majority of Linux terminals, which use a dark or black background, the fetch output will be invisible. While this may align with the distribution's branding, it severely impacts the usability of the tool. There are also several code style deviations (Allman vs K&R braces) that should be addressed for codebase consistency.

About this PR

  • The decision to use FF_COLOR_FG_BLACK for the logo, keys, and title makes the tool's output functionally invisible on the most common terminal configuration (dark backgrounds). Consider using a more accessible alternative like FF_COLOR_FG_LIGHT_BLACK or providing a toggle if this branding is mandatory.
  • No unit or integration tests were included to verify the new detection logic for Bedrock strata, increasing the risk of regressions in OS identification.

Test suggestions

  • Verify that 'detectBedrock' correctly identifies ENux when the '/bedrock/strata/enux' directory exists.
  • Verify that 'detectBedrock' falls back to the default 'bedrock' stratum when the 'enux' stratum is missing.
  • Verify that OS detection is skipped when 'BEDROCK_RESTRICT' is set to '1'.
  • Verify that the 'enux' logo is automatically selected when the OS ID is 'enux'.
  • Verify that the 'enux' logo, keys, and title are rendered using 'FF_COLOR_FG_BLACK'.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify that 'detectBedrock' correctly identifies ENux when the '/bedrock/strata/enux' directory exists.
2. Verify that 'detectBedrock' falls back to the default 'bedrock' stratum when the 'enux' stratum is missing.
3. Verify that OS detection is skipped when 'BEDROCK_RESTRICT' is set to '1'.
4. Verify that the 'enux' logo is automatically selected when the OS ID is 'enux'.
5. Verify that the 'enux' logo, keys, and title are rendered using 'FF_COLOR_FG_BLACK'.

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

Comment on lines +306 to 313
if (ffPathExists(
FASTFETCH_TARGET_DIR_ROOT "/bedrock/strata/enux",
FF_PATHTYPE_DIRECTORY))
{
return parseOsRelease(
FASTFETCH_TARGET_DIR_ROOT "/bedrock/strata/enux/etc/os-release",
os);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM RISK

If the 'enux' directory exists but the 'os-release' file within it cannot be parsed, the function returns false without attempting to detect the base Bedrock system. This breaks the fallback mechanism. The detection should only return if it successfully finds OS information.

Try running the following prompt in your coding agent:

Refactor the detectBedrock function in src/detection/os/os_linux.c to attempt parsing the enux stratum's os-release first, and only return if it succeeds; otherwise, fall back to parsing the default Bedrock stratum's os-release.

Comment thread src/logo/ascii/e.inc
Comment on lines +161 to +165
.colors = {
FF_COLOR_FG_BLACK,
},
.colorKeys = FF_COLOR_FG_BLACK,
.colorTitle = FF_COLOR_FG_BLACK,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM RISK

Suggestion: Using FF_COLOR_FG_BLACK for the logo, keys, and title will make the output invisible on dark-themed terminals. While this matches ENux branding, it is better to use FF_COLOR_FG_DEFAULT or FF_COLOR_FG_LIGHT_BLACK to ensure accessibility for the majority of users.

Comment on lines +300 to 318
static bool detectBedrock(FFOSResult* os)
{
const char* bedrockRestrict = getenv("BEDROCK_RESTRICT");
if (bedrockRestrict && bedrockRestrict[0] == '1') {
if (bedrockRestrict && bedrockRestrict[0] == '1')
return false;

if (ffPathExists(
FASTFETCH_TARGET_DIR_ROOT "/bedrock/strata/enux",
FF_PATHTYPE_DIRECTORY))
{
return parseOsRelease(
FASTFETCH_TARGET_DIR_ROOT "/bedrock/strata/enux/etc/os-release",
os);
}
return parseOsRelease(FASTFETCH_TARGET_DIR_ROOT "/bedrock/strata/bedrock/etc/os-release", os);

return parseOsRelease(
FASTFETCH_TARGET_DIR_ROOT "/bedrock/strata/bedrock/etc/os-release",
os);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ LOW RISK

Nitpick: The function deviates from the project's preference for K&R style braces and mandatory braces for single-line if statements.

Suggested change
static bool detectBedrock(FFOSResult* os)
{
const char* bedrockRestrict = getenv("BEDROCK_RESTRICT");
if (bedrockRestrict && bedrockRestrict[0] == '1') {
if (bedrockRestrict && bedrockRestrict[0] == '1')
return false;
if (ffPathExists(
FASTFETCH_TARGET_DIR_ROOT "/bedrock/strata/enux",
FF_PATHTYPE_DIRECTORY))
{
return parseOsRelease(
FASTFETCH_TARGET_DIR_ROOT "/bedrock/strata/enux/etc/os-release",
os);
}
return parseOsRelease(FASTFETCH_TARGET_DIR_ROOT "/bedrock/strata/bedrock/etc/os-release", os);
return parseOsRelease(
FASTFETCH_TARGET_DIR_ROOT "/bedrock/strata/bedrock/etc/os-release",
os);
}
static bool detectBedrock(FFOSResult* os) {
const char* bedrockRestrict = getenv("BEDROCK_RESTRICT");
if (bedrockRestrict && bedrockRestrict[0] == '1') {
return false;
}
if (ffPathExists(FASTFETCH_TARGET_DIR_ROOT "/bedrock/strata/enux", FF_PATHTYPE_DIRECTORY)) {
if (parseOsRelease(FASTFETCH_TARGET_DIR_ROOT "/bedrock/strata/enux/etc/os-release", os)) {
return true;
}
}
return parseOsRelease(FASTFETCH_TARGET_DIR_ROOT "/bedrock/strata/bedrock/etc/os-release", os);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant