Skip to content

Commit

Permalink
Merge pull request #740 from fastfetch-cli/dev
Browse files Browse the repository at this point in the history
Release: v2.8.6
  • Loading branch information
CarterLi committed Feb 27, 2024
2 parents de2cd79 + 0491594 commit c935527
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 2 deletions.
43 changes: 42 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ jobs:

freebsd-amd64:
name: FreeBSD-amd64
runs-on: macos-12
runs-on: ubuntu-latest
permissions:
security-events: write
contents: read
Expand All @@ -300,6 +300,9 @@ jobs:
uses: cross-platform-actions/action@master
with:
operating_system: freebsd
architecture: x86-64
cpu_count: 3
shell: bash
version: '13.2'
run: |
uname -a
Expand All @@ -320,6 +323,43 @@ jobs:
name: fastfetch-freebsd-amd64
path: ./fastfetch-*.*

freebsd-aarch64:
name: FreeBSD-aarch64
runs-on: ubuntu-latest
permissions:
security-events: write
contents: read
steps:
- name: checkout repository
uses: actions/checkout@v4

- name: run VM
uses: cross-platform-actions/action@master
with:
operating_system: freebsd
architecture: arm64
cpu_count: 3
shell: bash
version: '13.2'
run: |
uname -a
sudo pkg update
sudo pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl xfce4-conf ImageMagick6 ImageMagick7 chafa egl libosmesa opencl ocl-icd v4l_compat
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
cmake --build . --target package --verbose -j4
./fastfetch --list-features
time ./fastfetch
time ./fastfetch --format json
time ./flashfetch
ldd fastfetch
ctest
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: fastfetch-freebsd-aarch64
path: ./fastfetch-*.*

windows-amd64:
name: Windows-amd64
runs-on: windows-latest
Expand Down Expand Up @@ -458,6 +498,7 @@ jobs:
- linux-aarch64
- macos-universal
- freebsd-amd64
- freebsd-aarch64
- windows-amd64
- windows-i686
permissions:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Features:
* `{ "temp": { "ndigits": 1 } }`
* `{ "temp": { "color": { "green": "green", "yellow": "yellow", "red": "red" } } }`
* Support specifying custom `pci.ids` path for Linux (GPU, Linux)
* Support warp-linux terminal version & terminal font detection (Terminal, Linux)

# 2.8.5

Expand Down
1 change: 1 addition & 0 deletions src/common/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ void ffFontInitValues(FFfont* font, const char* name, const char* size)
ffFontInit(font);

ffStrbufAppendS(&font->name, name);
ffStrbufTrim(&font->name, '"');
ffStrbufAppendS(&font->size, size);

fontInitPretty(font);
Expand Down
30 changes: 30 additions & 0 deletions src/detection/terminalfont/terminalfont_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,34 @@ static void detectSt(FFTerminalFontResult* terminalFont, uint32_t pid)
ffFontInitValues(&terminalFont->font, font.chars, size.chars);
}

static void detectWarp(FFTerminalFontResult* terminalFont)
{
FF_STRBUF_AUTO_DESTROY baseDir = ffStrbufCreateA(64);

FF_LIST_FOR_EACH(FFstrbuf, dirPrefix, instance.state.platform.configDirs)
{
//We need to copy the dir each time, because it used by multiple threads, so we can't directly write to it.
ffStrbufSet(&baseDir, dirPrefix);
ffStrbufAppendS(&baseDir, "warp-terminal/user_preferences.json");

yyjson_doc* doc = yyjson_read_file(baseDir.chars, YYJSON_READ_INSITU | YYJSON_READ_ALLOW_TRAILING_COMMAS | YYJSON_READ_ALLOW_COMMENTS, NULL, NULL);
if (!doc) continue;

yyjson_val* prefs = yyjson_obj_get(yyjson_doc_get_root(doc), "prefs");
if (yyjson_is_obj(prefs))
{
const char* fontName = yyjson_get_str(yyjson_obj_get(prefs, "FontName"));
if (!fontName) fontName = "Hack";
const char* fontSize = yyjson_get_str(yyjson_obj_get(prefs, "FontSize"));
if (!fontSize) fontSize = "13";

ffFontInitValues(&terminalFont->font, fontName, fontSize);
}
yyjson_doc_free(doc);
return;
}
}

void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFontResult* terminalFont)
{
if(ffStrbufIgnCaseEqualS(&terminal->processName, "konsole"))
Expand Down Expand Up @@ -331,4 +359,6 @@ void ffDetectTerminalFontPlatform(const FFTerminalResult* terminal, FFTerminalFo
detectXterm(terminalFont);
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "st"))
detectSt(terminalFont, terminal->pid);
else if(ffStrbufIgnCaseEqualS(&terminal->processName, "warp"))
detectWarp(terminalFont);
}
8 changes: 7 additions & 1 deletion src/detection/terminalshell/terminalshell.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,13 @@ bool fftsGetTerminalVersion(FFstrbuf* processName, FF_MAYBE_UNUSED FFstrbuf* exe
{
if(ffStrbufStartsWithIgnCaseS(processName, termProgram) || // processName ends with `.exe` on Windows
(ffStrEquals(termProgram, "vscode") && ffStrbufStartsWithIgnCaseS(processName, "code")) ||
(ffStrEquals(termProgram, "iTerm.app") && ffStrbufStartsWithIgnCaseS(processName, "iTermServer-"))

#ifdef __APPLE__
(ffStrEquals(termProgram, "iTerm.app") && ffStrbufStartsWithIgnCaseS(processName, "iTermServer-")) ||
#elif defined(__linux__)
(ffStrEquals(termProgram, "WarpTerminal") && ffStrbufEqualS(processName, "warp")) ||
#endif
false
) {
ffStrbufSetS(version, termProgramVersion);
return true;
Expand Down

0 comments on commit c935527

Please sign in to comment.