mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 09:33:39 +01:00
@@ -11,7 +11,7 @@ Tip: A logo can be displayed by fastfetch without getting into fastfetch's offic
|
|||||||
|
|
||||||
# OS
|
# OS
|
||||||
```
|
```
|
||||||
Paste content of /etc/os-release here. If this file doesn't exist, describe a way to identify the distro.
|
Paste content of /etc/os-release and /etc/lsb-release here. If none of these files exist, describe a way to identify the distro
|
||||||
```
|
```
|
||||||
|
|
||||||
# Ascii
|
# Ascii
|
||||||
|
|||||||
+27
-3
@@ -1,21 +1,45 @@
|
|||||||
|
# 2.11.2
|
||||||
|
|
||||||
|
Hotfix V2 for old kernel
|
||||||
|
|
||||||
|
Changes:
|
||||||
|
* Error messages when trying to print image logo will only be printed with `--show-errors`
|
||||||
|
* When generating JSON output, fastfetch will generate an empty array when no result is detected, instead of an error.
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Fix segfault in Debian 11 and some old kernels. Regression in 2.11.0 (#845, GPU, Linux)
|
||||||
|
* Don't try detecting version of raw `sh` shell (#849, Shell, Linux)
|
||||||
|
* Trim `\r` on Windows
|
||||||
|
|
||||||
|
Features:
|
||||||
|
* Check xdg state home for nix user packages (#837, Packages, Linux)
|
||||||
|
* Disable image logos in ssh and tmux sessions (#839)
|
||||||
|
* Support MX Linux distro detection (OS, Linux)
|
||||||
|
|
||||||
|
Logo:
|
||||||
|
* Add KernelOS
|
||||||
|
* Fix name of DraugerOS
|
||||||
|
* Add missing `FF_LOGO_LINE_TYPE_SMALL_BIT` flags
|
||||||
|
* Add MX2
|
||||||
|
|
||||||
# 2.11.1
|
# 2.11.1
|
||||||
|
|
||||||
Hotfix for Android
|
Hotfix for Android
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fix uninitialized variables which can cause crashes (#760 #838, Battery, Android)
|
* Fix uninitialized variables which can cause crashes (#760 #838, Battery, Android)
|
||||||
* Don't detect hyfetch as shell when used as a backend of hyfetch
|
* Don't detect hyfetch as shell when used as backend of [hyfetch](https://github.com/hykilpikonna/hyfetch)
|
||||||
* Fix incorrect information in man page
|
* Fix incorrect information in man page (#828)
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
* Support sorcery package manager detection (Packages, Linux)
|
* Support sorcery package manager detection (Packages, Linux)
|
||||||
* Make `--custom-format` optional (Custom)
|
* Make `--custom-format` optional (Custom)
|
||||||
* Make `/` an alias of `C:\` for `--disk-folders` (Disk, Windows)
|
* Make `/` an alias of `C:\` for `--disk-folders` (Disk, Windows)
|
||||||
|
* Build for Linux armv7
|
||||||
|
|
||||||
Logo:
|
Logo:
|
||||||
* Fix colors of Source Mage logo
|
* Fix colors of Source Mage logo
|
||||||
|
|
||||||
|
|
||||||
# 2.11.0
|
# 2.11.0
|
||||||
|
|
||||||
Changes:
|
Changes:
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
|
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
|
||||||
|
|
||||||
project(fastfetch
|
project(fastfetch
|
||||||
VERSION 2.11.1
|
VERSION 2.11.2
|
||||||
LANGUAGES C
|
LANGUAGES C
|
||||||
DESCRIPTION "Fast neofetch-like system information tool"
|
DESCRIPTION "Fast neofetch-like system information tool"
|
||||||
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
|
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
|
||||||
|
|||||||
+4
-7
@@ -107,12 +107,12 @@ To list all available modules, use \fB \-\-list\-modules \fR
|
|||||||
|
|
||||||
.SS "Config Files"
|
.SS "Config Files"
|
||||||
|
|
||||||
fastfetch supports two types of config files. The legacy
|
Fastfetch uses JSONC based format for configuration. Fastfetch doesn't generate
|
||||||
configuration files and a JSONC based format.
|
config file automatically; it should be generated manually by \fB \-\-gen\-config\fR.
|
||||||
|
The config file will be saved in \fB~/.config/fastfetch/config.jsonc\fR by default.
|
||||||
|
|
||||||
A JSONC config file is a JSON file that also supports comments with (//). Those
|
A JSONC config file is a JSON file that also supports comments with (//). Those
|
||||||
files must have the extension '.jsonc'. You can migrate a legacy config
|
files must have the extension '.jsonc'.
|
||||||
file to the JSONC format by using \fB\-\-gen\-config\fR.
|
|
||||||
|
|
||||||
The specified configuration/preset files are searched in the following order:
|
The specified configuration/preset files are searched in the following order:
|
||||||
|
|
||||||
@@ -122,9 +122,6 @@ The specified configuration/preset files are searched in the following order:
|
|||||||
|
|
||||||
3. relative to /usr/share/fastfetch/presets/
|
3. relative to /usr/share/fastfetch/presets/
|
||||||
|
|
||||||
When both a '.jsonc' and a '.conf' file with the same name is found,
|
|
||||||
the '.jsonc' file is preferred.
|
|
||||||
|
|
||||||
Fastfetch provides some default presets. List them with \fB\-\-list\-presets\fR.
|
Fastfetch provides some default presets. List them with \fB\-\-list\-presets\fR.
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ static inline const char* ffProcessAppendStdOut(FFstrbuf* buffer, char* const ar
|
|||||||
{
|
{
|
||||||
const char* error = ffProcessAppendOutput(buffer, argv, false);
|
const char* error = ffProcessAppendOutput(buffer, argv, false);
|
||||||
if (!error)
|
if (!error)
|
||||||
{
|
ffStrbufTrimRightSpace(buffer);
|
||||||
ffStrbufTrimRight(buffer, '\n');
|
|
||||||
ffStrbufTrimRight(buffer, ' ');
|
|
||||||
}
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,9 +16,6 @@ static inline const char* ffProcessAppendStdErr(FFstrbuf* buffer, char* const ar
|
|||||||
{
|
{
|
||||||
const char* error = ffProcessAppendOutput(buffer, argv, true);
|
const char* error = ffProcessAppendOutput(buffer, argv, true);
|
||||||
if (!error)
|
if (!error)
|
||||||
{
|
ffStrbufTrimRightSpace(buffer);
|
||||||
ffStrbufTrimRight(buffer, '\n');
|
|
||||||
ffStrbufTrimRight(buffer, ' ');
|
|
||||||
}
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|||||||
+25
-29
@@ -1,5 +1,7 @@
|
|||||||
#include "fastfetch.h"
|
#include "fastfetch.h"
|
||||||
#include "common/properties.h"
|
#include "common/properties.h"
|
||||||
|
#include "common/io/io.h"
|
||||||
|
#include "util/mallocHelper.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -95,50 +97,44 @@ bool ffParsePropLines(const char* lines, const char* start, FFstrbuf* buffer)
|
|||||||
|
|
||||||
bool ffParsePropFileValues(const char* filename, uint32_t numQueries, FFpropquery* queries)
|
bool ffParsePropFileValues(const char* filename, uint32_t numQueries, FFpropquery* queries)
|
||||||
{
|
{
|
||||||
FILE* file = fopen(filename, "r");
|
FF_AUTO_CLOSE_FILE FILE* file = fopen(filename, "r");
|
||||||
if(file == NULL)
|
if (file == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool valueStorage[4];
|
bool valueStorage[32];
|
||||||
bool* unsetValues;
|
bool* unsetValues = valueStorage;
|
||||||
|
|
||||||
if(numQueries > sizeof(valueStorage) / sizeof(valueStorage[0]))
|
if (numQueries > sizeof(valueStorage) / sizeof(valueStorage[0]))
|
||||||
unsetValues = malloc(sizeof(bool) * numQueries);
|
unsetValues = malloc(sizeof(bool) * numQueries);
|
||||||
else
|
|
||||||
unsetValues = valueStorage;
|
|
||||||
|
|
||||||
bool allSet = true;
|
bool allSet = true;
|
||||||
for(uint32_t i = 0; i < numQueries; i++)
|
for (uint32_t i = 0; i < numQueries; i++)
|
||||||
{
|
{
|
||||||
if((unsetValues[i] = queries[i].buffer->length == 0))
|
unsetValues[i] = queries[i].buffer->length == 0;
|
||||||
|
if (unsetValues[i])
|
||||||
allSet = false;
|
allSet = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(allSet)
|
if (!allSet)
|
||||||
goto done;
|
|
||||||
|
|
||||||
char* line = NULL;
|
|
||||||
size_t len = 0;
|
|
||||||
|
|
||||||
while (getline(&line, &len, file) != -1)
|
|
||||||
{
|
{
|
||||||
for(uint32_t i = 0; i < numQueries; i++)
|
FF_AUTO_FREE char* line = NULL;
|
||||||
{
|
size_t len = 0;
|
||||||
if(!unsetValues[i])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
uint32_t currentLength = queries[i].buffer->length;
|
while (getline(&line, &len, file) != -1)
|
||||||
queries[i].buffer->length = 0;
|
{
|
||||||
if(!ffParsePropLine(line, queries[i].start, queries[i].buffer))
|
for(uint32_t i = 0; i < numQueries; i++)
|
||||||
queries[i].buffer->length = currentLength;
|
{
|
||||||
|
if(!unsetValues[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
uint32_t currentLength = queries[i].buffer->length;
|
||||||
|
queries[i].buffer->length = 0;
|
||||||
|
if(!ffParsePropLine(line, queries[i].start, queries[i].buffer))
|
||||||
|
queries[i].buffer->length = currentLength;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(line != NULL)
|
|
||||||
free(line);
|
|
||||||
|
|
||||||
done:
|
|
||||||
fclose(file);
|
|
||||||
if(unsetValues != valueStorage)
|
if(unsetValues != valueStorage)
|
||||||
free(unsetValues);
|
free(unsetValues);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -170,8 +170,5 @@ const char* ffDetectBattery(FFBatteryOptions* options, FFlist* results)
|
|||||||
ffStrbufSubstrBefore(&baseDir, baseDirLength);
|
ffStrbufSubstrBefore(&baseDir, baseDirLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(results->length == 0)
|
|
||||||
return "\"/sys/class/power_supply/\" doesn't contain any battery folder";
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ static void pciDetectAmdSpecific(const FFGPUOptions* options, FFGPUResult* gpu,
|
|||||||
|
|
||||||
ffStrbufAppendS(pciDir, "/hwmon/");
|
ffStrbufAppendS(pciDir, "/hwmon/");
|
||||||
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(pciDir->chars);
|
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(pciDir->chars);
|
||||||
|
if (!dirp) return;
|
||||||
|
|
||||||
struct dirent* entry;
|
struct dirent* entry;
|
||||||
while ((entry = readdir(dirp)) != NULL)
|
while ((entry = readdir(dirp)) != NULL)
|
||||||
{
|
{
|
||||||
@@ -256,7 +258,7 @@ FF_MAYBE_UNUSED static const char* detectAsahi(FFlist* gpus, FFstrbuf* buffer, F
|
|||||||
{
|
{
|
||||||
uint32_t index = ffStrbufFirstIndexS(buffer, "apple,agx-t");
|
uint32_t index = ffStrbufFirstIndexS(buffer, "apple,agx-t");
|
||||||
if (index == buffer->length) return "display-subsystem?";
|
if (index == buffer->length) return "display-subsystem?";
|
||||||
index += strlen("apple,agx-t");
|
index += (uint32_t) strlen("apple,agx-t");
|
||||||
|
|
||||||
FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus);
|
FFGPUResult* gpu = (FFGPUResult*)ffListAdd(gpus);
|
||||||
gpu->deviceId = strtoul(buffer->chars + index, NULL, 10);
|
gpu->deviceId = strtoul(buffer->chars + index, NULL, 10);
|
||||||
|
|||||||
+36
-18
@@ -15,18 +15,25 @@ static inline bool allRelevantValuesSet(const FFOSResult* result)
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool parseFile(const char* fileName, FFOSResult* result)
|
static bool parseLsbRelease(const char* fileName, FFOSResult* result)
|
||||||
{
|
{
|
||||||
return ffParsePropFileValues(fileName, 13, (FFpropquery[]) {
|
return ffParsePropFileValues(fileName, 4, (FFpropquery[]) {
|
||||||
{"NAME =", &result->name},
|
|
||||||
{"DISTRIB_DESCRIPTION =", &result->prettyName},
|
|
||||||
{"PRETTY_NAME =", &result->prettyName},
|
|
||||||
{"DISTRIB_ID =", &result->id},
|
{"DISTRIB_ID =", &result->id},
|
||||||
|
{"DISTRIB_DESCRIPTION =", &result->prettyName},
|
||||||
|
{"DISTRIB_RELEASE =", &result->version},
|
||||||
|
{"DISTRIB_CODENAME =", &result->codename},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool parseOsRelease(const char* fileName, FFOSResult* result)
|
||||||
|
{
|
||||||
|
return ffParsePropFileValues(fileName, 10, (FFpropquery[]) {
|
||||||
|
{"PRETTY_NAME =", &result->prettyName},
|
||||||
|
{"NAME =", &result->name},
|
||||||
{"ID =", &result->id},
|
{"ID =", &result->id},
|
||||||
{"ID_LIKE =", &result->idLike},
|
{"ID_LIKE =", &result->idLike},
|
||||||
{"VARIANT =", &result->variant},
|
{"VARIANT =", &result->variant},
|
||||||
{"VARIANT_ID =", &result->variantID},
|
{"VARIANT_ID =", &result->variantID},
|
||||||
{"DISTRIB_RELEASE =", &result->version},
|
|
||||||
{"VERSION =", &result->version},
|
{"VERSION =", &result->version},
|
||||||
{"VERSION_ID =", &result->versionID},
|
{"VERSION_ID =", &result->versionID},
|
||||||
{"VERSION_CODENAME =", &result->codename},
|
{"VERSION_CODENAME =", &result->codename},
|
||||||
@@ -136,11 +143,12 @@ static void detectOS(FFOSResult* os)
|
|||||||
{
|
{
|
||||||
if(instance.config.general.osFile.length > 0)
|
if(instance.config.general.osFile.length > 0)
|
||||||
{
|
{
|
||||||
parseFile(instance.config.general.osFile.chars, os);
|
parseLsbRelease(instance.config.general.osFile.chars, os);
|
||||||
|
parseOsRelease(instance.config.general.osFile.chars, os);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(instance.config.general.escapeBedrock && parseFile(FASTFETCH_TARGET_DIR_ROOT"/bedrock"FASTFETCH_TARGET_DIR_ETC"/bedrock-release", os))
|
if(instance.config.general.escapeBedrock && parseOsRelease(FASTFETCH_TARGET_DIR_ROOT "/bedrock" FASTFETCH_TARGET_DIR_ETC "/bedrock-release", os))
|
||||||
{
|
{
|
||||||
if(os->id.length == 0)
|
if(os->id.length == 0)
|
||||||
ffStrbufAppendS(&os->id, "bedrock");
|
ffStrbufAppendS(&os->id, "bedrock");
|
||||||
@@ -150,22 +158,32 @@ static void detectOS(FFOSResult* os)
|
|||||||
|
|
||||||
if(os->prettyName.length == 0)
|
if(os->prettyName.length == 0)
|
||||||
ffStrbufAppendS(&os->prettyName, "Bedrock Linux");
|
ffStrbufAppendS(&os->prettyName, "Bedrock Linux");
|
||||||
|
|
||||||
parseFile("/bedrock"FASTFETCH_TARGET_DIR_ETC"/os-release", os);
|
|
||||||
|
|
||||||
if(allRelevantValuesSet(os))
|
if(parseOsRelease("/bedrock" FASTFETCH_TARGET_DIR_ETC "/os-release", os) && allRelevantValuesSet(os))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
parseFile(FASTFETCH_TARGET_DIR_ETC"/os-release", os);
|
// Refer: https://gist.github.com/natefoo/814c5bf936922dad97ff
|
||||||
if(allRelevantValuesSet(os))
|
|
||||||
|
// Hack for MX Linux. See #847
|
||||||
|
if(parseLsbRelease(FASTFETCH_TARGET_DIR_ETC "/lsb-release", os))
|
||||||
|
{
|
||||||
|
if (ffStrbufEqualS(&os->id, "MX"))
|
||||||
|
{
|
||||||
|
ffStrbufSetStatic(&os->name, "MX");
|
||||||
|
ffStrbufSetStatic(&os->idLike, "debian");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// For archlinux
|
||||||
|
if (ffStrbufEqualS(&os->version, "rolling"))
|
||||||
|
ffStrbufClear(&os->version);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(parseOsRelease(FASTFETCH_TARGET_DIR_ETC "/os-release", os) && allRelevantValuesSet(os))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
parseFile(FASTFETCH_TARGET_DIR_USR"/lib/os-release", os);
|
parseOsRelease(FASTFETCH_TARGET_DIR_USR "/lib/os-release", os);
|
||||||
if(allRelevantValuesSet(os))
|
|
||||||
return;
|
|
||||||
|
|
||||||
parseFile(FASTFETCH_TARGET_DIR_ETC"/lsb-release", os);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffDetectOSImpl(FFOSResult* os)
|
void ffDetectOSImpl(FFOSResult* os)
|
||||||
|
|||||||
@@ -502,7 +502,36 @@ void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
|
|||||||
|
|
||||||
ffStrbufSet(&baseDir, &instance.state.platform.homeDir);
|
ffStrbufSet(&baseDir, &instance.state.platform.homeDir);
|
||||||
if (!(options->disabled & FF_PACKAGES_FLAG_NIX_BIT))
|
if (!(options->disabled & FF_PACKAGES_FLAG_NIX_BIT))
|
||||||
result->nixUser = getNixPackages(&baseDir, "/.nix-profile");
|
{
|
||||||
|
// check if ~/.nix-profile exists
|
||||||
|
FF_STRBUF_AUTO_DESTROY profilePath = ffStrbufCreateCopy(&baseDir);
|
||||||
|
ffStrbufAppendS(&profilePath, ".nix-profile");
|
||||||
|
if (ffPathExists(profilePath.chars, FF_PATHTYPE_DIRECTORY))
|
||||||
|
{
|
||||||
|
result->nixUser = getNixPackages(&baseDir, ".nix-profile");
|
||||||
|
}
|
||||||
|
// check if $XDG_STATE_HOME/nix/profile exists
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FF_STRBUF_AUTO_DESTROY stateDir = ffStrbufCreate();
|
||||||
|
const char* stateHome = getenv("XDG_STATE_HOME");
|
||||||
|
if(ffStrSet(stateHome))
|
||||||
|
{
|
||||||
|
ffStrbufSetS(&stateDir, stateHome);
|
||||||
|
ffStrbufEnsureEndsWithC(&stateDir, '/');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ffStrbufSet(&stateDir, &instance.state.platform.homeDir);
|
||||||
|
ffStrbufAppendS(&stateDir, ".local/state/");
|
||||||
|
}
|
||||||
|
|
||||||
|
ffStrbufSet(&profilePath, &stateDir);
|
||||||
|
ffStrbufAppendS(&profilePath, "nix/profile");
|
||||||
|
result->nixUser = getNixPackages(&stateDir, "nix/profile");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!(options->disabled & FF_PACKAGES_FLAG_FLATPAK_BIT))
|
if (!(options->disabled & FF_PACKAGES_FLAG_FLATPAK_BIT))
|
||||||
result->flatpakUser = getFlatpak(&baseDir, "/.local/share/flatpak");
|
result->flatpakUser = getFlatpak(&baseDir, "/.local/share/flatpak");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ void ffPreparePublicIp(FFPublicIpOptions* options)
|
|||||||
fputs("Error: only http: protocol is supported. Use `Command` module with `curl` if needed\n", stderr);
|
fputs("Error: only http: protocol is supported. Use `Command` module with `curl` if needed\n", stderr);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
ffStrbufSubstrAfter(&host, hostStartIndex + (strlen("://") - 1));
|
ffStrbufSubstrAfter(&host, hostStartIndex + (uint32_t) (strlen("://") - 1));
|
||||||
}
|
}
|
||||||
uint32_t pathStartIndex = ffStrbufFirstIndexC(&host, '/');
|
uint32_t pathStartIndex = ffStrbufFirstIndexC(&host, '/');
|
||||||
|
|
||||||
|
|||||||
@@ -228,7 +228,10 @@ bool fftsGetShellVersion(FFstrbuf* exe, const char* exeName, FFstrbuf* version)
|
|||||||
{
|
{
|
||||||
if (!instance.config.display.tsVersion) return false;
|
if (!instance.config.display.tsVersion) return false;
|
||||||
|
|
||||||
if(strcasecmp(exeName, "bash") == 0 || strcasecmp(exeName, "sh") == 0)
|
if(ffStrEqualsIgnCase(exeName, "sh")) // #849
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(strcasecmp(exeName, "bash") == 0)
|
||||||
return getShellVersionBash(exe, version);
|
return getShellVersionBash(exe, version);
|
||||||
if(strcasecmp(exeName, "zsh") == 0)
|
if(strcasecmp(exeName, "zsh") == 0)
|
||||||
return getExeVersionGeneral(exe, version); //zsh 5.9 (arm-apple-darwin21.3.0)
|
return getExeVersionGeneral(exe, version); //zsh 5.9 (arm-apple-darwin21.3.0)
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
.''''....''''.
|
||||||
|
.''... ...''.
|
||||||
|
''.. ..''
|
||||||
|
'.. ..''
|
||||||
|
.'. .,,'.. .',,,' ..'.
|
||||||
|
.'. .,,,,' .,,,,,' .'.
|
||||||
|
.'. .,,,,' .,,,,,. .'.
|
||||||
|
'.. .,,,,'',,,,;. .''
|
||||||
|
.'. .,,,,,,,;;. ..'
|
||||||
|
.'. .,,,,;;;;;${c2}, ${c1}..'.
|
||||||
|
'.. .,;;;,${c2}';;;;;, ${c1}..'
|
||||||
|
.'. .;;${c2};;' .;;:::: ${c1}.,.
|
||||||
|
'.. ${c2}.;;;;' .::::::. ${c1}.,'
|
||||||
|
'.. ${c2}.;;;;' .::::::. ${c1}.,${c2}'${c1}
|
||||||
|
.'.. ${c2}.',.
|
||||||
|
${c1}',.. ${c2}.','
|
||||||
|
${c1}.,,... ${c2}..',,.
|
||||||
|
..,,''........',,,.
|
||||||
|
......
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@@@@%*+--:------=+*%@@@@@@@@@@@@
|
||||||
|
@@@@@@@@@#=. .-+#%@@@@@%#*+--=#@@@@@@@@@
|
||||||
|
@@@@@@@+. .=%@@@@@@@@@@@@@@@@*-:+@@@@@@@
|
||||||
|
@@@@@*. *@@@@@@@@@@@@@@@@@@@@@%-.*@@@@@
|
||||||
|
@@@@- -@@@@@@@@@@@@@@@@@@@@@@@#: -@@@@
|
||||||
|
@@@: -@@@@@@@=.*@@@@@@@@@@@@%- = :@@@
|
||||||
|
@@= .@@@@@@@@%- :%@@@@@@@@@+ -%@# =@@
|
||||||
|
@% +@@@@@@@@@@#. =@@@@@@*. .*@@@@. %@
|
||||||
|
@+ *@@@@@@*..*@@+ *@@%- =@@@@@@- +@
|
||||||
|
@= *@@@@%- -%@@- := -%@@@@@@@: +@
|
||||||
|
@+ :@@@= +@@= .#@@@@@@@@% *@
|
||||||
|
@% +*. .: *@@#: +@@: @@
|
||||||
|
@@+ :%@- :- :: +@@
|
||||||
|
@@@- .=@@= -@@@
|
||||||
|
@@+. . +@@
|
||||||
|
%=..:.................::...........:..-%
|
||||||
|
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||||
+34
-6
@@ -209,6 +209,7 @@ static const FFlogo A[] = {
|
|||||||
// AoscOsRetro_small
|
// AoscOsRetro_small
|
||||||
{
|
{
|
||||||
.names = {"Aosc OS/Retro_small", "aoscosretro_small"},
|
.names = {"Aosc OS/Retro_small", "aoscosretro_small"},
|
||||||
|
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||||
.lines = FASTFETCH_DATATEXT_LOGO_AOSCOSRETRO_SMALL,
|
.lines = FASTFETCH_DATATEXT_LOGO_AOSCOSRETRO_SMALL,
|
||||||
.colors = {
|
.colors = {
|
||||||
FF_COLOR_FG_BLUE,
|
FF_COLOR_FG_BLUE,
|
||||||
@@ -764,6 +765,7 @@ static const FFlogo C[] = {
|
|||||||
// CalinixOSSmall
|
// CalinixOSSmall
|
||||||
{
|
{
|
||||||
.names = {"Calinix_small", "calinixos_small"},
|
.names = {"Calinix_small", "calinixos_small"},
|
||||||
|
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||||
.lines = FASTFETCH_DATATEXT_LOGO_CALINIXOS_SMALL,
|
.lines = FASTFETCH_DATATEXT_LOGO_CALINIXOS_SMALL,
|
||||||
.colors = {
|
.colors = {
|
||||||
FF_COLOR_FG_MAGENTA,
|
FF_COLOR_FG_MAGENTA,
|
||||||
@@ -875,7 +877,7 @@ static const FFlogo C[] = {
|
|||||||
// Chimera Linux
|
// Chimera Linux
|
||||||
{
|
{
|
||||||
.names = {"Chimera Linux"},
|
.names = {"Chimera Linux"},
|
||||||
.lines = FASTFETCH_DATATEXT_LOGO_CHIMERALINUX,
|
.lines = FASTFETCH_DATATEXT_LOGO_CHIMERA_LINUX,
|
||||||
.colors = {
|
.colors = {
|
||||||
FF_COLOR_FG_RED,
|
FF_COLOR_FG_RED,
|
||||||
FF_COLOR_FG_MAGENTA,
|
FF_COLOR_FG_MAGENTA,
|
||||||
@@ -1241,9 +1243,9 @@ static const FFlogo D[] = {
|
|||||||
.colorKeys = FF_COLOR_FG_RED,
|
.colorKeys = FF_COLOR_FG_RED,
|
||||||
.colorTitle = FF_COLOR_FG_WHITE,
|
.colorTitle = FF_COLOR_FG_WHITE,
|
||||||
},
|
},
|
||||||
// Drauger
|
// DraugerOS
|
||||||
{
|
{
|
||||||
.names = {"Drauger"},
|
.names = {"DraugerOS", "Drauger"},
|
||||||
.lines = FASTFETCH_DATATEXT_LOGO_DRAUGER,
|
.lines = FASTFETCH_DATATEXT_LOGO_DRAUGER,
|
||||||
.colors = {
|
.colors = {
|
||||||
FF_COLOR_FG_RED,
|
FF_COLOR_FG_RED,
|
||||||
@@ -1336,8 +1338,8 @@ static const FFlogo E[] = {
|
|||||||
// EndeavourSmall
|
// EndeavourSmall
|
||||||
{
|
{
|
||||||
.names = {"Endeavour_small", "endeavour-linux_small", "endeavouros_small", "endeavouros-linux_small"},
|
.names = {"Endeavour_small", "endeavour-linux_small", "endeavouros_small", "endeavouros-linux_small"},
|
||||||
.lines = FASTFETCH_DATATEXT_LOGO_ENDEAVOUR_SMALL,
|
|
||||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||||
|
.lines = FASTFETCH_DATATEXT_LOGO_ENDEAVOUR_SMALL,
|
||||||
.colors = {
|
.colors = {
|
||||||
FF_COLOR_FG_RED,
|
FF_COLOR_FG_RED,
|
||||||
FF_COLOR_FG_MAGENTA,
|
FF_COLOR_FG_MAGENTA,
|
||||||
@@ -1823,6 +1825,7 @@ static const FFlogo G[] = {
|
|||||||
// GuixSmall
|
// GuixSmall
|
||||||
{
|
{
|
||||||
.names = {"Guix_small"},
|
.names = {"Guix_small"},
|
||||||
|
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||||
.lines = FASTFETCH_DATATEXT_LOGO_GUIX_SMALL,
|
.lines = FASTFETCH_DATATEXT_LOGO_GUIX_SMALL,
|
||||||
.colors = {
|
.colors = {
|
||||||
FF_COLOR_FG_YELLOW,
|
FF_COLOR_FG_YELLOW,
|
||||||
@@ -2089,6 +2092,15 @@ static const FFlogo K[] = {
|
|||||||
.colorKeys = FF_COLOR_FG_BLUE,
|
.colorKeys = FF_COLOR_FG_BLUE,
|
||||||
.colorTitle = FF_COLOR_FG_WHITE,
|
.colorTitle = FF_COLOR_FG_WHITE,
|
||||||
},
|
},
|
||||||
|
// KernelOS
|
||||||
|
{
|
||||||
|
.names = {"KernelOS"},
|
||||||
|
.lines = FASTFETCH_DATATEXT_LOGO_KERNELOS,
|
||||||
|
.colors = {
|
||||||
|
FF_COLOR_FG_RED,
|
||||||
|
FF_COLOR_FG_MAGENTA,
|
||||||
|
}
|
||||||
|
},
|
||||||
// KDENeon
|
// KDENeon
|
||||||
{
|
{
|
||||||
.names = {"KDE", "kde-neon"},
|
.names = {"KDE", "kde-neon"},
|
||||||
@@ -2462,6 +2474,7 @@ static const FFlogo M[] = {
|
|||||||
// MageiaSmall
|
// MageiaSmall
|
||||||
{
|
{
|
||||||
.names = {"Mageia_small"},
|
.names = {"Mageia_small"},
|
||||||
|
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||||
.lines = FASTFETCH_DATATEXT_LOGO_MAGEIA_SMALL,
|
.lines = FASTFETCH_DATATEXT_LOGO_MAGEIA_SMALL,
|
||||||
.colors = {
|
.colors = {
|
||||||
FF_COLOR_FG_CYAN,
|
FF_COLOR_FG_CYAN,
|
||||||
@@ -2649,7 +2662,7 @@ static const FFlogo M[] = {
|
|||||||
},
|
},
|
||||||
// MX
|
// MX
|
||||||
{
|
{
|
||||||
.names = {"MX"},
|
.names = {"MX", "MX Linux"},
|
||||||
.lines = FASTFETCH_DATATEXT_LOGO_MX,
|
.lines = FASTFETCH_DATATEXT_LOGO_MX,
|
||||||
.colors = {
|
.colors = {
|
||||||
FF_COLOR_FG_WHITE,
|
FF_COLOR_FG_WHITE,
|
||||||
@@ -2659,7 +2672,8 @@ static const FFlogo M[] = {
|
|||||||
},
|
},
|
||||||
// MXSmall
|
// MXSmall
|
||||||
{
|
{
|
||||||
.names = {"MX_small", "mx-small"},
|
.names = {"MX_small", "mx linux_small"},
|
||||||
|
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||||
.lines = FASTFETCH_DATATEXT_LOGO_MX_SMALL,
|
.lines = FASTFETCH_DATATEXT_LOGO_MX_SMALL,
|
||||||
.colors = {
|
.colors = {
|
||||||
FF_COLOR_FG_WHITE,
|
FF_COLOR_FG_WHITE,
|
||||||
@@ -2667,6 +2681,17 @@ static const FFlogo M[] = {
|
|||||||
.colorKeys = FF_COLOR_FG_BLUE,
|
.colorKeys = FF_COLOR_FG_BLUE,
|
||||||
.colorTitle = FF_COLOR_FG_CYAN,
|
.colorTitle = FF_COLOR_FG_CYAN,
|
||||||
},
|
},
|
||||||
|
// MX2
|
||||||
|
{
|
||||||
|
.names = {"MX2"},
|
||||||
|
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||||
|
.lines = FASTFETCH_DATATEXT_LOGO_MX2,
|
||||||
|
.colors = {
|
||||||
|
FF_COLOR_FG_WHITE,
|
||||||
|
},
|
||||||
|
.colorKeys = FF_COLOR_FG_BLUE,
|
||||||
|
.colorTitle = FF_COLOR_FG_CYAN,
|
||||||
|
},
|
||||||
// LAST
|
// LAST
|
||||||
{},
|
{},
|
||||||
};
|
};
|
||||||
@@ -2730,6 +2755,7 @@ static const FFlogo N[] = {
|
|||||||
// NixOSSmall
|
// NixOSSmall
|
||||||
{
|
{
|
||||||
.names = {"NixOS_small", "nix_small", "nixos-linux-small", "nix-linux-small"},
|
.names = {"NixOS_small", "nix_small", "nixos-linux-small", "nix-linux-small"},
|
||||||
|
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||||
.lines = FASTFETCH_DATATEXT_LOGO_NIXOS_SMALL,
|
.lines = FASTFETCH_DATATEXT_LOGO_NIXOS_SMALL,
|
||||||
.colors = {
|
.colors = {
|
||||||
FF_COLOR_FG_BLUE,
|
FF_COLOR_FG_BLUE,
|
||||||
@@ -3301,6 +3327,7 @@ static const FFlogo P[] = {
|
|||||||
// PostMarketOSSmall
|
// PostMarketOSSmall
|
||||||
{
|
{
|
||||||
.names = {"PostMarketOS_small"},
|
.names = {"PostMarketOS_small"},
|
||||||
|
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||||
.lines = FASTFETCH_DATATEXT_LOGO_POSTMARKETOS_SMALL,
|
.lines = FASTFETCH_DATATEXT_LOGO_POSTMARKETOS_SMALL,
|
||||||
.colors = {
|
.colors = {
|
||||||
FF_COLOR_FG_GREEN,
|
FF_COLOR_FG_GREEN,
|
||||||
@@ -3560,6 +3587,7 @@ static const FFlogo R[] = {
|
|||||||
// RockyLinuxSmall
|
// RockyLinuxSmall
|
||||||
{
|
{
|
||||||
.names = {"rocky_small", "rocky-linux_small", "rockylinux_small"},
|
.names = {"rocky_small", "rocky-linux_small", "rockylinux_small"},
|
||||||
|
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||||
.lines = FASTFETCH_DATATEXT_LOGO_ROCKY_SMALL,
|
.lines = FASTFETCH_DATATEXT_LOGO_ROCKY_SMALL,
|
||||||
.colors = {
|
.colors = {
|
||||||
FF_COLOR_FG_GREEN,
|
FF_COLOR_FG_GREEN,
|
||||||
|
|||||||
+31
-5
@@ -1,6 +1,7 @@
|
|||||||
#include "image.h"
|
#include "image.h"
|
||||||
#include "common/io/io.h"
|
#include "common/io/io.h"
|
||||||
#include "common/printing.h"
|
#include "common/printing.h"
|
||||||
|
#include "util/stringUtils.h"
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@@ -53,13 +54,14 @@ static FFstrbuf base64Encode(const FFstrbuf* in)
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool printImageIterm(void)
|
static bool printImageIterm(bool printError)
|
||||||
{
|
{
|
||||||
const FFOptionsLogo* options = &instance.config.logo;
|
const FFOptionsLogo* options = &instance.config.logo;
|
||||||
FF_STRBUF_AUTO_DESTROY buf = ffStrbufCreate();
|
FF_STRBUF_AUTO_DESTROY buf = ffStrbufCreate();
|
||||||
if(!ffAppendFileBuffer(options->source.chars, &buf))
|
if(!ffAppendFileBuffer(options->source.chars, &buf))
|
||||||
{
|
{
|
||||||
fputs("Logo: Failed to load image file\n", stderr);
|
if (printError)
|
||||||
|
fputs("Logo (iterm): Failed to load image file\n", stderr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,9 +136,17 @@ static bool printImageIterm(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool printImageKittyDirect(void)
|
static bool printImageKittyDirect(bool printError)
|
||||||
{
|
{
|
||||||
const FFOptionsLogo* options = &instance.config.logo;
|
const FFOptionsLogo* options = &instance.config.logo;
|
||||||
|
|
||||||
|
if (!ffPathExists(options->source.chars, FF_PATHTYPE_FILE))
|
||||||
|
{
|
||||||
|
if (printError)
|
||||||
|
fputs("Logo (kitty-direct): Failed to load image file\n", stderr);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
FF_STRBUF_AUTO_DESTROY base64 = base64Encode(&options->source);
|
FF_STRBUF_AUTO_DESTROY base64 = base64Encode(&options->source);
|
||||||
|
|
||||||
if (!options->width || !options->height)
|
if (!options->width || !options->height)
|
||||||
@@ -839,11 +849,27 @@ bool ffLogoPrintImageIfExists(FFLogoType type, bool printError)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getenv("SSH_TTY"))
|
||||||
|
{
|
||||||
|
if(printError)
|
||||||
|
fputs("Logo: Image logo is not supported in SSH sessions\n", stderr);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* term = getenv("TERM");
|
||||||
|
if((term && ffStrEquals(term, "screen")) || getenv("ZELLIJ") || getenv("TMUX"))
|
||||||
|
{
|
||||||
|
if(printError)
|
||||||
|
fputs("Logo: Image logo is not supported in terminal multiplexers\n", stderr);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(type == FF_LOGO_TYPE_IMAGE_ITERM)
|
if(type == FF_LOGO_TYPE_IMAGE_ITERM)
|
||||||
return printImageIterm();
|
return printImageIterm(printError);
|
||||||
|
|
||||||
if(type == FF_LOGO_TYPE_IMAGE_KITTY_DIRECT)
|
if(type == FF_LOGO_TYPE_IMAGE_KITTY_DIRECT)
|
||||||
return printImageKittyDirect();
|
return printImageKittyDirect(printError);
|
||||||
|
|
||||||
#if !defined(FF_HAVE_CHAFA)
|
#if !defined(FF_HAVE_CHAFA)
|
||||||
if(type == FF_LOGO_TYPE_IMAGE_CHAFA)
|
if(type == FF_LOGO_TYPE_IMAGE_CHAFA)
|
||||||
|
|||||||
+3
-2
@@ -393,7 +393,8 @@ static bool logoPrintFileIfExists(bool doColorReplacement, bool raw)
|
|||||||
: !ffAppendFileBuffer(options->source.chars, &content)
|
: !ffAppendFileBuffer(options->source.chars, &content)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Logo: Failed to load file content from logo source: %s \n", options->source.chars);
|
if (instance.config.display.showErrors)
|
||||||
|
fprintf(stderr, "Logo: Failed to load file content from logo source: %s \n", options->source.chars);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,7 +449,7 @@ static bool logoTryKnownType(void)
|
|||||||
if(options->type == FF_LOGO_TYPE_IMAGE_RAW)
|
if(options->type == FF_LOGO_TYPE_IMAGE_RAW)
|
||||||
return logoPrintFileIfExists(false, true);
|
return logoPrintFileIfExists(false, true);
|
||||||
|
|
||||||
return logoPrintImageIfExists(options->type, true);
|
return logoPrintImageIfExists(options->type, instance.config.display.showErrors);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void logoPrintKnownType(void)
|
static void logoPrintKnownType(void)
|
||||||
|
|||||||
@@ -84,23 +84,28 @@ void ffPrintBattery(FFBatteryOptions* options)
|
|||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
ffPrintError(FF_BATTERY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "%s", error);
|
ffPrintError(FF_BATTERY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "%s", error);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
if(results.length == 0)
|
||||||
{
|
{
|
||||||
for(uint8_t i = 0; i < (uint8_t) results.length; i++)
|
ffPrintError(FF_BATTERY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "%s", "No batteries found");
|
||||||
{
|
return;
|
||||||
FFBatteryResult* result = ffListGet(&results, i);
|
}
|
||||||
printBattery(options, result, i);
|
|
||||||
|
|
||||||
ffStrbufDestroy(&result->manufacturer);
|
for(uint32_t i = 0; i < results.length; i++)
|
||||||
ffStrbufDestroy(&result->modelName);
|
{
|
||||||
ffStrbufDestroy(&result->technology);
|
FFBatteryResult* result = ffListGet(&results, i);
|
||||||
ffStrbufDestroy(&result->status);
|
printBattery(options, result, (uint8_t) i);
|
||||||
ffStrbufDestroy(&result->serial);
|
}
|
||||||
ffStrbufDestroy(&result->manufactureDate);
|
|
||||||
}
|
FF_LIST_FOR_EACH(FFBatteryResult, result, results)
|
||||||
if(results.length == 0)
|
{
|
||||||
ffPrintError(FF_BATTERY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No batteries found");
|
ffStrbufDestroy(&result->manufacturer);
|
||||||
|
ffStrbufDestroy(&result->modelName);
|
||||||
|
ffStrbufDestroy(&result->technology);
|
||||||
|
ffStrbufDestroy(&result->status);
|
||||||
|
ffStrbufDestroy(&result->serial);
|
||||||
|
ffStrbufDestroy(&result->manufactureDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -150,19 +150,17 @@ void ffGenerateBluetoothJsonResult(FF_MAYBE_UNUSED FFBluetoothOptions* options,
|
|||||||
yyjson_mut_obj_add_str(doc, module, "error", error);
|
yyjson_mut_obj_add_str(doc, module, "error", error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
|
||||||
|
|
||||||
FF_LIST_FOR_EACH(FFBluetoothResult, item, results)
|
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
||||||
{
|
|
||||||
yyjson_mut_val* obj = yyjson_mut_arr_add_obj(doc, arr);
|
FF_LIST_FOR_EACH(FFBluetoothResult, item, results)
|
||||||
yyjson_mut_obj_add_strbuf(doc, obj, "address", &item->address);
|
{
|
||||||
yyjson_mut_obj_add_uint(doc, obj, "battery", item->battery);
|
yyjson_mut_val* obj = yyjson_mut_arr_add_obj(doc, arr);
|
||||||
yyjson_mut_obj_add_bool(doc, obj, "connected", item->connected);
|
yyjson_mut_obj_add_strbuf(doc, obj, "address", &item->address);
|
||||||
yyjson_mut_obj_add_strbuf(doc, obj, "name", &item->name);
|
yyjson_mut_obj_add_uint(doc, obj, "battery", item->battery);
|
||||||
yyjson_mut_obj_add_strbuf(doc, obj, "type", &item->type);
|
yyjson_mut_obj_add_bool(doc, obj, "connected", item->connected);
|
||||||
}
|
yyjson_mut_obj_add_strbuf(doc, obj, "name", &item->name);
|
||||||
|
yyjson_mut_obj_add_strbuf(doc, obj, "type", &item->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
FF_LIST_FOR_EACH(FFBluetoothResult, device, results)
|
FF_LIST_FOR_EACH(FFBluetoothResult, device, results)
|
||||||
|
|||||||
@@ -154,12 +154,6 @@ void ffGenerateBrightnessJsonResult(FF_MAYBE_UNUSED FFBrightnessOptions* options
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(result.length == 0)
|
|
||||||
{
|
|
||||||
yyjson_mut_obj_add_str(doc, module, "error", "No result is detected.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
yyjson_mut_val* arr = yyjson_mut_arr(doc);
|
yyjson_mut_val* arr = yyjson_mut_arr(doc);
|
||||||
yyjson_mut_obj_add_val(doc, module, "result", arr);
|
yyjson_mut_obj_add_val(doc, module, "result", arr);
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ void ffGenerateDateTimeJsonConfig(FFDateTimeOptions* options, yyjson_mut_doc* do
|
|||||||
|
|
||||||
void ffGenerateDateTimeJsonResult(FF_MAYBE_UNUSED FFDateTimeOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
void ffGenerateDateTimeJsonResult(FF_MAYBE_UNUSED FFDateTimeOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||||
{
|
{
|
||||||
yyjson_mut_obj_add_uint(doc, module, "result", ffTimeGetNow());
|
yyjson_mut_obj_add_strcpy(doc, module, "result", ffTimeToFullStr(ffTimeGetNow()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffPrintDateTimeHelpFormat(void)
|
void ffPrintDateTimeHelpFormat(void)
|
||||||
|
|||||||
@@ -279,6 +279,7 @@ void ffGenerateDisplayJsonResult(FF_MAYBE_UNUSED FFDisplayOptions* options, yyjs
|
|||||||
yyjson_mut_obj_add_str(doc, module, "error", "Couldn't detect display");
|
yyjson_mut_obj_add_str(doc, module, "error", "Couldn't detect display");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
||||||
FF_LIST_FOR_EACH(FFDisplayResult, item, dsResult->displays)
|
FF_LIST_FOR_EACH(FFDisplayResult, item, dsResult->displays)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -118,12 +118,6 @@ void ffGenerateGamepadJsonResult(FF_MAYBE_UNUSED FFGamepadOptions* options, yyjs
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!result.length)
|
|
||||||
{
|
|
||||||
yyjson_mut_obj_add_str(doc, module, "error", "No devices detected");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
||||||
FF_LIST_FOR_EACH(FFGamepadDevice, device, result)
|
FF_LIST_FOR_EACH(FFGamepadDevice, device, result)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -334,13 +334,7 @@ void ffGenerateLocalIpJsonResult(FF_MAYBE_UNUSED FFLocalIpOptions* options, yyjs
|
|||||||
if(error)
|
if(error)
|
||||||
{
|
{
|
||||||
yyjson_mut_obj_add_str(doc, module, "error", error);
|
yyjson_mut_obj_add_str(doc, module, "error", error);
|
||||||
goto exit;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if(results.length == 0)
|
|
||||||
{
|
|
||||||
yyjson_mut_obj_add_str(doc, module, "error", "Failed to detect any IPs");
|
|
||||||
goto exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
||||||
@@ -354,7 +348,6 @@ void ffGenerateLocalIpJsonResult(FF_MAYBE_UNUSED FFLocalIpOptions* options, yyjs
|
|||||||
yyjson_mut_obj_add_strbuf(doc, obj, "name", &ip->name);
|
yyjson_mut_obj_add_strbuf(doc, obj, "name", &ip->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
|
||||||
FF_LIST_FOR_EACH(FFLocalIpResult, ip, results)
|
FF_LIST_FOR_EACH(FFLocalIpResult, ip, results)
|
||||||
{
|
{
|
||||||
ffStrbufDestroy(&ip->name);
|
ffStrbufDestroy(&ip->name);
|
||||||
|
|||||||
+1
-9
@@ -22,7 +22,7 @@ static void buildOutputDefault(const FFOSResult* os, FFstrbuf* result)
|
|||||||
ffStrbufAppend(result, &instance.state.platform.systemName);
|
ffStrbufAppend(result, &instance.state.platform.systemName);
|
||||||
|
|
||||||
//Append code name if it is missing
|
//Append code name if it is missing
|
||||||
if(os->codename.length > 0 && !ffStrbufContain(result, &os->versionID))
|
if(os->codename.length > 0 && !ffStrbufContain(result, &os->codename))
|
||||||
{
|
{
|
||||||
ffStrbufAppendC(result, ' ');
|
ffStrbufAppendC(result, ' ');
|
||||||
ffStrbufAppend(result, &os->codename);
|
ffStrbufAppend(result, &os->codename);
|
||||||
@@ -40,14 +40,6 @@ static void buildOutputDefault(const FFOSResult* os, FFstrbuf* result)
|
|||||||
ffStrbufAppend(result, &os->version);
|
ffStrbufAppend(result, &os->version);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
if(os->buildID.length > 0)
|
|
||||||
{
|
|
||||||
ffStrbufAppendC(result, ' ');
|
|
||||||
ffStrbufAppend(result, &os->buildID);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//Append variant if it is missing
|
//Append variant if it is missing
|
||||||
if(os->variant.length > 0 && ffStrbufFirstIndex(result, &os->variant) == result->length)
|
if(os->variant.length > 0 && ffStrbufFirstIndex(result, &os->variant) == result->length)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -101,24 +101,28 @@ void ffGeneratePowerAdapterJsonResult(FF_MAYBE_UNUSED FFPowerAdapterOptions* opt
|
|||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
yyjson_mut_obj_add_str(doc, module, "error", error);
|
yyjson_mut_obj_add_str(doc, module, "error", error);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if(results.length == 0)
|
|
||||||
|
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
||||||
|
FF_LIST_FOR_EACH(FFPowerAdapterResult, item, results)
|
||||||
{
|
{
|
||||||
yyjson_mut_obj_add_str(doc, module, "error", "No power adapters found");
|
yyjson_mut_val* obj = yyjson_mut_arr_add_obj(doc, arr);
|
||||||
|
yyjson_mut_obj_add_strbuf(doc, obj, "description", &item->description);
|
||||||
|
yyjson_mut_obj_add_strbuf(doc, obj, "manufacturer", &item->manufacturer);
|
||||||
|
yyjson_mut_obj_add_strbuf(doc, obj, "modelName", &item->modelName);
|
||||||
|
yyjson_mut_obj_add_strbuf(doc, obj, "name", &item->name);
|
||||||
|
yyjson_mut_obj_add_strbuf(doc, obj, "serial", &item->serial);
|
||||||
|
yyjson_mut_obj_add_int(doc, obj, "watts", item->watts);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
FF_LIST_FOR_EACH(FFPowerAdapterResult, item, results)
|
||||||
{
|
{
|
||||||
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
ffStrbufDestroy(&item->manufacturer);
|
||||||
FF_LIST_FOR_EACH(FFPowerAdapterResult, item, results)
|
ffStrbufDestroy(&item->description);
|
||||||
{
|
ffStrbufDestroy(&item->modelName);
|
||||||
yyjson_mut_val* obj = yyjson_mut_arr_add_obj(doc, arr);
|
ffStrbufDestroy(&item->name);
|
||||||
yyjson_mut_obj_add_strbuf(doc, obj, "description", &item->description);
|
ffStrbufDestroy(&item->serial);
|
||||||
yyjson_mut_obj_add_strbuf(doc, obj, "manufacturer", &item->manufacturer);
|
|
||||||
yyjson_mut_obj_add_strbuf(doc, obj, "modelName", &item->modelName);
|
|
||||||
yyjson_mut_obj_add_strbuf(doc, obj, "name", &item->name);
|
|
||||||
yyjson_mut_obj_add_strbuf(doc, obj, "serial", &item->serial);
|
|
||||||
yyjson_mut_obj_add_int(doc, obj, "watts", item->watts);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -200,12 +200,6 @@ void ffGenerateSoundJsonResult(FF_MAYBE_UNUSED FFSoundOptions* options, yyjson_m
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(result.length == 0)
|
|
||||||
{
|
|
||||||
yyjson_mut_obj_add_str(doc, module, "error", "No active sound devices found");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
||||||
FF_LIST_FOR_EACH(FFSoundDevice, item, result)
|
FF_LIST_FOR_EACH(FFSoundDevice, item, result)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ void ffGenerateUsersJsonResult(FF_MAYBE_UNUSED FFUsersOptions* options, yyjson_m
|
|||||||
if(error)
|
if(error)
|
||||||
{
|
{
|
||||||
yyjson_mut_obj_add_str(doc, module, "error", error);
|
yyjson_mut_obj_add_str(doc, module, "error", error);
|
||||||
goto exit;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
||||||
@@ -164,7 +164,6 @@ void ffGenerateUsersJsonResult(FF_MAYBE_UNUSED FFUsersOptions* options, yyjson_m
|
|||||||
yyjson_mut_obj_add_null(doc, obj, "loginTime");
|
yyjson_mut_obj_add_null(doc, obj, "loginTime");
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
|
||||||
FF_LIST_FOR_EACH(FFUserResult, user, results)
|
FF_LIST_FOR_EACH(FFUserResult, user, results)
|
||||||
{
|
{
|
||||||
ffStrbufDestroy(&user->clientIp);
|
ffStrbufDestroy(&user->clientIp);
|
||||||
|
|||||||
@@ -114,11 +114,6 @@ void ffGenerateWifiJsonResult(FF_MAYBE_UNUSED FFWifiOptions* options, yyjson_mut
|
|||||||
yyjson_mut_obj_add_str(doc, module, "error", error);
|
yyjson_mut_obj_add_str(doc, module, "error", error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!result.length)
|
|
||||||
{
|
|
||||||
yyjson_mut_obj_add_str(doc, module, "error", "No Wifi interfaces found");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
yyjson_mut_val* arr = yyjson_mut_obj_add_arr(doc, module, "result");
|
||||||
FF_LIST_FOR_EACH(FFWifiResult, wifi, result)
|
FF_LIST_FOR_EACH(FFWifiResult, wifi, result)
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ void ffEdidGetSerialAndManufactureDate(const uint8_t edid[128], uint32_t* serial
|
|||||||
{
|
{
|
||||||
if (edid[17] > 0 && edid[17] < 0xFF)
|
if (edid[17] > 0 && edid[17] < 0xFF)
|
||||||
{
|
{
|
||||||
*year = edid[17] + 1990;
|
*year = (uint16_t) edid[17] + 1990;
|
||||||
*week = edid[16];
|
*week = (uint16_t) edid[16];
|
||||||
if (*week == 0xFF) *week = 0;
|
if (*week == 0xFF) *week = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user