Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
path: ./fastfetch-*.*

release:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'LinusDierheimer/fastfetch'
name: Release
runs-on: ubuntu-latest
needs:
Expand Down
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ cmake_dependent_option(ENABLE_EGL "Enable egl" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_GLX "Enable glx" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_OSMESA "Enable osmesa" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_OPENCL "Enable opencl" ON "LINUX" OFF)
cmake_dependent_option(ENABLE_LIBPLIST "Enable libplist" ON "APPLE" OFF)

option(BUILD_TESTS "Build tests" OFF) # Also create test executables
option(SET_TWEAK "Add tweak to project version" ON) # This is set to off by github actions for release builds
Expand Down Expand Up @@ -74,8 +75,11 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wconversion")
if(APPLE AND DEFINED ENV{HOMEBREW_PREFIX})
# Used for dlopen finding dylibs installed by homebrew, reversed for future usage
# `/opt/homebrew/lib` is not on dlopen search path by default
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-rpath,$ENV{HOMEBREW_PREFIX}/lib")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath,$ENV{HOMEBREW_PREFIX}/lib")
endif()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address -fsanitize=undefined")
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -rdynamic -fno-omit-frame-pointer -fsanitize=address -fsanitize=undefined")


include(CheckIPOSupported)
check_ipo_supported(RESULT IPO_SUPPORTED)
Expand Down Expand Up @@ -243,7 +247,9 @@ if(APPLE)
src/detection/battery/battery_apple.c
src/detection/memory/memory_apple.c
src/detection/displayserver/displayserver_apple.c
src/modules/terminalfont_apple.c
src/util/apple/cfdict_helpers.c
src/util/apple/osascript.m
)
elseif(ANDROID)
list(APPEND LIBFASTFETCH_SRC
Expand All @@ -254,6 +260,7 @@ elseif(ANDROID)
src/detection/battery/battery_android.c
src/detection/memory/memory_linux.c
src/detection/displayserver/displayserver_android.c
src/modules/terminalfont_linux.c
)
else()
list(APPEND LIBFASTFETCH_SRC
Expand All @@ -268,6 +275,7 @@ else()
src/detection/displayserver/linux/xcb.c
src/detection/displayserver/linux/xlib.c
src/detection/displayserver/linux/wmde.c
src/modules/terminalfont_linux.c
)
endif()

Expand Down Expand Up @@ -320,6 +328,7 @@ ff_lib_enable(EGL egl)
ff_lib_enable(GLX glx)
ff_lib_enable(OSMESA osmesa)
ff_lib_enable(OPENCL OpenCL)
ff_lib_enable(LIBPLIST libplist-2.0)

if(APPLE)
target_link_libraries(libfastfetch
Expand All @@ -328,6 +337,7 @@ if(APPLE)
PRIVATE "-framework CoreGraphics"
PRIVATE "-framework OpenGL"
PRIVATE "-framework OpenCL"
PRIVATE "-framework Cocoa"
)
endif()

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ The following libraries are used if present at runtime:
* [`libXFConf`](https://gitlab.xfce.org/xfce/xfconf): Needed for XFWM theme and XFCE Terminal font.
* [`libsqlite3`](https://www.sqlite.org/index.html): Needed for rpm package count.
* [`librpm`](http://rpm.org/): Slower fallback for rpm package count. Needed on openSUSE.
* [`libplist`](https://github.com/libimobiledevice/libplist): Binary `plist` file parser. Needed for iTerm2 Terminal font.

## Support status
All categories not listed here should work without needing a specific implementation.
Expand Down
14 changes: 14 additions & 0 deletions src/common/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,20 @@ void ffFontInitCopy(FFfont* font, const char* name)
ffFontInitValues(font, name, NULL);
}

void ffFontInitWithSpace(FFfont* font, const char* rawName)
{
const char* pspace = strrchr(rawName, ' ');
if(pspace == NULL)
return ffFontInitCopy(font, rawName);

fontInit(font);

ffStrbufAppendNS(&font->name, (uint32_t)(pspace - rawName), rawName);
ffStrbufAppendS(&font->size, pspace + 1);

fontInitPretty(font);
}

void ffFontDestroy(FFfont* font)
{
ffStrbufDestroy(&font->pretty);
Expand Down
1 change: 1 addition & 0 deletions src/common/font.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ void ffFontInitQt(FFfont* font, const char* data);
void ffFontInitPango(FFfont* font, const char* data);
void ffFontInitCopy(FFfont* font, const char* name);
void ffFontInitValues(FFfont* font, const char* name, const char* size);
void ffFontInitWithSpace(FFfont* font, const char* rawName);
void ffFontDestroy(FFfont* font);

#endif
1 change: 1 addition & 0 deletions src/common/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ static void defaultConfig(FFinstance* instance)
ffStrbufInitA(&instance->config.libGLX, 0);
ffStrbufInitA(&instance->config.libOSMesa, 0);
ffStrbufInitA(&instance->config.libOpenCL, 0);
ffStrbufInitA(&instance->config.libplist, 0);

instance->config.titleFQDN = false;

Expand Down
1 change: 1 addition & 0 deletions src/data/config_user.txt
Original file line number Diff line number Diff line change
Expand Up @@ -320,3 +320,4 @@
#--lib-glx /usr/lib/libGLX.so
#--lib-osmesa /usr/lib/libOSMesa.so
#--lib-opencl /usr/lib/libOpenCL.so
#--lib-plist /usr/local/bin/libplist-2.0.dylib
1 change: 1 addition & 0 deletions src/data/help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Library options: Set the path of a library to load
--lib-glx <path>
--lib-osmesa <path>
--lib-opencl <path>
--lib-plist <path>

Module specific options:
--title-fqdn <?value>: sets if the title should use fully qualified domain name. Default is false.
Expand Down
9 changes: 8 additions & 1 deletion src/detection/memory/memory_apple.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "memory.h"
#include "common/settings.h"


#include <string.h>
#include <mach/mach.h>
#include <sys/sysctl.h>

void ffDetectMemoryImpl(FFMemoryResult* memory)
{
Expand All @@ -21,4 +21,11 @@ void ffDetectMemoryImpl(FFMemoryResult* memory)
return;

memory->ram.bytesUsed = ((uint64_t) vmstat.active_count + vmstat.wire_count) * pagesize;

struct xsw_usage swap;
size_t size = sizeof(swap);
if (sysctlbyname("vm.swapusage", &swap, &size, 0, 0) == -1)
return;
memory->swap.bytesTotal = swap.xsu_total;
memory->swap.bytesUsed = swap.xsu_used;
}
2 changes: 2 additions & 0 deletions src/fastfetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,8 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
optionParseString(key, value, &instance->config.libOSMesa);
else if(strcasecmp(key, "--lib-opencl") == 0)
optionParseString(key, value, &instance->config.libOpenCL);
else if(strcasecmp(key, "--lib-plist") == 0)
optionParseString(key, value, &instance->config.libplist);

//////////////////
//Module options//
Expand Down
1 change: 1 addition & 0 deletions src/fastfetch.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ typedef struct FFconfig
FFstrbuf libGLX;
FFstrbuf libOSMesa;
FFstrbuf libOpenCL;
FFstrbuf libplist;

bool titleFQDN;

Expand Down
14 changes: 13 additions & 1 deletion src/modules/processes.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,24 @@
#define FF_PROCESSES_MODULE_NAME "Processes"
#define FF_PROCESSES_NUM_FORMAT_ARGS 1

#ifdef __APPLE__
#include <sys/sysctl.h>
#endif

void ffPrintProcesses(FFinstance* instance)
{
#if FF_HAVE_SYSINFO_H
uint16_t numProcesses = instance->state.sysinfo.procs;
#else
uint16_t numProcesses = 0;
int request[] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL};
size_t length;

if(sysctl(request, sizeof(request) / sizeof(*request), NULL, &length, NULL, 0) != 0)
{
ffPrintError(instance, FF_PROCESSES_MODULE_NAME, 0, &instance->config.processes, "sysctl() failed");
return;
}
uint16_t numProcesses = (uint16_t)(length / sizeof(struct kinfo_proc));
#endif

if(instance->config.processes.outputFormat.length == 0)
Expand Down
Loading