mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
editorconfig
This commit is contained in:
@@ -38,7 +38,7 @@ static void printBattery(FFinstance* instance, uint8_t index)
|
||||
manufactor.length == 0 &&
|
||||
model.length == 0 &&
|
||||
technology.length == 0 &&
|
||||
capacity.length == 0 &&
|
||||
capacity.length == 0 &&
|
||||
status.length == 0
|
||||
) {
|
||||
ffPrintError(instance, key, "No file in /sys/class/power_supply/BAT0/ could be read or all battery options are disabled");
|
||||
@@ -59,7 +59,7 @@ static void printBattery(FFinstance* instance, uint8_t index)
|
||||
if(capacity.length > 0)
|
||||
{
|
||||
printf("[%s%%", capacity.chars);
|
||||
|
||||
|
||||
if(status.length == 0)
|
||||
puts("]");
|
||||
else
|
||||
@@ -105,4 +105,4 @@ void ffPrintBattery(FFinstance* instance)
|
||||
closedir(dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ void ffPrintBreak(FFinstance* instance)
|
||||
{
|
||||
ffPrintLogoLine(instance);
|
||||
putchar('\n');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,4 +15,4 @@ void ffPrintColors(FFinstance* instance)
|
||||
printf("\033[48;5;%dm ", i);
|
||||
|
||||
puts("\033[0m");
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -12,7 +12,7 @@ void ffPrintCPU(FFinstance* instance)
|
||||
ffPrintError(instance, "CPU", "\"model name%*s %[^\\n]\" not found in \"/proc/cpuinfo\"");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
FILE* frequencyFile = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq", "r");
|
||||
if(frequencyFile == NULL)
|
||||
{
|
||||
@@ -40,14 +40,14 @@ void ffPrintCPU(FFinstance* instance)
|
||||
ffStrbufSetF(&cpu, "%s (%i) @ %.9gGHz", name, numProcs, ghz);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
ffParseFormatString(&cpu, &instance->config.cpuFormat, 3,
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_STRING, name},
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_INT, &numProcs},
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_DOUBLE, &ghz}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
ffPrintAndSaveCachedValue(instance, "CPU", &cpu);
|
||||
ffStrbufDestroy(&cpu);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,4 +4,4 @@ void ffPrintCustom(FFinstance* instance, const char* key, const char* value)
|
||||
{
|
||||
ffPrintLogoAndKey(instance, key);
|
||||
puts(value);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -78,4 +78,4 @@ void ffPrintDesktopEnvironment(FFinstance* instance)
|
||||
ffStrbufDestroy(&sessionType);
|
||||
ffStrbufDestroy(&sessionVersion);
|
||||
ffStrbufDestroy(&sessionDesktop);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -32,4 +32,4 @@ void ffPrintDisk(FFinstance* instance)
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_UINT8, &percentage}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -4,7 +4,7 @@ void ffPrintFont(FFinstance* instance)
|
||||
{
|
||||
char plasma[256];
|
||||
ffParsePropFileHome(instance, ".config/kdeglobals", "font=%[^\n]", plasma);
|
||||
|
||||
|
||||
char plasmaPretty[256];
|
||||
if(plasma[0] == '\0')
|
||||
strcpy(plasmaPretty, "Noto Sans (10pt)");
|
||||
@@ -13,7 +13,7 @@ void ffPrintFont(FFinstance* instance)
|
||||
|
||||
char gtk2[256];
|
||||
ffParsePropFileHome(instance, ".gtkrc-2.0", "gtk-font-name=\"%[^\"]+", gtk2);
|
||||
|
||||
|
||||
char gtk2Pretty[256];
|
||||
if(gtk2[0] == '\0')
|
||||
gtk2Pretty[0] = '\0';
|
||||
@@ -22,7 +22,7 @@ void ffPrintFont(FFinstance* instance)
|
||||
|
||||
char gtk3[256];
|
||||
ffParsePropFileHome(instance, ".config/gtk-3.0/settings.ini", "gtk-font-name=%[^\n]", gtk3);
|
||||
|
||||
|
||||
char gtk3Pretty[256];
|
||||
if(gtk3[0] == '\0')
|
||||
gtk3Pretty[0] = '\0';
|
||||
@@ -37,7 +37,7 @@ void ffPrintFont(FFinstance* instance)
|
||||
gtk4Pretty[0] = '\0';
|
||||
else
|
||||
ffParseFont(gtk4, gtk4Pretty);
|
||||
|
||||
|
||||
FF_STRBUF_CREATE(gtkPretty);
|
||||
ffFormatGtkPretty(>kPretty, gtk2Pretty, gtk3Pretty, gtk4Pretty);
|
||||
|
||||
@@ -59,4 +59,4 @@ void ffPrintFont(FFinstance* instance)
|
||||
}
|
||||
|
||||
ffStrbufDestroy(>kPretty);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@
|
||||
#include <dlfcn.h>
|
||||
|
||||
static void handleGPU(FFinstance* instance, struct pci_access* pacc, struct pci_dev* dev, uint16_t counter, char*(*ffpci_lookup_name)(struct pci_access*, char*, int, int, ...))
|
||||
{
|
||||
{
|
||||
char key[8];
|
||||
sprintf(key, "GPU%hu", counter);
|
||||
|
||||
@@ -31,7 +31,7 @@ static void handleGPU(FFinstance* instance, struct pci_access* pacc, struct pci_
|
||||
}
|
||||
else
|
||||
{
|
||||
ffParseFormatString(&gpu, &instance->config.gpuFormat, 2,
|
||||
ffParseFormatString(&gpu, &instance->config.gpuFormat, 2,
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_STRING, vendorPretty},
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_STRING, name}
|
||||
);
|
||||
@@ -120,4 +120,4 @@ void ffPrintGPU(FFinstance* instance)
|
||||
ffpci_cleanup(pacc);
|
||||
|
||||
dlclose(pci);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ void ffPrintHost(FFinstance* instance)
|
||||
|
||||
FF_STRBUF_CREATE(name);
|
||||
ffGetFileContent("/sys/devices/virtual/dmi/id/product_name", &name);
|
||||
|
||||
|
||||
FF_STRBUF_CREATE(version);
|
||||
ffGetFileContent("/sys/devices/virtual/dmi/id/product_version", &version);
|
||||
|
||||
@@ -62,4 +62,4 @@ void ffPrintHost(FFinstance* instance)
|
||||
ffStrbufDestroy(&family);
|
||||
ffStrbufDestroy(&name);
|
||||
ffStrbufDestroy(&version);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@ void ffPrintIcons(FFinstance* instance)
|
||||
{
|
||||
char plasma[256];
|
||||
ffParsePropFileHome(instance, ".config/kdeglobals", "Theme=%[^\n]", plasma);
|
||||
|
||||
|
||||
char gtk2[256];
|
||||
ffParsePropFileHome(instance, ".gtkrc-2.0", "gtk-icon-theme-name=\"%[^\"]+", gtk2);
|
||||
if(gtk2[0] == '\0')
|
||||
@@ -26,7 +26,7 @@ void ffPrintIcons(FFinstance* instance)
|
||||
if(instance->config.iconsFormat.length == 0)
|
||||
{
|
||||
ffPrintLogoAndKey(instance, "Icons");
|
||||
|
||||
|
||||
if(plasma[0] == '\0')
|
||||
printf("Breeze [Plasma], ");
|
||||
else
|
||||
@@ -46,4 +46,4 @@ void ffPrintIcons(FFinstance* instance)
|
||||
}
|
||||
|
||||
ffStrbufDestroy(>kPretty);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,4 +15,4 @@ void ffPrintKernel(FFinstance* instance)
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_STRING, instance->state.utsname.version}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ void ffPrintLocale(FFinstance* instance)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
ffPrintAndSaveCachedValue(instance, "Locale", &locale);
|
||||
ffStrbufDestroy(&locale);
|
||||
}
|
||||
|
||||
@@ -43,4 +43,4 @@ void ffPrintMemory(FFinstance* instance)
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_UINT8, &percentage}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -52,7 +52,7 @@ void ffPrintOS(FFinstance* instance)
|
||||
}
|
||||
|
||||
fclose(osRelease);
|
||||
|
||||
|
||||
if(line != NULL)
|
||||
free(line);
|
||||
|
||||
@@ -71,7 +71,7 @@ void ffPrintOS(FFinstance* instance)
|
||||
else
|
||||
{
|
||||
if(name[0] != '\0')
|
||||
ffStrbufAppendS(&os, name);
|
||||
ffStrbufAppendS(&os, name);
|
||||
else
|
||||
ffStrbufAppendS(&os, id);
|
||||
|
||||
@@ -126,4 +126,4 @@ void ffPrintOS(FFinstance* instance)
|
||||
|
||||
ffPrintAndSaveCachedValue(instance, "OS", &os);
|
||||
ffStrbufDestroy(&os);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ static uint32_t get_num_dirs(const char* dirname) {
|
||||
if(entry->d_type == DT_DIR)
|
||||
++num_dirs;
|
||||
}
|
||||
|
||||
|
||||
num_dirs -= 2; // accounting for . and ..
|
||||
|
||||
closedir(dirp);
|
||||
@@ -60,7 +60,7 @@ void ffPrintPackages(FFinstance* instance)
|
||||
ffPrintFormatString(instance, "Packages", &instance->config.packagesFormat, 3,
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_UINT, &all},
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_UINT, &pacman},
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_UINT, &flatpak}
|
||||
);
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_UINT, &flatpak}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,4 +94,4 @@ void ffPrintResolution(FFinstance* instance)
|
||||
|
||||
ffPrintAndSaveCachedValue(instance, "Resolution", &resolution);
|
||||
ffStrbufDestroy(&resolution);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,4 @@ void ffPrintSeperator(FFinstance* instance)
|
||||
for(uint8_t i = 0; i < instance->config.titleLength; i++)
|
||||
putchar('-');
|
||||
putchar('\n');
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -43,4 +43,4 @@ void ffPrintShell(FFinstance* instance)
|
||||
|
||||
ffPrintAndSaveCachedValue(instance, "Shell", &shell);
|
||||
ffStrbufDestroy(&shell);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ static void getTerminalName(FFinstance* instance, const char* pid, char* termina
|
||||
getTerminalName(instance, ppid, terminal, error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(
|
||||
strcasecmp(name, "systemd") == 0 ||
|
||||
strcasecmp(name, "init") == 0 ||
|
||||
@@ -85,7 +85,7 @@ void ffPrintTerminal(FFinstance* instance)
|
||||
ffPrintError(instance, "Terminal", instance->state.terminal.error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(instance->config.terminalFormat.length == 0)
|
||||
{
|
||||
ffPrintLogoAndKey(instance, "Terminal");
|
||||
|
||||
@@ -48,14 +48,14 @@ static void printTTY(FFinstance* instance)
|
||||
ffParsePropFile("/etc/vconsole.conf", "Font=%[^\n]", font);
|
||||
if(font[0] == '\0')
|
||||
strcpy(font, "hardware-supplied VGA font");
|
||||
|
||||
|
||||
printTerminalFont(instance, font);
|
||||
}
|
||||
|
||||
void ffPrintTerminalFont(FFinstance* instance)
|
||||
{
|
||||
ffPopulateTerminal(instance);
|
||||
|
||||
|
||||
if(instance->state.terminal.error != NULL)
|
||||
{
|
||||
ffPrintError(instance, "Terminal Font", "Terminal Font needs successfull terminal detection");
|
||||
@@ -68,4 +68,4 @@ void ffPrintTerminalFont(FFinstance* instance)
|
||||
printTTY(instance);
|
||||
else
|
||||
ffPrintError(instance, "Terminal Font", "Unknown terminal: %s", instance->state.terminal.value);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ void ffPrintTheme(FFinstance* instance)
|
||||
{
|
||||
char plasma[256];
|
||||
ffParsePropFileHome(instance, ".config/kdeglobals", "Name=%[^\n]", plasma);
|
||||
|
||||
|
||||
char gtk2[256];
|
||||
ffParsePropFileHome(instance, ".gtkrc-2.0", "gtk-theme-name=\"%[^\"]+", gtk2);
|
||||
if(gtk2[0] == '\0')
|
||||
@@ -42,4 +42,4 @@ void ffPrintTheme(FFinstance* instance)
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_STRBUF, >kPretty}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -12,4 +12,4 @@ void ffPrintTitle(FFinstance* instance)
|
||||
printf(FASTFETCH_TEXT_MODIFIER_BOLT"%s%s"FASTFETCH_TEXT_MODIFIER_RESET"@"FASTFETCH_TEXT_MODIFIER_BOLT"%s%s"FASTFETCH_TEXT_MODIFIER_RESET"\n",
|
||||
instance->config.color.chars, instance->state.passwd->pw_name, instance->config.color.chars, hostname
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
void ffPrintUptime(FFinstance* instance)
|
||||
{
|
||||
uint32_t days = instance->state.sysinfo.uptime / 86400;
|
||||
uint32_t hours = (instance->state.sysinfo.uptime - (days * 86400)) / 3600;
|
||||
uint32_t hours = (instance->state.sysinfo.uptime - (days * 86400)) / 3600;
|
||||
uint32_t minutes = (instance->state.sysinfo.uptime - (days * 86400) - (hours * 3600)) / 60;
|
||||
uint32_t seconds = instance->state.sysinfo.uptime - (days * 86400) - (hours * 3600) - (minutes * 60);
|
||||
|
||||
@@ -35,4 +35,4 @@ void ffPrintUptime(FFinstance* instance)
|
||||
(FFformatarg){FF_FORMAT_ARG_TYPE_UINT, &seconds}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ static bool parseProcessName(FFstrbuf* name)
|
||||
else
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffPrintWM(FFinstance* instance)
|
||||
@@ -62,4 +62,4 @@ void ffPrintWM(FFinstance* instance)
|
||||
}
|
||||
|
||||
ffStrbufDestroy(&name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user