Skip to content

Commit 1837446

Browse files
authored
Merge pull request #615 from fastfetch-cli/dev
Release v2.2.2
2 parents 168d96a + 499e6c8 commit 1837446

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+411
-279
lines changed

.github/workflows/ci.yml

+30-17
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,27 @@ jobs:
2828
- name: checkout repository
2929
uses: actions/checkout@v4
3030

31+
- name: uname -a
32+
run: uname -a
33+
3134
- name: install required packages
3235
run: sudo apt-get update && sudo apt-get install -y musl-dev musl-tools linux-headers-generic libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev rpm librpm-dev libzstd-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libnm-dev libpulse-dev directx-headers-dev
3336

3437
- name: configure project
3538
env:
3639
CC: ${{ matrix.compiler.cc }}
3740
CXX: ${{ matrix.compiler.cxx }}
38-
run: cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_LIBPCI=${{ matrix.enableFeatures }} -DENABLE_VULKAN=${{ matrix.enableFeatures }} -DENABLE_WAYLAND=${{ matrix.enableFeatures }} -DENABLE_XCB_RANDR=${{ matrix.enableFeatures }} -DENABLE_XCB=${{ matrix.enableFeatures }} -DENABLE_XRANDR=${{ matrix.enableFeatures }} -DENABLE_X11=${{ matrix.enableFeatures }} -DENABLE_GIO=${{ matrix.enableFeatures }} -DENABLE_DCONF=${{ matrix.enableFeatures }} -DENABLE_DBUS=${{ matrix.enableFeatures }} -DENABLE_XFCONF=${{ matrix.enableFeatures }} -DENABLE_SQLITE3=${{ matrix.enableFeatures }} -DENABLE_RPM=${{ matrix.enableFeatures }} -DENABLE_IMAGEMAGICK7=${{ matrix.enableFeatures }} -DENABLE_IMAGEMAGICK6=${{ matrix.enableFeatures }} -DENABLE_CHAFA=${{ matrix.enableFeatures }} -DENABLE_ZLIB=${{ matrix.enableFeatures }} -DENABLE_EGL=${{ matrix.enableFeatures }} -DENABLE_GLX=${{ matrix.enableFeatures }} -DENABLE_OSMESA=${{ matrix.enableFeatures }} -DENABLE_OPENCL=${{ matrix.enableFeatures }} -DENABLE_LIBNM=${{ matrix.enableFeatures }} -DENABLE_PULSE=${{ matrix.enableFeatures }} -DENABLE_JSONC=${{ matrix.enableFeatures }} -DENABLE_DIRECTX_HEADERS=${{ matrix.enableFeatures }} .
41+
run: cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_LIBPCI=${{ matrix.enableFeatures }} -DENABLE_VULKAN=${{ matrix.enableFeatures }} -DENABLE_WAYLAND=${{ matrix.enableFeatures }} -DENABLE_XCB_RANDR=${{ matrix.enableFeatures }} -DENABLE_XCB=${{ matrix.enableFeatures }} -DENABLE_XRANDR=${{ matrix.enableFeatures }} -DENABLE_X11=${{ matrix.enableFeatures }} -DENABLE_GIO=${{ matrix.enableFeatures }} -DENABLE_DCONF=${{ matrix.enableFeatures }} -DENABLE_DBUS=${{ matrix.enableFeatures }} -DENABLE_XFCONF=${{ matrix.enableFeatures }} -DENABLE_SQLITE3=${{ matrix.enableFeatures }} -DENABLE_RPM=${{ matrix.enableFeatures }} -DENABLE_IMAGEMAGICK7=${{ matrix.enableFeatures }} -DENABLE_IMAGEMAGICK6=${{ matrix.enableFeatures }} -DENABLE_CHAFA=${{ matrix.enableFeatures }} -DENABLE_ZLIB=${{ matrix.enableFeatures }} -DENABLE_EGL=${{ matrix.enableFeatures }} -DENABLE_GLX=${{ matrix.enableFeatures }} -DENABLE_OSMESA=${{ matrix.enableFeatures }} -DENABLE_OPENCL=${{ matrix.enableFeatures }} -DENABLE_LIBNM=${{ matrix.enableFeatures }} -DENABLE_PULSE=${{ matrix.enableFeatures }} -DENABLE_DIRECTX_HEADERS=${{ matrix.enableFeatures }} .
3942

4043
- name: build project
4144
run: cmake --build .
4245

4346
- name: run tests
4447
run: ctest
4548

49+
- name: run fastfetch --list-features
50+
run: ./fastfetch --list-features
51+
4652
- name: run fastfetch
4753
run: time ./fastfetch -c presets/ci
4854

@@ -64,19 +70,27 @@ jobs:
6470
- name: checkout repository
6571
uses: actions/checkout@v4
6672

73+
- name: uname -a
74+
run: uname -a
75+
6776
- name: install required packages
6877
run: sudo apt-get update && sudo apt-get install -y libpci-dev libvulkan-dev libwayland-dev libxrandr-dev libxcb-randr0-dev libdconf-dev libdbus-1-dev libmagickcore-dev libxfconf-0-dev libsqlite3-dev rpm librpm-dev libzstd-dev libegl-dev libglx-dev libosmesa6-dev ocl-icd-opencl-dev libnm-dev libpulse-dev directx-headers-dev
6978

79+
- name: install linuxbrew packages
80+
run: |
81+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
82+
/home/linuxbrew/.linuxbrew/bin/brew install imagemagick --ignore-dependencies
83+
7084
- name: Initialize CodeQL
7185
uses: github/codeql-action/init@v2
7286
with:
7387
languages: c
7488

7589
- name: configure project
76-
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr .
90+
run: PKG_CONFIG_PATH=/home/linuxbrew/.linuxbrew/lib/pkgconfig:$PKG_CONFIG_PATH cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=/usr .
7791

7892
- name: build project
79-
run: cmake --build . --target package
93+
run: cmake --build . --target package --verbose
8094

8195
- name: perform CodeQL analysis
8296
uses: github/codeql-action/analyze@v2
@@ -119,8 +133,13 @@ jobs:
119133
- name: checkout repository
120134
uses: actions/checkout@v4
121135

136+
- name: uname -a
137+
run: uname -a
138+
122139
- name: install required packages
123-
run: brew install vulkan-loader molten-vk imagemagick chafa
140+
run: |
141+
brew update
142+
brew install vulkan-loader vulkan-headers molten-vk imagemagick chafa
124143
125144
- name: Initialize CodeQL
126145
uses: github/codeql-action/init@v2
@@ -131,7 +150,7 @@ jobs:
131150
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' .
132151

133152
- name: build project
134-
run: cmake --build . --target package
153+
run: cmake --build . --target package --verbose
135154

136155
- name: perform CodeQL analysis
137156
uses: github/codeql-action/analyze@v2
@@ -171,14 +190,16 @@ jobs:
171190
uses: actions/checkout@v4
172191

173192
- name: run VM
174-
uses: cross-platform-actions/[email protected].0
193+
uses: cross-platform-actions/[email protected].1
175194
with:
176195
operating_system: freebsd
177196
version: '13.2'
178197
run: |
198+
uname -a
199+
sudo pkg update
179200
sudo pkg install -y cmake git pkgconf binutils pciutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 glib dconf dbus sqlite3-tcl xfce4-conf ImageMagick6 ImageMagick7 chafa egl libosmesa opencl ocl-icd pulseaudio
180201
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
181-
cmake --build . --target package
202+
cmake --build . --target package --verbose
182203
./fastfetch --list-features
183204
time ./fastfetch -c presets/ci
184205
time ./fastfetch -c presets/ci --format json
@@ -215,19 +236,11 @@ jobs:
215236
- name: print msys version
216237
run: uname -a
217238

218-
- name: Initialize CodeQL
219-
uses: github/codeql-action/init@v2
220-
with:
221-
languages: c, cpp
222-
223239
- name: configure project
224240
run: env PKG_CONFIG_PATH=/clang64/lib/pkgconfig/:$PKG_CONFIG_PATH cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
225241

226242
- name: build project
227-
run: cmake --build .
228-
229-
- name: perform CodeQL analysis
230-
uses: github/codeql-action/analyze@v2
243+
run: cmake --build . --verbose
231244

232245
- name: copy necessary dlls
233246
run: cp /clang64/bin/{OpenCL,vulkan-1}.dll .
@@ -294,7 +307,7 @@ jobs:
294307
run: env PKG_CONFIG_PATH=/clang32/lib/pkgconfig/:$PKG_CONFIG_PATH cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
295308

296309
- name: build project
297-
run: cmake --build .
310+
run: cmake --build . --verbose
298311

299312
- name: perform CodeQL analysis
300313
uses: github/codeql-action/analyze@v2

CHANGELOG.md

+23
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
# 2.2.2
2+
3+
Changes:
4+
* `--percent-type` now defaults to 9 (colored percentage numbers)
5+
* `fastfetch` now prints LocalIp module by default
6+
7+
Features:
8+
* LocalIP module now prints netmask in CIDR format for IPv4 (LocalIP)
9+
* Bios module now detects system firmware type (Bios)
10+
* Improve detection of `Battery`
11+
* Detect cycle count on supported platforms
12+
* Detect temperature on Linux when supported
13+
* Status detection on macOS has been adjusted to be consistant with other platforms
14+
* Linux binaries are built with imagemagick7 support
15+
16+
Bugfixes:
17+
* Fix unitialized variables (#609)
18+
* Fix spelling of `--preserve-aspect-ratio` (#614)
19+
20+
Logos:
21+
22+
* Update NixOS_small
23+
124
# 2.2.1
225

326
Hotfix release for #606

CMakeLists.txt

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
22

33
project(fastfetch
4-
VERSION 2.2.1
4+
VERSION 2.2.2
55
LANGUAGES C
66
DESCRIPTION "Fast neofetch-like system information tool"
77
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -234,14 +234,11 @@ endif()
234234

235235
function(fastfetch_load_raw_text FILENAME OUTVAR)
236236
file(READ "${FILENAME}" TEMP)
237-
string(REGEX REPLACE "\n$" "" TEMP "${TEMP}") # Remove trailing newline
238-
string(JSON TEMP SET "{}" "${TEMP}" "0") # Encode raw strings using JSON_SET
239-
string(REGEX REPLACE "^\\{[ \t\r\n]*" "" TEMP "${TEMP}") # Remove JSON braces
240-
string(REGEX REPLACE "[ \t\r\n]*:[ \t\r\n]*0[ \t\r\n]*\\}$" "" TEMP "${TEMP}") # Remove trailing ` : 0 }`
241-
if(NOT "${TEMP}" MATCHES "^\"[^\n]*\"")
242-
message(FATAL_ERROR "Internal error: unexpected output: '${TEMP}'")
243-
endif()
244-
set(${OUTVAR} "${TEMP}" PARENT_SCOPE)
237+
string(REGEX REPLACE "\n$" "" TEMP "${TEMP}") # Remove trailing newline
238+
string(REPLACE "\\" "\\\\" TEMP "${TEMP}") # Escape backslashes
239+
string(REPLACE "\n" "\\n" TEMP "${TEMP}") # Replace newlines with \n
240+
string(REPLACE "\"" "\\\"" TEMP "${TEMP}") # Replace quotes with \"
241+
set(${OUTVAR} "\"${TEMP}\"" PARENT_SCOPE)
245242
endfunction(fastfetch_load_raw_text)
246243

247244
file(GLOB LOGO_FILES "src/logo/ascii/*.txt")

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ See Wiki: https://github.com/fastfetch-cli/fastfetch/wiki/Building
6262
* Run it with [all supported modules](https://github.com/fastfetch-cli/fastfetch/wiki/Support+Status#available-modules) and find what you interest: `fastfetch -c all.jsonc`
6363
* Find all data that fastfetch detects: `fastfetch -s <module> --format json`
6464
* Display help messages: `fastfetch --help`
65-
* Generate config file based on command line arguments: `fastfetch --arg1 --arg2 --mirgrate-config`
65+
* Generate config file based on command line arguments: `fastfetch --arg1 --arg2 --migrate-config`
6666

6767
## Customization
6868

doc/json_schema.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
"description": "Whether to print the remaining logo, if it has more lines than modules to display",
157157
"default": false
158158
},
159-
"preserveAspectRadio": {
159+
"preserveAspectRatio": {
160160
"type": "boolean",
161161
"description": "Whether to preserve the aspect ratio of the logo. Supported by iTerm image protocol",
162162
"default": false
@@ -415,7 +415,7 @@
415415
"description": "Set the percentage output type. 1 for percentage number, 2 for bar, 3 for both, 6 for bar only, 9 for colored number",
416416
"minimum": 0,
417417
"maximum": 255,
418-
"default": 1
418+
"default": 9
419419
},
420420
"ndigits": {
421421
"type": "number",

presets/examples/11.jsonc

-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
"type": "small"
55
},
66
"display": {
7-
"percent": {
8-
"type": 9
9-
},
107
"separator": "\u001b[31m-> "
118
},
129
"modules": [

presets/examples/8.jsonc

-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
"size": {
1212
"ndigits": 0,
1313
"maxPrefix": "MB"
14-
},
15-
"percent": {
16-
"type": 9
1714
}
1815
},
1916
"modules": [

presets/examples/9.jsonc

-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
"charElapsed": "=",
1010
"charTotal": "-",
1111
"width": 13
12-
},
13-
"percent": {
14-
"type": 9
1512
}
1613
},
1714
"modules": [

src/data/config_user.jsonc

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
"top": 2
99
}
1010
},
11-
"display": {
12-
"percent": {
13-
"type": 9
14-
} // colored percent number
15-
},
1611
"modules": [
1712
"title",
1813
"separator",
@@ -36,6 +31,7 @@
3631
"gpu",
3732
"memory",
3833
"disk",
34+
"localip",
3935
"battery",
4036
"poweradapter",
4137
"locale",

src/data/help.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Logo options:
3535
--logo-type <type>: Set the type of the logo given; must be auto, builtin, file, file-raw, data, data-raw, sixel, kitty, iterm or chafa
3636
--logo-width <width>: Set the width of the logo (in characters), if it is an image. Required for iTerm image protocol
3737
--logo-height <height>: Set the height of the logo (in characters), if it is an image. Required for iTerm image protocol
38-
--logo-preserve-aspect-radio <?value>: Set if the logo should fill the specified width and height as much as possible without stretching. Supported by iTerm image protocol
38+
--logo-preserve-aspect-ratio <?value>: Set if the logo should fill the specified width and height as much as possible without stretching. Supported by iTerm image protocol
3939
--logo-color-[1-9] <color>: Overwrite a color in the logo
4040
--logo-padding <padding>: Set the padding on the left and the right of the logo
4141
--logo-padding-left <padding>: Set the padding on the left of the logo
@@ -74,7 +74,7 @@ Display options:
7474
--disable-linewrap <?value>: Whether to disable line wrap during the run
7575
--hide-cursor <?value>: Whether to hide the cursor during the run
7676
--binary-prefix <value>: Set the binary prefix to used. Must be IEC, SI or JEDEC. Default is IEC
77-
--percent-type <value>: Set the percentage output type. 1 for percentage number, 2 for bar, 3 for both, 6 for bar only, 9 for colored number. Default is 1
77+
--percent-type <value>: Set the percentage output type. 1 for percentage number, 2 for bar, 3 for both, 6 for bar only, 9 for colored number. Default is 9
7878
--percent-ndigits <value>: Set the number of digits to keep after the decimal point when formatting percentage numbers. Default is 0
7979
--bar-char-elapsed <str>: Set the character to use in elapsed part. Default is '■'
8080
--bar-char-total <str>: Set the character to use in total part. Default is '-'

src/data/structure.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Display:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:GPU:Memory:Swap:Disk:Battery:PowerAdapter:Locale:Break:Colors
1+
Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Display:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:GPU:Memory:Swap:Disk:LocalIp:Battery:PowerAdapter:Locale:Break:Colors

src/detection/battery/battery.h

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ typedef struct FFBatteryResult
1515
double capacity;
1616
FFstrbuf status;
1717
double temperature;
18+
uint32_t cycleCount;
1819
} FFBatteryResult;
1920

2021
const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results);

src/detection/battery/battery_android.c

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ static const char* parseTermuxApi(FFBatteryOptions* options, FFlist* results)
3535

3636
FFBatteryResult* battery = ffListAdd(results);
3737
battery->temperature = FF_BATTERY_TEMP_UNSET;
38+
battery->cycleCount = 0;
3839
ffStrbufInit(&battery->manufacturer);
3940
ffStrbufInit(&battery->modelName);
4041
ffStrbufInit(&battery->status);

src/detection/battery/battery_apple.c

+30-29
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@
55

66
#include <IOKit/IOKitLib.h>
77

8-
static double detectBatteryTemp(void)
9-
{
10-
double result = 0;
11-
12-
if(ffDetectCoreTemps(FF_TEMP_BATTERY, &result))
13-
return FF_BATTERY_TEMP_UNSET;
14-
15-
return result;
16-
}
17-
188
const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results)
199
{
2010
io_iterator_t iterator;
@@ -24,7 +14,7 @@ const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results)
2414
io_registry_entry_t registryEntry;
2515
while((registryEntry = IOIteratorNext(iterator)) != 0)
2616
{
27-
CFMutableDictionaryRef properties;
17+
FF_CFTYPE_AUTO_RELEASE CFMutableDictionaryRef properties = NULL;
2818
if(IORegistryEntryCreateCFProperties(registryEntry, &properties, kCFAllocatorDefault, kNilOptions) != kIOReturnSuccess)
2919
{
3020
IOObjectRelease(registryEntry);
@@ -35,7 +25,13 @@ const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results)
3525
const char* error;
3626

3727
FFBatteryResult* battery = ffListAdd(results);
28+
battery->temperature = FF_BATTERY_TEMP_UNSET;
29+
ffStrbufInit(&battery->manufacturer);
30+
ffStrbufInit(&battery->modelName);
31+
ffStrbufInit(&battery->technology);
32+
ffStrbufInit(&battery->status);
3833
battery->capacity = 0.0/0.0;
34+
3935
int currentCapacity, maxCapacity;
4036

4137
if ((error = ffCfDictGetInt(properties, CFSTR("MaxCapacity"), &maxCapacity)))
@@ -50,33 +46,38 @@ const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results)
5046

5147
battery->capacity = currentCapacity * 100.0 / maxCapacity;
5248

53-
ffStrbufInit(&battery->manufacturer);
54-
ffStrbufInit(&battery->modelName);
55-
ffStrbufInit(&battery->technology);
49+
ffCfDictGetString(properties, CFSTR("DeviceName"), &battery->modelName);
50+
5651
if (!ffCfDictGetBool(properties, CFSTR("built-in"), &boolValue) && boolValue)
5752
{
5853
ffStrbufAppendS(&battery->manufacturer, "Apple Inc.");
59-
ffStrbufAppendS(&battery->modelName, "Builtin");
6054
ffStrbufAppendS(&battery->technology, "Lithium");
55+
if (!battery->modelName.length)
56+
ffStrbufAppendS(&battery->modelName, "Built-in");
6157
}
58+
59+
ffCfDictGetInt(properties, CFSTR("CycleCount"), (int32_t*) &battery->cycleCount);
60+
61+
if (!ffCfDictGetBool(properties, CFSTR("ExternalConnected"), &boolValue) && boolValue)
62+
ffStrbufAppendS(&battery->status, "AC connected, ");
6263
else
64+
ffStrbufAppendS(&battery->status, "Discharging, ");
65+
if (!ffCfDictGetBool(properties, CFSTR("IsCharging"), &boolValue) && boolValue)
66+
ffStrbufAppendS(&battery->status, "Charging, ");
67+
if (!ffCfDictGetBool(properties, CFSTR("AtCriticalLevel"), &boolValue) && boolValue)
68+
ffStrbufAppendS(&battery->status, "Critical, ");
69+
ffStrbufTrimRight(&battery->status, ' ');
70+
ffStrbufTrimRight(&battery->status, ',');
71+
72+
if (options->temp)
6373
{
64-
ffStrbufAppendS(&battery->manufacturer, "Unknown");
65-
ffStrbufAppendS(&battery->modelName, "Unknown");
66-
ffStrbufAppendS(&battery->technology, "Unknown");
74+
int64_t temp;
75+
if (!ffCfDictGetInt64(properties, CFSTR("Temperature"), &temp))
76+
battery->temperature = (double) temp / 10 - 273.15;
77+
else
78+
ffDetectCoreTemps(FF_TEMP_BATTERY, &battery->temperature);
6779
}
6880

69-
ffStrbufInit(&battery->status);
70-
if (!ffCfDictGetBool(properties, CFSTR("FullyCharged"), &boolValue) && boolValue)
71-
ffStrbufAppendS(&battery->status, "Fully charged");
72-
else if (!ffCfDictGetBool(properties, CFSTR("IsCharging"), &boolValue) && boolValue)
73-
ffStrbufAppendS(&battery->status, "Charging");
74-
else
75-
ffStrbufAppendS(&battery->status, "");
76-
77-
battery->temperature = options->temp ? detectBatteryTemp() : FF_BATTERY_TEMP_UNSET;
78-
79-
CFRelease(properties);
8081
IOObjectRelease(registryEntry);
8182
}
8283

0 commit comments

Comments
 (0)