Skip to content

Commit 1a9e637

Browse files
authored
Merge pull request #1464 from fastfetch-cli/dev
Release: v2.33.0
2 parents c145ce4 + f322405 commit 1a9e637

35 files changed

+650
-292
lines changed

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
# 2.33.0
2+
3+
Changes:
4+
* Introduce a new CMake flag `-DBUILD_FLASHFETCH=OFF` to disable building flashfetch binaries
5+
* Package managers are encouraged to enable it. See <https://github.com/fastfetch-cli/fastfetch/discussions/627> for detail
6+
7+
Bugfixes:
8+
* Fix interconnect type detection (#1453, PhysicalDisk, Linux)
9+
* Regression of v2.28
10+
* Don't report `proot` as terminal (Terminal, Android)
11+
* Remove a debug output (DiskIO, OpenBSD)
12+
* Fix media detection for some players (#1461, Media, Linux)
13+
* Regression of v2.32
14+
15+
Features:
16+
* Use `$POWERSHELL_VERSION` as PowerShell version if available (Shell, Windows)
17+
* Fetching Windows PowerShell version can be very slow. Add `$env:POWERSHELL_VERSION = $PSVersionTable.PSVersion.ToString()` in `$PROFILE` before running `fastfetch` to improve the performance of `Shell` module
18+
* Add support for ubuntu-based armbian detection (#1447, OS, Linux)
19+
* Improve performance of Bluetooth detection (Bluetooth)
20+
* We no longer report disconnected bluetooth devices in `--format json` when `--bluetooth-show-disconnected` isn't specified
21+
* Support brightness level detection for builtin displays (Brightness, OpenBSD / NetBSD)
22+
* Requires root permission on OpenBSD
23+
* Support battery level detection (Battery, OpenBSD / NetBSD)
24+
* Support CPU temperature detection in NetBSD (CPU, NetBSD)
25+
* Hard code path of `libvulkan.so` for Android
26+
* So that users don't need to install the vulkan-loader wrapper of termux
27+
28+
Logo:
29+
* Add NurOS
30+
* Add GoralixOS
31+
132
# 2.32.1
233

334
A hotfix for OpenBSD. No changes to other platforms.

CMakeLists.txt

Lines changed: 50 additions & 30 deletions
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.32.1
4+
VERSION 2.33.0
55
LANGUAGES C
66
DESCRIPTION "Fast neofetch-like system information tool"
77
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
@@ -86,6 +86,7 @@ cmake_dependent_option(ENABLE_PCIACCESS "Enable libpciaccess" ON "NetBSD OR Open
8686
option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library" OFF)
8787
option(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF)
8888
option(ENABLE_LTO "Enable link-time optimization in release mode if supported" ON)
89+
option(BUILD_FLASHFETCH "Build flashfetch" ON) # Also build the flashfetch binary
8990
option(BUILD_TESTS "Build tests" OFF) # Also create test executables
9091
option(SET_TWEAK "Add tweak to project version" ON) # This is set to off by github actions for release builds
9192
option(IS_MUSL "Build with musl libc" OFF) # Used by Github Actions
@@ -616,8 +617,8 @@ elseif(FreeBSD)
616617
src/common/sysctl.c
617618
src/detection/battery/battery_bsd.c
618619
src/detection/bios/bios_bsd.c
619-
src/detection/bluetooth/bluetooth_linux.c
620-
src/detection/bluetoothradio/bluetoothradio_linux.c
620+
src/detection/bluetooth/bluetooth_nosupport.c
621+
src/detection/bluetoothradio/bluetoothradio_nosupport.c
621622
src/detection/board/board_bsd.c
622623
src/detection/bootmgr/bootmgr_bsd.c
623624
src/detection/brightness/brightness_bsd.c
@@ -697,13 +698,13 @@ elseif(NetBSD)
697698
src/common/networking_linux.c
698699
src/common/processing_linux.c
699700
src/common/sysctl.c
700-
src/detection/battery/battery_nosupport.c
701+
src/detection/battery/battery_nbsd.c
701702
src/detection/bios/bios_nbsd.c
702-
src/detection/bluetooth/bluetooth_linux.c
703-
src/detection/bluetoothradio/bluetoothradio_linux.c
703+
src/detection/bluetooth/bluetooth_nosupport.c
704+
src/detection/bluetoothradio/bluetoothradio_nosupport.c
704705
src/detection/board/board_nbsd.c
705706
src/detection/bootmgr/bootmgr_nosupport.c
706-
src/detection/brightness/brightness_nosupport.c
707+
src/detection/brightness/brightness_nbsd.c
707708
src/detection/btrfs/btrfs_nosupport.c
708709
src/detection/chassis/chassis_nbsd.c
709710
src/detection/cpu/cpu_nbsd.c
@@ -779,13 +780,13 @@ elseif(OpenBSD)
779780
src/common/networking_linux.c
780781
src/common/processing_linux.c
781782
src/common/sysctl.c
782-
src/detection/battery/battery_nosupport.c
783+
src/detection/battery/battery_obsd.c
783784
src/detection/bios/bios_nosupport.c
784-
src/detection/bluetooth/bluetooth_linux.c
785-
src/detection/bluetoothradio/bluetoothradio_linux.c
785+
src/detection/bluetooth/bluetooth_nosupport.c
786+
src/detection/bluetoothradio/bluetoothradio_nosupport.c
786787
src/detection/board/board_nosupport.c
787788
src/detection/bootmgr/bootmgr_nosupport.c
788-
src/detection/brightness/brightness_nosupport.c
789+
src/detection/brightness/brightness_obsd.c
789790
src/detection/btrfs/btrfs_nosupport.c
790791
src/detection/chassis/chassis_nosupport.c
791792
src/detection/cpu/cpu_obsd.c
@@ -1485,6 +1486,7 @@ elseif(OpenBSD)
14851486
elseif(NetBSD)
14861487
target_link_libraries(libfastfetch
14871488
PRIVATE "m"
1489+
PRIVATE "prop"
14881490
)
14891491
elseif(SunOS)
14901492
target_link_libraries(libfastfetch
@@ -1611,41 +1613,52 @@ target_link_libraries(fastfetch
16111613
PRIVATE libfastfetch
16121614
)
16131615

1614-
add_executable(flashfetch
1615-
src/flashfetch.c
1616-
)
1617-
target_compile_definitions(flashfetch
1618-
PRIVATE FASTFETCH_TARGET_BINARY_NAME=flashfetch
1619-
)
1620-
target_link_libraries(flashfetch
1621-
PRIVATE libfastfetch
1622-
)
1623-
16241616
# Prevent fastfetch from linking to libstdc++
16251617
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
16261618
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "")
16271619
set_target_properties(fastfetch PROPERTIES LINKER_LANGUAGE C)
1628-
set_target_properties(flashfetch PROPERTIES LINKER_LANGUAGE C)
16291620

16301621
if(WIN32)
16311622
target_sources(fastfetch
16321623
PRIVATE src/util/windows/version.rc
16331624
)
1634-
target_sources(flashfetch
1635-
PRIVATE src/util/windows/version.rc
1636-
)
16371625
elseif(APPLE)
16381626
target_link_options(fastfetch
16391627
PRIVATE LINKER:-sectcreate,__TEXT,__info_plist,Info.plist
16401628
)
1641-
target_link_options(flashfetch
1642-
PRIVATE LINKER:-sectcreate,__TEXT,__info_plist,Info.plist
1643-
)
16441629
endif()
16451630

16461631
if(BINARY_LINK_TYPE STREQUAL "static")
16471632
target_link_options(fastfetch PRIVATE "-static")
1648-
target_link_options(flashfetch PRIVATE "-static")
1633+
endif()
1634+
1635+
# Apply all above parameters to flashfetch if it is built
1636+
if (BUILD_FLASHFETCH)
1637+
add_executable(flashfetch
1638+
src/flashfetch.c
1639+
)
1640+
target_compile_definitions(flashfetch
1641+
PRIVATE FASTFETCH_TARGET_BINARY_NAME=flashfetch
1642+
)
1643+
target_link_libraries(flashfetch
1644+
PRIVATE libfastfetch
1645+
)
1646+
1647+
set_target_properties(flashfetch PROPERTIES LINKER_LANGUAGE C)
1648+
1649+
if(WIN32)
1650+
target_sources(flashfetch
1651+
PRIVATE src/util/windows/version.rc
1652+
)
1653+
elseif(APPLE)
1654+
target_link_options(flashfetch
1655+
PRIVATE LINKER:-sectcreate,__TEXT,__info_plist,Info.plist
1656+
)
1657+
endif()
1658+
1659+
if(BINARY_LINK_TYPE STREQUAL "static")
1660+
target_link_options(flashfetch PRIVATE "-static")
1661+
endif()
16491662
endif()
16501663

16511664
###################
@@ -1687,10 +1700,17 @@ endif()
16871700
include(GNUInstallDirs)
16881701

16891702
install(
1690-
TARGETS fastfetch flashfetch
1703+
TARGETS fastfetch
16911704
DESTINATION "${CMAKE_INSTALL_BINDIR}"
16921705
)
16931706

1707+
if (TARGET flashfetch)
1708+
install(
1709+
TARGETS flashfetch
1710+
DESTINATION "${CMAKE_INSTALL_BINDIR}"
1711+
)
1712+
endif()
1713+
16941714
if (TARGET ffwinrt)
16951715
install(
16961716
TARGETS ffwinrt

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ Try upgrading `pci.ids`: Download <https://pci-ids.ucw.cz/v2.2/pci.ids> and over
199199

200200
Alternatively, you may try to use `fastfetch --gpu-driver-specific`, so that `fastfetch` will try to ask the driver for GPU name if supported.
201201

202+
### Q: I get error `Authorization required, but no authorization protocol specified` when running fastfetch in root
203+
204+
Try `export XAUTHORITY=$HOME/.Xauthority`
205+
202206
### Q: Fastfetch cannot detect my awesome 3rd-party macOS window manager!
203207

204208
Try `fastfetch --wm-detect-plugin`. See also [#984](https://github.com/fastfetch-cli/fastfetch/issues/984)
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#include "battery.h"
2+
#include "common/io/io.h"
3+
#include "util/FFstrbuf.h"
4+
#include "util/stringUtils.h"
5+
6+
#include <prop/prop_array.h>
7+
#include <prop/prop_bool.h>
8+
#include <prop/prop_dictionary.h>
9+
#include <prop/prop_object.h>
10+
#include <sys/envsys.h>
11+
#include <prop/proplib.h>
12+
#include <paths.h>
13+
#include <time.h>
14+
#include <unistd.h>
15+
#include <fcntl.h>
16+
17+
const char* ffDetectBattery(FF_MAYBE_UNUSED FFBatteryOptions* options, FFlist* results)
18+
{
19+
FF_AUTO_CLOSE_FD int fd = open(_PATH_SYSMON, O_RDONLY);
20+
if (fd < 0) return "open(_PATH_SYSMON, O_RDONLY) failed";
21+
22+
prop_dictionary_t root = NULL;
23+
if (prop_dictionary_recv_ioctl(fd, ENVSYS_GETDICTIONARY, &root) < 0)
24+
return "prop_dictionary_recv_ioctl(ENVSYS_GETDICTIONARY) failed";
25+
26+
bool acConnected = false;
27+
{
28+
prop_array_t acad = prop_dictionary_get(root, "acpiacad0");
29+
if (acad)
30+
{
31+
prop_dictionary_t dict = prop_array_get(acad, 0);
32+
prop_dictionary_get_uint8(dict, "cur-value", (uint8_t*) &acConnected);
33+
}
34+
}
35+
36+
prop_object_iterator_t itKey = prop_dictionary_iterator(root);
37+
for (prop_dictionary_keysym_t key; (key = prop_object_iterator_next(itKey)) != NULL; )
38+
{
39+
if (!ffStrStartsWith(prop_dictionary_keysym_value(key), "acpibat")) continue;
40+
41+
prop_array_t bat = prop_dictionary_get_keysym(root, key);
42+
uint32_t max = 0, curr = 0, dischargeRate = 0;
43+
bool charging = false, critical = false;
44+
prop_object_iterator_t iter = prop_array_iterator(bat);
45+
for (prop_dictionary_t dict; (dict = prop_object_iterator_next(iter)) != NULL;)
46+
{
47+
if (prop_object_type(dict) != PROP_TYPE_DICTIONARY)
48+
continue;
49+
50+
const char* desc = NULL;
51+
if (!prop_dictionary_get_string(dict, "description", &desc))
52+
continue;
53+
54+
if (ffStrEquals(desc, "present"))
55+
{
56+
int value = 0;
57+
if (prop_dictionary_get_int(dict, "cur-value", &value) && value == 0)
58+
continue;
59+
}
60+
else if (ffStrEquals(desc, "charging"))
61+
{
62+
prop_dictionary_get_uint8(dict, "cur-value", (uint8_t*) &charging);
63+
}
64+
else if (ffStrEquals(desc, "charge"))
65+
{
66+
prop_dictionary_get_uint32(dict, "max-value", &max);
67+
prop_dictionary_get_uint32(dict, "cur-value", &curr);
68+
const char* state = NULL;
69+
if (prop_dictionary_get_string(dict, "state", &state) && ffStrEquals(state, "critical"))
70+
critical = true;
71+
}
72+
else if (ffStrEquals(desc, "discharge rate"))
73+
{
74+
prop_dictionary_get_uint(dict, "cur-value", &dischargeRate);
75+
}
76+
}
77+
78+
if (max > 0)
79+
{
80+
FFBatteryResult* battery = ffListAdd(results);
81+
battery->temperature = FF_BATTERY_TEMP_UNSET;
82+
battery->cycleCount = 0;
83+
ffStrbufInit(&battery->manufacturer);
84+
ffStrbufInit(&battery->modelName);
85+
ffStrbufInit(&battery->status);
86+
ffStrbufInit(&battery->technology);
87+
ffStrbufInit(&battery->serial);
88+
ffStrbufInit(&battery->manufactureDate);
89+
battery->timeRemaining = -1;
90+
91+
battery->capacity = (double) curr / max;
92+
if (charging)
93+
ffStrbufAppendS(&battery->status, "Charging, ");
94+
else if (dischargeRate)
95+
ffStrbufAppendS(&battery->status, "Discharging, ");
96+
if (critical)
97+
ffStrbufAppendS(&battery->status, "Critical, ");
98+
if (acConnected)
99+
ffStrbufAppendS(&battery->status, "AC Connected");
100+
ffStrbufTrimRight(&battery->status, ' ');
101+
ffStrbufTrimRight(&battery->status, ',');
102+
}
103+
}
104+
prop_object_iterator_release(itKey);
105+
106+
return NULL;
107+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#include "battery.h"
2+
#include "common/io/io.h"
3+
4+
#include <machine/apmvar.h>
5+
#include <sys/ioctl.h>
6+
#include <unistd.h>
7+
#include <fcntl.h>
8+
9+
const char* ffDetectBattery(FF_MAYBE_UNUSED FFBatteryOptions* options, FFlist* result)
10+
{
11+
FF_AUTO_CLOSE_FD int devfd = open("/dev/apm", O_RDONLY);
12+
13+
if (devfd < 0) return "open(dev/apm, O_RDONLY) failed";
14+
15+
struct apm_power_info info = {};
16+
17+
if (ioctl(devfd, APM_IOC_GETPOWER, &info) < 0)
18+
return "ioctl(APM_IOC_GETPOWER) failed";
19+
20+
if (info.battery_state == APM_BATTERY_ABSENT)
21+
return NULL;
22+
23+
FFBatteryResult* battery = (FFBatteryResult*) ffListAdd(result);
24+
battery->temperature = FF_BATTERY_TEMP_UNSET;
25+
battery->cycleCount = 0;
26+
battery->timeRemaining = -1;
27+
battery->capacity = info.battery_life;
28+
ffStrbufInit(&battery->manufacturer);
29+
ffStrbufInit(&battery->modelName);
30+
ffStrbufInit(&battery->status);
31+
ffStrbufInit(&battery->technology);
32+
ffStrbufInit(&battery->serial);
33+
ffStrbufInit(&battery->manufactureDate);
34+
35+
if (info.ac_state == APM_AC_ON)
36+
ffStrbufAppendS(&battery->status, "AC Connected");
37+
else if (info.ac_state == APM_AC_BACKUP)
38+
ffStrbufAppendS(&battery->status, "Backup In Use");
39+
else if (info.ac_state == APM_AC_OFF)
40+
{
41+
battery->timeRemaining = (int) info.minutes_left * 60;
42+
ffStrbufAppendS(&battery->status, "Discharging");
43+
}
44+
45+
if (info.battery_state == APM_BATT_CRITICAL || info.battery_state == APM_BATT_CHARGING)
46+
{
47+
if (battery->status.length) ffStrbufAppendS(&battery->status, ", ");
48+
ffStrbufAppendS(&battery->status, info.battery_state == APM_BATT_CRITICAL ? "Critical" : "Charging");
49+
}
50+
51+
return NULL;
52+
}

src/detection/bluetooth/bluetooth.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ typedef struct FFBluetoothResult
1111
bool connected;
1212
} FFBluetoothResult;
1313

14-
const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */);
14+
const char* ffDetectBluetooth(FFBluetoothOptions* options, FFlist* devices /* FFBluetoothResult */);

src/detection/bluetooth/bluetooth_apple.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,17 @@ @interface IOBluetoothDevice()
1010
@property (nonatomic) uint8_t batteryPercentSingle;
1111
@end
1212

13-
const char* ffDetectBluetooth(FFlist* devices /* FFBluetoothResult */)
13+
const char* ffDetectBluetooth(FFBluetoothOptions* options, FFlist* devices /* FFBluetoothResult */)
1414
{
1515
NSArray<IOBluetoothDevice*>* ioDevices = IOBluetoothDevice.pairedDevices;
1616
if(!ioDevices)
1717
return "IOBluetoothDevice.pairedDevices failed";
1818

1919
for(IOBluetoothDevice* ioDevice in ioDevices)
2020
{
21+
if (!options->showDisconnected && !ioDevice.isConnected)
22+
continue;
23+
2124
FFBluetoothResult* device = ffListAdd(devices);
2225
ffStrbufInitS(&device->name, ioDevice.name.UTF8String);
2326
ffStrbufInitS(&device->address, ioDevice.addressString.UTF8String);

0 commit comments

Comments
 (0)