mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-02 03:14:15 +01:00
Global: make FFinstance instance a global variable
As discussed in https://github.com/fastfetch-cli/fastfetch/discussions/473
This commit is contained in:
+88
-88
@@ -8,7 +8,7 @@
|
||||
#define FF_LOGO_COLOR_TITLE(x) logo.colorTitle = x;
|
||||
#define FF_LOGO_RETURN return &logo;
|
||||
|
||||
const FFlogo* ffLogoBuiltinGetUnknown()
|
||||
const FFlogo* ffLogoBuiltinGetUnknown(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("unknown", "question mark", "?")
|
||||
@@ -38,7 +38,7 @@ const FFlogo* ffLogoBuiltinGetUnknown()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoAlmaLinux()
|
||||
static const FFlogo* getLogoAlmaLinux(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("almalinux")
|
||||
@@ -76,7 +76,7 @@ static const FFlogo* getLogoAlmaLinux()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoAlpine()
|
||||
static const FFlogo* getLogoAlpine(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("alpine", "alpinelinux", "alpine-linux")
|
||||
@@ -110,7 +110,7 @@ static const FFlogo* getLogoAlpine()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoAlpineSmall()
|
||||
static const FFlogo* getLogoAlpineSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("alpine_small", "alpine-linux-small")
|
||||
@@ -130,7 +130,7 @@ static const FFlogo* getLogoAlpineSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoAndroid()
|
||||
static const FFlogo* getLogoAndroid(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("android")
|
||||
@@ -163,7 +163,7 @@ static const FFlogo* getLogoAndroid()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoAndroidSmall()
|
||||
static const FFlogo* getLogoAndroidSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("android-small", "android_small")
|
||||
@@ -183,7 +183,7 @@ static const FFlogo* getLogoAndroidSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoArch()
|
||||
static const FFlogo* getLogoArch(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("arch", "archlinux", "arch-linux")
|
||||
@@ -217,7 +217,7 @@ static const FFlogo* getLogoArch()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoArchSmall()
|
||||
static const FFlogo* getLogoArchSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("arch_small", "archlinux_small", "arch-linux-small")
|
||||
@@ -238,7 +238,7 @@ static const FFlogo* getLogoArchSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoArtix()
|
||||
static const FFlogo* getLogoArtix(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("artix", "artixlinux", "artix-linux")
|
||||
@@ -272,7 +272,7 @@ static const FFlogo* getLogoArtix()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoArtixSmall()
|
||||
static const FFlogo* getLogoArtixSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("artix_small", "artixlinux_small", "artix-linux-small")
|
||||
@@ -293,7 +293,7 @@ static const FFlogo* getLogoArtixSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoArcoLinux()
|
||||
static const FFlogo* getLogoArcoLinux(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("arco", "arcolinux", "arco-linux")
|
||||
@@ -328,7 +328,7 @@ static const FFlogo* getLogoArcoLinux()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoBSD()
|
||||
static const FFlogo* getLogoBSD(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("bsd")
|
||||
@@ -365,7 +365,7 @@ static const FFlogo* getLogoBSD()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoBedrock()
|
||||
static const FFlogo* getLogoBedrock(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("bedrock", "bedrocklinux", "bedrock-linux")
|
||||
@@ -397,7 +397,7 @@ static const FFlogo* getLogoBedrock()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoCachyOS()
|
||||
static const FFlogo* getLogoCachyOS(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("cachy", "cachyos", "cachy-linux", "cachyos-linux")
|
||||
@@ -435,7 +435,7 @@ static const FFlogo* getLogoCachyOS()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoCachyOSSmall()
|
||||
static const FFlogo* getLogoCachyOSSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("cachy_small", "cachyos_small", "cachy-linux-small", "cachyos-linux-small")
|
||||
@@ -458,7 +458,7 @@ static const FFlogo* getLogoCachyOSSmall()
|
||||
}
|
||||
|
||||
|
||||
static const FFlogo* getLogoCelOS()
|
||||
static const FFlogo* getLogoCelOS(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("cel", "celos", "cel-linux", "celos-linux")
|
||||
@@ -488,7 +488,7 @@ static const FFlogo* getLogoCelOS()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoCentOS()
|
||||
static const FFlogo* getLogoCentOS(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("cent", "centos", "cent-linux", "centos-linux")
|
||||
@@ -525,7 +525,7 @@ static const FFlogo* getLogoCentOS()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoCentOSSmall()
|
||||
static const FFlogo* getLogoCentOSSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("cent_small", "centos_small", "cent-linux_small", "cent-linux-small", "centos-linux-small")
|
||||
@@ -549,7 +549,7 @@ static const FFlogo* getLogoCentOSSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoCRUX()
|
||||
static const FFlogo* getLogoCRUX(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("CRUX", "crux")
|
||||
@@ -583,7 +583,7 @@ static const FFlogo* getLogoCRUX()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoCrystalLinux()
|
||||
static const FFlogo* getLogoCrystalLinux(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("crystal", "Crystal", "crystal-linux", "Crystal-Linux")
|
||||
@@ -619,7 +619,7 @@ static const FFlogo* getLogoCrystalLinux()
|
||||
|
||||
|
||||
|
||||
static const FFlogo* getLogoDebian()
|
||||
static const FFlogo* getLogoDebian(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("debian", "debian-linux")
|
||||
@@ -651,7 +651,7 @@ static const FFlogo* getLogoDebian()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoDebianSmall()
|
||||
static const FFlogo* getLogoDebianSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("debian_small", "debian-linux-small")
|
||||
@@ -671,7 +671,7 @@ static const FFlogo* getLogoDebianSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoDevuan()
|
||||
static const FFlogo* getLogoDevuan(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("devuan", "devuan-linux")
|
||||
@@ -700,7 +700,7 @@ static const FFlogo* getLogoDevuan()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoDevuanSmall()
|
||||
static const FFlogo* getLogoDevuanSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("devuan_small", "devuan-linux-small")
|
||||
@@ -721,7 +721,7 @@ static const FFlogo* getLogoDevuanSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoDeepin()
|
||||
static const FFlogo* getLogoDeepin(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("deepin", "deepin-linux")
|
||||
@@ -753,7 +753,7 @@ static const FFlogo* getLogoDeepin()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoEndeavour()
|
||||
static const FFlogo* getLogoEndeavour(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("endeavour", "endeavour-linux", "endeavouros", "endeavouros-linux")
|
||||
@@ -784,7 +784,7 @@ static const FFlogo* getLogoEndeavour()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoEnso()
|
||||
static const FFlogo* getLogoEnso(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("enso", "uqc")
|
||||
@@ -817,7 +817,7 @@ static const FFlogo* getLogoEnso()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoFedora()
|
||||
static const FFlogo* getLogoFedora(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("fedora", "fedora-linux")
|
||||
@@ -851,7 +851,7 @@ static const FFlogo* getLogoFedora()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoFedoraSmall()
|
||||
static const FFlogo* getLogoFedoraSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("fedora_small", "fedora-linux-small")
|
||||
@@ -874,7 +874,7 @@ static const FFlogo* getLogoFedoraSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoFedoraOld()
|
||||
static const FFlogo* getLogoFedoraOld(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("fedora_old", "fedora-old", "fedora-linux-old", "fedora-linux_old")
|
||||
@@ -906,7 +906,7 @@ static const FFlogo* getLogoFedoraOld()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoFreeBSD()
|
||||
static const FFlogo* getLogoFreeBSD(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("freebsd")
|
||||
@@ -936,7 +936,7 @@ static const FFlogo* getLogoFreeBSD()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoFreeBSDSmall()
|
||||
static const FFlogo* getLogoFreeBSDSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("freebsd_small")
|
||||
@@ -956,7 +956,7 @@ static const FFlogo* getLogoFreeBSDSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoGaruda()
|
||||
static const FFlogo* getLogoGaruda(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("garuda", "garuda-linux")
|
||||
@@ -988,7 +988,7 @@ static const FFlogo* getLogoGaruda()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoGarudaSmall()
|
||||
static const FFlogo* getLogoGarudaSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("garuda_small", "garudalinux_small", "garuda-linux-small")
|
||||
@@ -1007,7 +1007,7 @@ static const FFlogo* getLogoGarudaSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoGentoo()
|
||||
static const FFlogo* getLogoGentoo(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("gentoo", "gentoo-linux")
|
||||
@@ -1040,7 +1040,7 @@ static const FFlogo* getLogoGentoo()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoGentooSmall()
|
||||
static const FFlogo* getLogoGentooSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("gentoo_small", "gentoo-linux-small")
|
||||
@@ -1064,7 +1064,7 @@ static const FFlogo* getLogoGentooSmall()
|
||||
|
||||
#define FF_RAW_STRING(x) #x
|
||||
|
||||
static const FFlogo* getLogoGhostBSD()
|
||||
static const FFlogo* getLogoGhostBSD(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("ghostbsd")
|
||||
@@ -1091,7 +1091,7 @@ static const FFlogo* getLogoGhostBSD()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoKDENeon()
|
||||
static const FFlogo* getLogoKDENeon(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("kde", "kde-neon", "neon")
|
||||
@@ -1124,7 +1124,7 @@ static const FFlogo* getLogoKDENeon()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoKISSLinux()
|
||||
static const FFlogo* getLogoKISSLinux(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("kiss", "kiss-linux", "kisslinux")
|
||||
@@ -1147,7 +1147,7 @@ static const FFlogo* getLogoKISSLinux()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoKubuntu()
|
||||
static const FFlogo* getLogoKubuntu(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("kubuntu", "kubuntu-linux", "kde-ubuntu", "ubuntu-kde", "ubuntu-plasma")
|
||||
@@ -1182,7 +1182,7 @@ static const FFlogo* getLogoKubuntu()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoLangitKetujuh()
|
||||
static const FFlogo* getLogoLangitKetujuh(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("l7", "langitketujuh", "LangitKetujuh")
|
||||
@@ -1210,7 +1210,7 @@ static const FFlogo* getLogoLangitKetujuh()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoLinux()
|
||||
static const FFlogo* getLogoLinux(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("linux", "linux-generic")
|
||||
@@ -1238,7 +1238,7 @@ static const FFlogo* getLogoLinux()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoMacOS()
|
||||
static const FFlogo* getLogoMacOS(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("macos", "mac", "apple", "darwin", "osx")
|
||||
@@ -1273,7 +1273,7 @@ static const FFlogo* getLogoMacOS()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoMacOSSmall()
|
||||
static const FFlogo* getLogoMacOSSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("macos_small", "mac_small", "apple_small", "darwin_small", "osx_small")
|
||||
@@ -1298,7 +1298,7 @@ static const FFlogo* getLogoMacOSSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoMacOSSmall2()
|
||||
static const FFlogo* getLogoMacOSSmall2(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("macos_small2", "mac_small2", "apple_small2", "darwin_small2", "osx_small2")
|
||||
@@ -1323,7 +1323,7 @@ static const FFlogo* getLogoMacOSSmall2()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoManjaro()
|
||||
static const FFlogo* getLogoManjaro(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("manjaro", "manjaro-linux")
|
||||
@@ -1351,7 +1351,7 @@ static const FFlogo* getLogoManjaro()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoManjaroSmall()
|
||||
static const FFlogo* getLogoManjaroSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("manjaro_small", "manjaro-linux-small")
|
||||
@@ -1372,7 +1372,7 @@ static const FFlogo* getLogoManjaroSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoMint()
|
||||
static const FFlogo* getLogoMint(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("mint", "linuxmint", "mint-linux", "linux-mint")
|
||||
@@ -1406,7 +1406,7 @@ static const FFlogo* getLogoMint()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoMintSmall()
|
||||
static const FFlogo* getLogoMintSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("mint_small", "linuxmint_small", "mint-linux-small")
|
||||
@@ -1428,7 +1428,7 @@ static const FFlogo* getLogoMintSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoMintOld()
|
||||
static const FFlogo* getLogoMintOld(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("mint_old", "mint-old", "mint-linux_old", "mint-linux-old", "linux-mint_old", "linux-mint-old")
|
||||
@@ -1459,7 +1459,7 @@ static const FFlogo* getLogoMintOld()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoMsys2()
|
||||
static const FFlogo* getLogoMsys2(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("msys2")
|
||||
@@ -1500,7 +1500,7 @@ static const FFlogo* getLogoMsys2()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoWindows11()
|
||||
static const FFlogo* getLogoWindows11(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("Windows 11", "Windows Server 2022")
|
||||
@@ -1534,7 +1534,7 @@ static const FFlogo* getLogoWindows11()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoWindows11Small()
|
||||
static const FFlogo* getLogoWindows11Small(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("Windows 11_small", "Windows 11-small")
|
||||
@@ -1557,7 +1557,7 @@ static const FFlogo* getLogoWindows11Small()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoWindows8()
|
||||
static const FFlogo* getLogoWindows8(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("Windows 8", "Windows 8.1", "Windows 10", "Windows Server 2012", "Windows Server 2012 R2", "Windows Server 2016", "Windows Server 2019")
|
||||
@@ -1593,7 +1593,7 @@ static const FFlogo* getLogoWindows8()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoWindows()
|
||||
static const FFlogo* getLogoWindows(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("Windows", "Windows 7", "Windows Server 2008", "Windows Server 2008 R2")
|
||||
@@ -1626,7 +1626,7 @@ static const FFlogo* getLogoWindows()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoNixOS()
|
||||
static const FFlogo* getLogoNixOS(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("nixos", "nix", "nixos-linux", "nix-linux", "nix-os", "nix_os", "nix_os_linux")
|
||||
@@ -1661,7 +1661,7 @@ static const FFlogo* getLogoNixOS()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoNixOsOld()
|
||||
static const FFlogo* getLogoNixOsOld(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("nixos_old", "nix-old", "nixos-old", "nix_old", "nix-os-old", "nix_os_old")
|
||||
@@ -1704,7 +1704,7 @@ static const FFlogo* getLogoNixOsOld()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoNixOsSmall()
|
||||
static const FFlogo* getLogoNixOsSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("nixos_small", "nix-small", "nixos-small", "nix_small", "nix-os-small", "nix_os_small")
|
||||
@@ -1725,7 +1725,7 @@ static const FFlogo* getLogoNixOsSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoNobara()
|
||||
static const FFlogo* getLogoNobara(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("nobara", "nobara-linux");
|
||||
@@ -1756,7 +1756,7 @@ static const FFlogo* getLogoNobara()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoOpenSuse()
|
||||
static const FFlogo* getLogoOpenSuse(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("suse", "opensuse", "open_suse", "open-suse", "suse-linux")
|
||||
@@ -1789,7 +1789,7 @@ static const FFlogo* getLogoOpenSuse()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoOpenSuseSmall()
|
||||
static const FFlogo* getLogoOpenSuseSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("suse_small", "opensuse_small", "open_suse_small", "open-suse_small")
|
||||
@@ -1810,7 +1810,7 @@ static const FFlogo* getLogoOpenSuseSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoOpenSuseLeap()
|
||||
static const FFlogo* getLogoOpenSuseLeap(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("opensuse_leap", "open_suse_leap", "opensuse-leap", "open-suse-leap", "suse_leap", "suse-leap", "opensuseleap")
|
||||
@@ -1840,7 +1840,7 @@ static const FFlogo* getLogoOpenSuseLeap()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoOpenSuseTumbleweed()
|
||||
static const FFlogo* getLogoOpenSuseTumbleweed(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("opensuse_tumbleweed", "open_suse_tumbleweed", "opensuse-tumbleweed", "open-suse-tumbleweed", "suse_tumbleweed", "suse-tumbleweed", "opensusetumbleweed")
|
||||
@@ -1867,7 +1867,7 @@ static const FFlogo* getLogoOpenSuseTumbleweed()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoOpenMandriva()
|
||||
static const FFlogo* getLogoOpenMandriva(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("openmandriva", "open-mandriva", "open_mandriva")
|
||||
@@ -1906,7 +1906,7 @@ static const FFlogo* getLogoOpenMandriva()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoPop()
|
||||
static const FFlogo* getLogoPop(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("pop", "popos", "pop_os", "pop-linux")
|
||||
@@ -1941,7 +1941,7 @@ static const FFlogo* getLogoPop()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoParabola()
|
||||
static const FFlogo* getLogoParabola(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("parabola", "parabola-gnulinux")
|
||||
@@ -1971,7 +1971,7 @@ static const FFlogo* getLogoParabola()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoParabolaSmall()
|
||||
static const FFlogo* getLogoParabolaSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("parabola_small", "parabola-gnulinux_small")
|
||||
@@ -1991,7 +1991,7 @@ static const FFlogo* getLogoParabolaSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoPopSmall()
|
||||
static const FFlogo* getLogoPopSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("pop_small", "popos_small", "pop_os_small", "pop-linux-small")
|
||||
@@ -2012,7 +2012,7 @@ static const FFlogo* getLogoPopSmall()
|
||||
FF_LOGO_COLOR_TITLE("36"); //cyan
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
static const FFlogo* getLogoRaspbian()
|
||||
static const FFlogo* getLogoRaspbian(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("raspbian", "raspi", "raspberrypi" "raspberrypios" "pios")
|
||||
@@ -2050,7 +2050,7 @@ static const FFlogo* getLogoRaspbian()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoRaspbianSmall()
|
||||
static const FFlogo* getLogoRaspbianSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("raspbian_small", "raspi_small", "raspberrypi_small" "raspberrypios_small" "pios_small")
|
||||
@@ -2075,7 +2075,7 @@ static const FFlogo* getLogoRaspbianSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoReborn()
|
||||
static const FFlogo* getLogoReborn(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("reborn", "reborn-os", "rebornos", "rebornos-linux", "reborn-os-linux")
|
||||
@@ -2110,7 +2110,7 @@ static const FFlogo* getLogoReborn()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoRebornSmall()
|
||||
static const FFlogo* getLogoRebornSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("reborn_small", "reborn-os-small", "rebornos_small", "rebornos-linux-small", "reborn-os-linux-small")
|
||||
@@ -2135,7 +2135,7 @@ static const FFlogo* getLogoRebornSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoRedHatEnterpriseLinux()
|
||||
static const FFlogo* getLogoRedHatEnterpriseLinux(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("rhel", "redhat", "redhat-linux")
|
||||
@@ -2167,7 +2167,7 @@ static const FFlogo* getLogoRedHatEnterpriseLinux()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoRedstarOS()
|
||||
static const FFlogo* getLogoRedstarOS(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("redstar", "redstar-os", "redstaros", "redstaros-linux", "redstar-os-linux")
|
||||
@@ -2199,7 +2199,7 @@ static const FFlogo* getLogoRedstarOS()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoRockyLinux()
|
||||
static const FFlogo* getLogoRockyLinux(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("rocky", "rocky-linux", "rockylinux")
|
||||
@@ -2232,7 +2232,7 @@ static const FFlogo* getLogoRockyLinux()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoRosaLinux()
|
||||
static const FFlogo* getLogoRosaLinux(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("rosa", "rosa-linux", "rosalinux")
|
||||
@@ -2266,7 +2266,7 @@ static const FFlogo* getLogoRosaLinux()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoSlackware()
|
||||
static const FFlogo* getLogoSlackware(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("slackware", "slackware-linux", "slackwarelinux")
|
||||
@@ -2302,7 +2302,7 @@ static const FFlogo* getLogoSlackware()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoSlackwareSmall()
|
||||
static const FFlogo* getLogoSlackwareSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("slackware-small", "slackware-linux-small", "slackware_small", "slackwarelinux_small")
|
||||
@@ -2323,7 +2323,7 @@ static const FFlogo* getLogoSlackwareSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoSolus()
|
||||
static const FFlogo* getLogoSolus(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("solus", "solus-linux")
|
||||
@@ -2358,7 +2358,7 @@ static const FFlogo* getLogoSolus()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoSteamOS()
|
||||
static const FFlogo* getLogoSteamOS(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("steamos")
|
||||
@@ -2391,7 +2391,7 @@ static const FFlogo* getLogoSteamOS()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoUbuntu()
|
||||
static const FFlogo* getLogoUbuntu(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("ubuntu", "ubuntu-linux")
|
||||
@@ -2427,7 +2427,7 @@ static const FFlogo* getLogoUbuntu()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoUbuntuOld()
|
||||
static const FFlogo* getLogoUbuntuOld(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("ubuntu_old", "ubuntu-linux_old")
|
||||
@@ -2462,7 +2462,7 @@ static const FFlogo* getLogoUbuntuOld()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoUbuntuSmall()
|
||||
static const FFlogo* getLogoUbuntuSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("ubuntu_small", "ubuntu-linux-small")
|
||||
@@ -2482,7 +2482,7 @@ static const FFlogo* getLogoUbuntuSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoVanilla()
|
||||
static const FFlogo* getLogoVanilla(void)
|
||||
{
|
||||
|
||||
FF_LOGO_INIT
|
||||
@@ -2515,7 +2515,7 @@ static const FFlogo* getLogoVanilla()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoVoid()
|
||||
static const FFlogo* getLogoVoid(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("void", "void-linux")
|
||||
@@ -2548,7 +2548,7 @@ static const FFlogo* getLogoVoid()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoVoidSmall()
|
||||
static const FFlogo* getLogoVoidSmall(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("void_small", "void-linux-small")
|
||||
@@ -2569,7 +2569,7 @@ static const FFlogo* getLogoVoidSmall()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
static const FFlogo* getLogoZorin()
|
||||
static const FFlogo* getLogoZorin(void)
|
||||
{
|
||||
FF_LOGO_INIT
|
||||
FF_LOGO_NAMES("zorin", "zorin-linux", "zorinos", "zorinos-linux")
|
||||
@@ -2600,7 +2600,7 @@ static const FFlogo* getLogoZorin()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
GetLogoMethod* ffLogoBuiltinGetAll()
|
||||
GetLogoMethod* ffLogoBuiltinGetAll(void)
|
||||
{
|
||||
static GetLogoMethod logoMethods[] = {
|
||||
ffLogoBuiltinGetUnknown,
|
||||
|
||||
@@ -12,12 +12,12 @@ static void* logoResize(const void* image, size_t width, size_t height, void* ex
|
||||
return ffResizeImage(image, width, height, UndefinedFilter, 1.0, exceptionInfo);
|
||||
}
|
||||
|
||||
FFLogoImageResult ffLogoPrintImageIM6(FFinstance* instance, FFLogoRequestData* requestData)
|
||||
FFLogoImageResult ffLogoPrintImageIM6(FFLogoRequestData* requestData)
|
||||
{
|
||||
FF_LIBRARY_LOAD(imageMagick, &instance->config.libImageMagick, FF_LOGO_IMAGE_RESULT_INIT_ERROR, "libMagickCore-6.Q16HDRI" FF_LIBRARY_EXTENSION, 8, "libMagickCore-6.Q16" FF_LIBRARY_EXTENSION, 8)
|
||||
FF_LIBRARY_LOAD(imageMagick, &instance.config.libImageMagick, FF_LOGO_IMAGE_RESULT_INIT_ERROR, "libMagickCore-6.Q16HDRI" FF_LIBRARY_EXTENSION, 8, "libMagickCore-6.Q16" FF_LIBRARY_EXTENSION, 8)
|
||||
FF_LIBRARY_LOAD_SYMBOL_ADDRESS(imageMagick, ffResizeImage, ResizeImage, FF_LOGO_IMAGE_RESULT_INIT_ERROR);
|
||||
|
||||
return ffLogoPrintImageImpl(instance, requestData, &(FFIMData) {
|
||||
return ffLogoPrintImageImpl(requestData, &(FFIMData) {
|
||||
.resizeFunc = logoResize,
|
||||
.library = imageMagick,
|
||||
});
|
||||
|
||||
@@ -12,16 +12,16 @@ static void* logoResize(const void* image, size_t width, size_t height, void* ex
|
||||
return ffResizeImage(image, width, height, UndefinedFilter, exceptionInfo);
|
||||
}
|
||||
|
||||
FFLogoImageResult ffLogoPrintImageIM7(FFinstance* instance, FFLogoRequestData* requestData)
|
||||
FFLogoImageResult ffLogoPrintImageIM7(FFLogoRequestData* requestData)
|
||||
{
|
||||
FF_LIBRARY_LOAD(imageMagick, &instance->config.libImageMagick, FF_LOGO_IMAGE_RESULT_INIT_ERROR,
|
||||
FF_LIBRARY_LOAD(imageMagick, &instance.config.libImageMagick, FF_LOGO_IMAGE_RESULT_INIT_ERROR,
|
||||
"libMagickCore-7.Q16HDRI" FF_LIBRARY_EXTENSION, 11,
|
||||
"libMagickCore-7.Q16" FF_LIBRARY_EXTENSION, 11,
|
||||
"libMagickCore-7.Q16HDRI-10" FF_LIBRARY_EXTENSION, -1 // Required for Windows
|
||||
)
|
||||
FF_LIBRARY_LOAD_SYMBOL_ADDRESS(imageMagick, ffResizeImage, ResizeImage, FF_LOGO_IMAGE_RESULT_INIT_ERROR);
|
||||
|
||||
return ffLogoPrintImageImpl(instance, requestData, &(FFIMData) {
|
||||
return ffLogoPrintImageImpl(requestData, &(FFIMData) {
|
||||
.resizeFunc = logoResize,
|
||||
.library = imageMagick,
|
||||
});
|
||||
|
||||
+84
-84
@@ -34,51 +34,51 @@ static FFstrbuf base64Encode(FFstrbuf* in)
|
||||
return out;
|
||||
}
|
||||
|
||||
static bool printImageIterm(FFinstance* instance)
|
||||
static bool printImageIterm(void)
|
||||
{
|
||||
if(instance->config.logo.width == 0 || instance->config.logo.height == 0)
|
||||
if(instance.config.logo.width == 0 || instance.config.logo.height == 0)
|
||||
{
|
||||
fputs("Logo: `iterm` protocol only works when both `--logo-width` and `--logo-height` being specified\n", stderr);
|
||||
return false;
|
||||
}
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY buf = ffStrbufCreate();
|
||||
if(!ffAppendFileBuffer(instance->config.logo.source.chars, &buf))
|
||||
if(!ffAppendFileBuffer(instance.config.logo.source.chars, &buf))
|
||||
{
|
||||
fputs("Logo: Failed to load image file\n", stderr);
|
||||
return false;
|
||||
}
|
||||
|
||||
ffPrintCharTimes('\n', instance->config.logo.paddingTop);
|
||||
ffPrintCharTimes(' ', instance->config.logo.paddingLeft);
|
||||
ffPrintCharTimes('\n', instance.config.logo.paddingTop);
|
||||
ffPrintCharTimes(' ', instance.config.logo.paddingLeft);
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY base64 = base64Encode(&buf);
|
||||
instance->state.logoWidth = instance->config.logo.width + instance->config.logo.paddingLeft + instance->config.logo.paddingRight;
|
||||
instance->state.logoHeight = instance->config.logo.paddingTop + instance->config.logo.height;
|
||||
instance.state.logoWidth = instance.config.logo.width + instance.config.logo.paddingLeft + instance.config.logo.paddingRight;
|
||||
instance.state.logoHeight = instance.config.logo.paddingTop + instance.config.logo.height;
|
||||
printf("\033]1337;File=inline=1;width=%u;height=%u;preserveAspectRatio=%u:%s\a\033[9999999D\n\033[%uA",
|
||||
(unsigned) instance->config.logo.width,
|
||||
(unsigned) instance->config.logo.height,
|
||||
(unsigned) instance->config.logo.preserveAspectRadio,
|
||||
(unsigned) instance.config.logo.width,
|
||||
(unsigned) instance.config.logo.height,
|
||||
(unsigned) instance.config.logo.preserveAspectRadio,
|
||||
base64.chars,
|
||||
(unsigned) instance->state.logoHeight
|
||||
(unsigned) instance.state.logoHeight
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool printImageKittyDirect(FFinstance* instance)
|
||||
static bool printImageKittyDirect(void)
|
||||
{
|
||||
ffPrintCharTimes(' ', instance->config.logo.paddingLeft);
|
||||
ffPrintCharTimes('\n', instance->config.logo.paddingTop);
|
||||
FFstrbuf base64 = base64Encode(&instance->config.logo.source);
|
||||
ffPrintCharTimes(' ', instance.config.logo.paddingLeft);
|
||||
ffPrintCharTimes('\n', instance.config.logo.paddingTop);
|
||||
FFstrbuf base64 = base64Encode(&instance.config.logo.source);
|
||||
printf("\033_Ga=T,f=100,t=f,c=%u,r=%u,C=1;%s\033\\\033[9999999D",
|
||||
(unsigned) instance->config.logo.width,
|
||||
(unsigned) instance->config.logo.height,
|
||||
(unsigned) instance.config.logo.width,
|
||||
(unsigned) instance.config.logo.height,
|
||||
base64.chars
|
||||
);
|
||||
|
||||
instance->state.logoWidth = instance->config.logo.width + instance->config.logo.paddingLeft + instance->config.logo.paddingRight;
|
||||
instance->state.logoHeight = instance->config.logo.paddingTop + instance->config.logo.height;
|
||||
instance.state.logoWidth = instance.config.logo.width + instance.config.logo.paddingLeft + instance.config.logo.paddingRight;
|
||||
instance.state.logoHeight = instance.config.logo.paddingTop + instance.config.logo.height;
|
||||
|
||||
ffStrbufDestroy(&base64);
|
||||
|
||||
@@ -122,9 +122,9 @@ static inline char* realpath(const char* restrict file_name, char* restrict reso
|
||||
#include <stdlib.h>
|
||||
#include <zlib.h>
|
||||
|
||||
static bool compressBlob(const FFinstance* instance, void** blob, size_t* length)
|
||||
static bool compressBlob(void** blob, size_t* length)
|
||||
{
|
||||
FF_LIBRARY_LOAD(zlib, &instance->config.libZ, false, "libz" FF_LIBRARY_EXTENSION, 2)
|
||||
FF_LIBRARY_LOAD(zlib, &instance.config.libZ, false, "libz" FF_LIBRARY_EXTENSION, 2)
|
||||
FF_LIBRARY_LOAD_SYMBOL(zlib, compressBound, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL(zlib, compress2, false)
|
||||
|
||||
@@ -202,36 +202,36 @@ static void writeCacheUint32(FFLogoRequestData* requestData, uint32_t value, con
|
||||
writeCacheStrbuf(requestData, &content, cacheFileName);
|
||||
}
|
||||
|
||||
static void printImagePixels(FFinstance* instance, FFLogoRequestData* requestData, const FFstrbuf* result, const char* cacheFileName)
|
||||
static void printImagePixels(FFLogoRequestData* requestData, const FFstrbuf* result, const char* cacheFileName)
|
||||
{
|
||||
//Calculate character dimensions
|
||||
instance->state.logoWidth = requestData->logoCharacterWidth + instance->config.logo.paddingLeft + instance->config.logo.paddingRight;
|
||||
instance.state.logoWidth = requestData->logoCharacterWidth + instance.config.logo.paddingLeft + instance.config.logo.paddingRight;
|
||||
|
||||
instance->state.logoHeight = requestData->logoCharacterHeight + instance->config.logo.paddingTop;
|
||||
instance.state.logoHeight = requestData->logoCharacterHeight + instance.config.logo.paddingTop;
|
||||
if(requestData->type == FF_LOGO_TYPE_IMAGE_KITTY)
|
||||
instance->state.logoHeight -= 1;
|
||||
instance.state.logoHeight -= 1;
|
||||
|
||||
//Write cache files
|
||||
writeCacheStrbuf(requestData, result, cacheFileName);
|
||||
|
||||
if(instance->config.logo.width == 0)
|
||||
writeCacheUint32(requestData, instance->state.logoWidth, FF_CACHE_FILE_WIDTH);
|
||||
if(instance.config.logo.width == 0)
|
||||
writeCacheUint32(requestData, instance.state.logoWidth, FF_CACHE_FILE_WIDTH);
|
||||
|
||||
if(instance->config.logo.height == 0)
|
||||
writeCacheUint32(requestData, instance->state.logoHeight, FF_CACHE_FILE_HEIGHT);
|
||||
if(instance.config.logo.height == 0)
|
||||
writeCacheUint32(requestData, instance.state.logoHeight, FF_CACHE_FILE_HEIGHT);
|
||||
|
||||
//Write result to stdout
|
||||
ffPrintCharTimes('\n', instance->config.logo.paddingTop);
|
||||
ffPrintCharTimes(' ', instance->config.logo.paddingLeft);
|
||||
ffPrintCharTimes('\n', instance.config.logo.paddingTop);
|
||||
ffPrintCharTimes(' ', instance.config.logo.paddingLeft);
|
||||
fflush(stdout);
|
||||
ffWriteFDBuffer(FFUnixFD2NativeFD(STDOUT_FILENO), result);
|
||||
|
||||
//Go to upper left corner
|
||||
fputs("\033[9999999D", stdout);
|
||||
printf("\033[%uA", instance->state.logoHeight);
|
||||
printf("\033[%uA", instance.state.logoHeight);
|
||||
}
|
||||
|
||||
static bool printImageSixel(FFinstance* instance, FFLogoRequestData* requestData, const ImageData* imageData)
|
||||
static bool printImageSixel(FFLogoRequestData* requestData, const ImageData* imageData)
|
||||
{
|
||||
imageData->ffCopyMagickString(imageData->imageInfo->magick, "SIXEL", 6);
|
||||
|
||||
@@ -244,7 +244,7 @@ static bool printImageSixel(FFinstance* instance, FFLogoRequestData* requestData
|
||||
result.chars = (char*) blob;
|
||||
result.length = (uint32_t) length;
|
||||
|
||||
printImagePixels(instance, requestData, &result, FF_CACHE_FILE_SIXEL);
|
||||
printImagePixels(requestData, &result, FF_CACHE_FILE_SIXEL);
|
||||
|
||||
free(blob);
|
||||
return true;
|
||||
@@ -267,7 +267,7 @@ static void appendKittyChunk(FFstrbuf* result, const char** blob, size_t* length
|
||||
*blob += chunkSize;
|
||||
}
|
||||
|
||||
static bool printImageKitty(FFinstance* instance, FFLogoRequestData* requestData, const ImageData* imageData)
|
||||
static bool printImageKitty(FFLogoRequestData* requestData, const ImageData* imageData)
|
||||
{
|
||||
imageData->ffCopyMagickString(imageData->imageInfo->magick, "RGBA", 5);
|
||||
|
||||
@@ -277,7 +277,7 @@ static bool printImageKitty(FFinstance* instance, FFLogoRequestData* requestData
|
||||
return false;
|
||||
|
||||
#ifdef FF_HAVE_ZLIB
|
||||
bool isCompressed = compressBlob(instance, &blob, &length);
|
||||
bool isCompressed = compressBlob(&blob, &length);
|
||||
#else
|
||||
bool isCompressed = false;
|
||||
#endif
|
||||
@@ -299,7 +299,7 @@ static bool printImageKitty(FFinstance* instance, FFLogoRequestData* requestData
|
||||
while(remainingLength > 0)
|
||||
appendKittyChunk(&result, ¤tPos, &remainingLength, true);
|
||||
|
||||
printImagePixels(instance, requestData, &result, isCompressed ? FF_CACHE_FILE_KITTY_COMPRESSED : FF_CACHE_FILE_KITTY_UNCOMPRESSED);
|
||||
printImagePixels(requestData, &result, isCompressed ? FF_CACHE_FILE_KITTY_COMPRESSED : FF_CACHE_FILE_KITTY_UNCOMPRESSED);
|
||||
|
||||
free(chars);
|
||||
return true;
|
||||
@@ -307,9 +307,9 @@ static bool printImageKitty(FFinstance* instance, FFLogoRequestData* requestData
|
||||
|
||||
#ifdef FF_HAVE_CHAFA
|
||||
#include <chafa.h>
|
||||
static bool printImageChafa(FFinstance* instance, FFLogoRequestData* requestData, const ImageData* imageData)
|
||||
static bool printImageChafa(FFLogoRequestData* requestData, const ImageData* imageData)
|
||||
{
|
||||
FF_LIBRARY_LOAD(chafa, &instance->config.libChafa, false,
|
||||
FF_LIBRARY_LOAD(chafa, &instance.config.libChafa, false,
|
||||
"libchafa" FF_LIBRARY_EXTENSION, 1,
|
||||
"libchafa-0" FF_LIBRARY_EXTENSION, -1 // Required for Windows
|
||||
)
|
||||
@@ -333,36 +333,36 @@ static bool printImageChafa(FFinstance* instance, FFLogoRequestData* requestData
|
||||
|
||||
ChafaSymbolMap* symbolMap = ffchafa_symbol_map_new();
|
||||
GError* error = NULL;
|
||||
if(!ffchafa_symbol_map_apply_selectors(symbolMap, instance->config.logo.chafaSymbols.chars, &error))
|
||||
if(!ffchafa_symbol_map_apply_selectors(symbolMap, instance.config.logo.chafaSymbols.chars, &error))
|
||||
fputs(error->message, stderr);
|
||||
|
||||
ChafaCanvasConfig* canvasConfig = ffchafa_canvas_config_new();
|
||||
ffchafa_canvas_config_set_geometry(canvasConfig, (gint) requestData->logoCharacterWidth, (gint) requestData->logoCharacterHeight);
|
||||
ffchafa_canvas_config_set_symbol_map(canvasConfig, symbolMap);
|
||||
|
||||
if(instance->config.logo.chafaFgOnly)
|
||||
if(instance.config.logo.chafaFgOnly)
|
||||
{
|
||||
FF_LIBRARY_LOAD_SYMBOL_LAZY(chafa, chafa_canvas_config_set_fg_only_enabled);
|
||||
if(ffchafa_canvas_config_set_fg_only_enabled)
|
||||
ffchafa_canvas_config_set_fg_only_enabled(canvasConfig, true);
|
||||
}
|
||||
if(instance->config.logo.chafaCanvasMode < CHAFA_CANVAS_MODE_MAX)
|
||||
if(instance.config.logo.chafaCanvasMode < CHAFA_CANVAS_MODE_MAX)
|
||||
{
|
||||
FF_LIBRARY_LOAD_SYMBOL_LAZY(chafa, chafa_canvas_config_set_canvas_mode);
|
||||
if(ffchafa_canvas_config_set_canvas_mode)
|
||||
ffchafa_canvas_config_set_canvas_mode(canvasConfig, (ChafaCanvasMode) instance->config.logo.chafaCanvasMode);
|
||||
ffchafa_canvas_config_set_canvas_mode(canvasConfig, (ChafaCanvasMode) instance.config.logo.chafaCanvasMode);
|
||||
}
|
||||
if(instance->config.logo.chafaColorSpace < CHAFA_COLOR_SPACE_MAX)
|
||||
if(instance.config.logo.chafaColorSpace < CHAFA_COLOR_SPACE_MAX)
|
||||
{
|
||||
FF_LIBRARY_LOAD_SYMBOL_LAZY(chafa, chafa_canvas_config_set_color_space)
|
||||
if(ffchafa_canvas_config_set_color_space)
|
||||
ffchafa_canvas_config_set_color_space(canvasConfig, (ChafaColorSpace) instance->config.logo.chafaColorSpace);
|
||||
ffchafa_canvas_config_set_color_space(canvasConfig, (ChafaColorSpace) instance.config.logo.chafaColorSpace);
|
||||
}
|
||||
if(instance->config.logo.chafaDitherMode < CHAFA_DITHER_MODE_MAX)
|
||||
if(instance.config.logo.chafaDitherMode < CHAFA_DITHER_MODE_MAX)
|
||||
{
|
||||
FF_LIBRARY_LOAD_SYMBOL_LAZY(chafa, chafa_canvas_config_set_dither_mode)
|
||||
if(ffchafa_canvas_config_set_dither_mode)
|
||||
ffchafa_canvas_config_set_dither_mode(canvasConfig, (ChafaDitherMode) instance->config.logo.chafaDitherMode);
|
||||
ffchafa_canvas_config_set_dither_mode(canvasConfig, (ChafaDitherMode) instance.config.logo.chafaDitherMode);
|
||||
}
|
||||
|
||||
ChafaCanvas* canvas = ffchafa_canvas_new(canvasConfig);
|
||||
@@ -381,7 +381,7 @@ static bool printImageChafa(FFinstance* instance, FFLogoRequestData* requestData
|
||||
result.length = (uint32_t) str->len;
|
||||
result.chars = str->str;
|
||||
|
||||
ffLogoPrintChars(instance, result.chars, false);
|
||||
ffLogoPrintChars(result.chars, false);
|
||||
writeCacheStrbuf(requestData, &result, FF_CACHE_FILE_CHAFA);
|
||||
|
||||
// FIXME: These functions must be imported from `libglib` dlls on Windows
|
||||
@@ -403,7 +403,7 @@ static bool printImageChafa(FFinstance* instance, FFLogoRequestData* requestData
|
||||
}
|
||||
#endif
|
||||
|
||||
FFLogoImageResult ffLogoPrintImageImpl(FFinstance* instance, FFLogoRequestData* requestData, const FFIMData* imData)
|
||||
FFLogoImageResult ffLogoPrintImageImpl(FFLogoRequestData* requestData, const FFIMData* imData)
|
||||
{
|
||||
FF_LIBRARY_LOAD_SYMBOL(imData->library, MagickCoreGenesis, FF_LOGO_IMAGE_RESULT_INIT_ERROR);
|
||||
FF_LIBRARY_LOAD_SYMBOL(imData->library, MagickCoreTerminus, FF_LOGO_IMAGE_RESULT_INIT_ERROR);
|
||||
@@ -438,7 +438,7 @@ FFLogoImageResult ffLogoPrintImageImpl(FFinstance* instance, FFLogoRequestData*
|
||||
}
|
||||
|
||||
//+1, because we need to copy the null byte too
|
||||
imageData.ffCopyMagickString(imageInfoIn->filename, instance->config.logo.source.chars, instance->config.logo.source.length + 1);
|
||||
imageData.ffCopyMagickString(imageInfoIn->filename, instance.config.logo.source.chars, instance.config.logo.source.length + 1);
|
||||
|
||||
imageData.image = ffReadImage(imageInfoIn, imageData.exceptionInfo);
|
||||
ffDestroyImageInfo(imageInfoIn);
|
||||
@@ -493,13 +493,13 @@ FFLogoImageResult ffLogoPrintImageImpl(FFinstance* instance, FFLogoRequestData*
|
||||
if(requestData->type == FF_LOGO_TYPE_IMAGE_CHAFA)
|
||||
{
|
||||
#ifdef FF_HAVE_CHAFA
|
||||
printSuccessful = printImageChafa(instance, requestData, &imageData);
|
||||
printSuccessful = printImageChafa(requestData, &imageData);
|
||||
#endif
|
||||
}
|
||||
else if(requestData->type == FF_LOGO_TYPE_IMAGE_KITTY)
|
||||
printSuccessful = printImageKitty(instance, requestData, &imageData);
|
||||
printSuccessful = printImageKitty(requestData, &imageData);
|
||||
else if(requestData->type == FF_LOGO_TYPE_IMAGE_SIXEL)
|
||||
printSuccessful = printImageSixel(instance, requestData, &imageData);
|
||||
printSuccessful = printImageSixel(requestData, &imageData);
|
||||
|
||||
ffDestroyImageInfo(imageData.imageInfo);
|
||||
ffDestroyImage(imageData.image);
|
||||
@@ -544,7 +544,7 @@ static uint32_t readCachedUint32(FFLogoRequestData* requestData, const char* cac
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool printCachedChars(FFinstance* instance, FFLogoRequestData* requestData)
|
||||
static bool printCachedChars(FFLogoRequestData* requestData)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY content = ffStrbufCreateA(32768);
|
||||
|
||||
@@ -554,13 +554,13 @@ static bool printCachedChars(FFinstance* instance, FFLogoRequestData* requestDat
|
||||
if(content.length == 0)
|
||||
return false;
|
||||
|
||||
ffLogoPrintChars(instance, content.chars, false);
|
||||
ffLogoPrintChars(content.chars, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool printCachedPixel(FFinstance* instance, FFLogoRequestData* requestData)
|
||||
static bool printCachedPixel(FFLogoRequestData* requestData)
|
||||
{
|
||||
requestData->logoCharacterWidth = instance->config.logo.width;
|
||||
requestData->logoCharacterWidth = instance.config.logo.width;
|
||||
if(requestData->logoCharacterWidth == 0)
|
||||
{
|
||||
requestData->logoCharacterWidth = readCachedUint32(requestData, FF_CACHE_FILE_WIDTH);
|
||||
@@ -568,7 +568,7 @@ static bool printCachedPixel(FFinstance* instance, FFLogoRequestData* requestDat
|
||||
return false;
|
||||
}
|
||||
|
||||
requestData->logoCharacterHeight = instance->config.logo.height;
|
||||
requestData->logoCharacterHeight = instance.config.logo.height;
|
||||
if(requestData->logoCharacterHeight == 0)
|
||||
{
|
||||
requestData->logoCharacterHeight = readCachedUint32(requestData, FF_CACHE_FILE_HEIGHT);
|
||||
@@ -589,8 +589,8 @@ static bool printCachedPixel(FFinstance* instance, FFLogoRequestData* requestDat
|
||||
if(fd == -1)
|
||||
return false;
|
||||
|
||||
ffPrintCharTimes('\n', instance->config.logo.paddingTop);
|
||||
ffPrintCharTimes(' ', instance->config.logo.paddingLeft);
|
||||
ffPrintCharTimes('\n', instance.config.logo.paddingTop);
|
||||
ffPrintCharTimes(' ', instance.config.logo.paddingLeft);
|
||||
fflush(stdout);
|
||||
|
||||
char buffer[32768];
|
||||
@@ -600,21 +600,21 @@ static bool printCachedPixel(FFinstance* instance, FFLogoRequestData* requestDat
|
||||
|
||||
close(fd);
|
||||
|
||||
instance->state.logoWidth = requestData->logoCharacterWidth + instance->config.logo.paddingLeft + instance->config.logo.paddingRight;
|
||||
instance->state.logoHeight = requestData->logoCharacterHeight + instance->config.logo.paddingTop;
|
||||
instance.state.logoWidth = requestData->logoCharacterWidth + instance.config.logo.paddingLeft + instance.config.logo.paddingRight;
|
||||
instance.state.logoHeight = requestData->logoCharacterHeight + instance.config.logo.paddingTop;
|
||||
|
||||
//Go to upper left corner
|
||||
fputs("\033[9999999D", stdout);
|
||||
printf("\033[%uA", instance->state.logoHeight);
|
||||
printf("\033[%uA", instance.state.logoHeight);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool printCached(FFinstance* instance, FFLogoRequestData* requestData)
|
||||
static bool printCached(FFLogoRequestData* requestData)
|
||||
{
|
||||
if(requestData->type == FF_LOGO_TYPE_IMAGE_CHAFA)
|
||||
return printCachedChars(instance, requestData);
|
||||
return printCachedChars(requestData);
|
||||
else
|
||||
return printCachedPixel(instance, requestData);
|
||||
return printCachedPixel(requestData);
|
||||
}
|
||||
|
||||
static bool getCharacterPixelDimensions(FFLogoRequestData* requestData)
|
||||
@@ -654,7 +654,7 @@ static bool getCharacterPixelDimensions(FFLogoRequestData* requestData)
|
||||
return requestData->characterPixelWidth > 1.0 && requestData->characterPixelHeight > 1.0;
|
||||
}
|
||||
|
||||
static bool printImageIfExistsSlowPath(FFinstance* instance, FFLogoType type, bool printError)
|
||||
static bool printImageIfExistsSlowPath(FFLogoType type, bool printError)
|
||||
{
|
||||
FFLogoRequestData requestData;
|
||||
requestData.type = type;
|
||||
@@ -662,7 +662,7 @@ static bool printImageIfExistsSlowPath(FFinstance* instance, FFLogoType type, bo
|
||||
requestData.characterPixelHeight = 1;
|
||||
|
||||
if(
|
||||
(type != FF_LOGO_TYPE_IMAGE_CHAFA || instance->config.logo.width == 0 || instance->config.logo.height == 0) &&
|
||||
(type != FF_LOGO_TYPE_IMAGE_CHAFA || instance.config.logo.width == 0 || instance.config.logo.height == 0) &&
|
||||
!getCharacterPixelDimensions(&requestData)
|
||||
) {
|
||||
if(printError)
|
||||
@@ -670,15 +670,15 @@ static bool printImageIfExistsSlowPath(FFinstance* instance, FFLogoType type, bo
|
||||
return false;
|
||||
}
|
||||
|
||||
requestData.logoPixelWidth = simpleCeil((double) instance->config.logo.width * requestData.characterPixelWidth);
|
||||
requestData.logoPixelHeight = simpleCeil((double) instance->config.logo.height * requestData.characterPixelHeight);
|
||||
requestData.logoPixelWidth = simpleCeil((double) instance.config.logo.width * requestData.characterPixelWidth);
|
||||
requestData.logoPixelHeight = simpleCeil((double) instance.config.logo.height * requestData.characterPixelHeight);
|
||||
|
||||
ffStrbufInit(&requestData.cacheDir);
|
||||
ffStrbufAppend(&requestData.cacheDir, &instance->state.platform.cacheDir);
|
||||
ffStrbufAppend(&requestData.cacheDir, &instance.state.platform.cacheDir);
|
||||
ffStrbufAppendS(&requestData.cacheDir, "fastfetch/images");
|
||||
|
||||
ffStrbufEnsureFree(&requestData.cacheDir, PATH_MAX);
|
||||
if(realpath(instance->config.logo.source.chars, requestData.cacheDir.chars + requestData.cacheDir.length) == NULL)
|
||||
if(realpath(instance.config.logo.source.chars, requestData.cacheDir.chars + requestData.cacheDir.length) == NULL)
|
||||
{
|
||||
//We can safely return here, because if realpath failed, we surely won't be able to read the file
|
||||
ffStrbufDestroy(&requestData.cacheDir);
|
||||
@@ -694,7 +694,7 @@ static bool printImageIfExistsSlowPath(FFinstance* instance, FFLogoType type, bo
|
||||
ffStrbufAppendF(&requestData.cacheDir, "%u", requestData.logoPixelHeight);
|
||||
ffStrbufAppendC(&requestData.cacheDir, '/');
|
||||
|
||||
if(!instance->config.recache && printCached(instance, &requestData))
|
||||
if(!instance.config.recache && printCached(&requestData))
|
||||
{
|
||||
ffStrbufDestroy(&requestData.cacheDir);
|
||||
return true;
|
||||
@@ -703,12 +703,12 @@ static bool printImageIfExistsSlowPath(FFinstance* instance, FFLogoType type, bo
|
||||
FFLogoImageResult result = FF_LOGO_IMAGE_RESULT_INIT_ERROR;
|
||||
|
||||
#ifdef FF_HAVE_IMAGEMAGICK7
|
||||
result = ffLogoPrintImageIM7(instance, &requestData);
|
||||
result = ffLogoPrintImageIM7(&requestData);
|
||||
#endif
|
||||
|
||||
#ifdef FF_HAVE_IMAGEMAGICK6
|
||||
if(result == FF_LOGO_IMAGE_RESULT_INIT_ERROR)
|
||||
result = ffLogoPrintImageIM6(instance, &requestData);
|
||||
result = ffLogoPrintImageIM6(&requestData);
|
||||
#endif
|
||||
|
||||
ffStrbufDestroy(&requestData.cacheDir);
|
||||
@@ -729,25 +729,25 @@ static bool printImageIfExistsSlowPath(FFinstance* instance, FFLogoType type, bo
|
||||
|
||||
#endif //FF_HAVE_IMAGEMAGICK{6, 7}
|
||||
|
||||
bool ffLogoPrintImageIfExists(FFinstance* instance, FFLogoType type, bool printError)
|
||||
bool ffLogoPrintImageIfExists(FFLogoType type, bool printError)
|
||||
{
|
||||
if(!ffPathExists(instance->config.logo.source.chars, FF_PATHTYPE_FILE))
|
||||
if(!ffPathExists(instance.config.logo.source.chars, FF_PATHTYPE_FILE))
|
||||
{
|
||||
if(printError)
|
||||
fprintf(stderr, "Logo: Image source \"%s\" does not exist\n", instance->config.logo.source.chars);
|
||||
fprintf(stderr, "Logo: Image source \"%s\" does not exist\n", instance.config.logo.source.chars);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(type == FF_LOGO_TYPE_IMAGE_ITERM)
|
||||
return printImageIterm(instance);
|
||||
return printImageIterm();
|
||||
|
||||
if(
|
||||
type == FF_LOGO_TYPE_IMAGE_KITTY &&
|
||||
ffStrbufEndsWithIgnCaseS(&instance->config.logo.source, ".png") &&
|
||||
instance->config.logo.width &&
|
||||
instance->config.logo.height
|
||||
ffStrbufEndsWithIgnCaseS(&instance.config.logo.source, ".png") &&
|
||||
instance.config.logo.width &&
|
||||
instance.config.logo.height
|
||||
)
|
||||
return printImageKittyDirect(instance);
|
||||
return printImageKittyDirect();
|
||||
|
||||
#if !defined(FF_HAVE_CHAFA)
|
||||
if(type == FF_LOGO_TYPE_IMAGE_CHAFA)
|
||||
@@ -763,6 +763,6 @@ bool ffLogoPrintImageIfExists(FFinstance* instance, FFLogoType type, bool printE
|
||||
fputs("Logo: Image Magick support is not compiled in\n", stderr);
|
||||
return false;
|
||||
#else
|
||||
return printImageIfExistsSlowPath(instance, type, printError);
|
||||
return printImageIfExistsSlowPath(type, printError);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -35,17 +35,17 @@ typedef struct FFIMData
|
||||
void*(*resizeFunc)(const void* image, size_t width, size_t height, void* exceptionInfo);
|
||||
} FFIMData;
|
||||
|
||||
FFLogoImageResult ffLogoPrintImageImpl(FFinstance* instance, FFLogoRequestData* requestData, const FFIMData* imData);
|
||||
FFLogoImageResult ffLogoPrintImageImpl(FFLogoRequestData* requestData, const FFIMData* imData);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef FF_HAVE_IMAGEMAGICK7
|
||||
FFLogoImageResult ffLogoPrintImageIM7(FFinstance* instance, FFLogoRequestData* requestData);
|
||||
FFLogoImageResult ffLogoPrintImageIM7(FFLogoRequestData* requestData);
|
||||
#endif
|
||||
|
||||
#ifdef FF_HAVE_IMAGEMAGICK6
|
||||
#include <math.h>
|
||||
FFLogoImageResult ffLogoPrintImageIM6(FFinstance* instance, FFLogoRequestData* requestData);
|
||||
FFLogoImageResult ffLogoPrintImageIM6(FFLogoRequestData* requestData);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
+96
-96
@@ -8,21 +8,21 @@
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
static void ffLogoPrintCharsRaw(FFinstance* instance, const char* data, size_t length)
|
||||
static void ffLogoPrintCharsRaw(const char* data, size_t length)
|
||||
{
|
||||
FFLogoOptions* options = &instance->config.logo;
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_BOLT, stdout);
|
||||
ffPrintCharTimes('\n', options->paddingTop);
|
||||
ffPrintCharTimes(' ', options->paddingLeft);
|
||||
fwrite(data, length, 1, stdout);
|
||||
instance->state.logoHeight = options->paddingTop + options->height;
|
||||
instance->state.logoWidth = options->paddingLeft + options->width + options->paddingRight;
|
||||
printf("\033[9999999D\n\033[%uA", instance->state.logoHeight);
|
||||
instance.state.logoHeight = options->paddingTop + options->height;
|
||||
instance.state.logoWidth = options->paddingLeft + options->width + options->paddingRight;
|
||||
printf("\033[9999999D\n\033[%uA", instance.state.logoHeight);
|
||||
}
|
||||
|
||||
void ffLogoPrintChars(FFinstance* instance, const char* data, bool doColorReplacement)
|
||||
void ffLogoPrintChars(const char* data, bool doColorReplacement)
|
||||
{
|
||||
FFLogoOptions* options = &instance->config.logo;
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
|
||||
uint32_t currentlineLength = 0;
|
||||
|
||||
@@ -30,7 +30,7 @@ void ffLogoPrintChars(FFinstance* instance, const char* data, bool doColorReplac
|
||||
ffPrintCharTimes('\n', options->paddingTop);
|
||||
ffPrintCharTimes(' ', options->paddingLeft);
|
||||
|
||||
instance->state.logoHeight = options->paddingTop;
|
||||
instance.state.logoHeight = options->paddingTop;
|
||||
|
||||
//Use logoColor[0] as the default color
|
||||
if(doColorReplacement)
|
||||
@@ -52,11 +52,11 @@ void ffLogoPrintChars(FFinstance* instance, const char* data, bool doColorReplac
|
||||
|
||||
ffPrintCharTimes(' ', options->paddingLeft);
|
||||
|
||||
if(currentlineLength > instance->state.logoWidth)
|
||||
instance->state.logoWidth = currentlineLength;
|
||||
if(currentlineLength > instance.state.logoWidth)
|
||||
instance.state.logoWidth = currentlineLength;
|
||||
|
||||
currentlineLength = 0;
|
||||
++instance->state.logoHeight;
|
||||
++instance.state.logoHeight;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -155,26 +155,26 @@ void ffLogoPrintChars(FFinstance* instance, const char* data, bool doColorReplac
|
||||
fputs(FASTFETCH_TEXT_MODIFIER_RESET, stdout);
|
||||
|
||||
//Happens if the last line is the longest
|
||||
if(currentlineLength > instance->state.logoWidth)
|
||||
instance->state.logoWidth = currentlineLength;
|
||||
if(currentlineLength > instance.state.logoWidth)
|
||||
instance.state.logoWidth = currentlineLength;
|
||||
|
||||
instance->state.logoWidth += options->paddingLeft + options->paddingRight;
|
||||
instance.state.logoWidth += options->paddingLeft + options->paddingRight;
|
||||
|
||||
//Go to the leftmost position
|
||||
fputs("\033[9999999D", stdout);
|
||||
|
||||
//If the logo height is > 1, go up the height
|
||||
if(instance->state.logoHeight > 0)
|
||||
printf("\033[%uA", instance->state.logoHeight);
|
||||
if(instance.state.logoHeight > 0)
|
||||
printf("\033[%uA", instance.state.logoHeight);
|
||||
}
|
||||
|
||||
static void logoApplyColors(FFinstance* instance, const FFlogo* logo)
|
||||
static void logoApplyColors(const FFlogo* logo)
|
||||
{
|
||||
if(instance->config.colorKeys.length == 0)
|
||||
ffStrbufAppendS(&instance->config.colorKeys, logo->colorKeys);
|
||||
if(instance.config.colorKeys.length == 0)
|
||||
ffStrbufAppendS(&instance.config.colorKeys, logo->colorKeys);
|
||||
|
||||
if(instance->config.colorTitle.length == 0)
|
||||
ffStrbufAppendS(&instance->config.colorTitle, logo->colorTitle);
|
||||
if(instance.config.colorTitle.length == 0)
|
||||
ffStrbufAppendS(&instance.config.colorTitle, logo->colorTitle);
|
||||
}
|
||||
|
||||
static bool logoHasName(const FFlogo* logo, const char* name)
|
||||
@@ -208,9 +208,9 @@ static const FFlogo* logoGetBuiltin(const char* name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const FFlogo* logoGetBuiltinDetected(const FFinstance* instance)
|
||||
static const FFlogo* logoGetBuiltinDetected(void)
|
||||
{
|
||||
const FFOSResult* os = ffDetectOS(instance);
|
||||
const FFOSResult* os = ffDetectOS();
|
||||
|
||||
const FFlogo* logo = logoGetBuiltin(os->id.chars);
|
||||
if(logo != NULL)
|
||||
@@ -228,23 +228,23 @@ static const FFlogo* logoGetBuiltinDetected(const FFinstance* instance)
|
||||
if(logo != NULL)
|
||||
return logo;
|
||||
|
||||
logo = logoGetBuiltin(instance->state.platform.systemName.chars);
|
||||
logo = logoGetBuiltin(instance.state.platform.systemName.chars);
|
||||
if(logo != NULL)
|
||||
return logo;
|
||||
|
||||
return ffLogoBuiltinGetUnknown();
|
||||
}
|
||||
|
||||
static inline void logoApplyColorsDetected(FFinstance* instance)
|
||||
static inline void logoApplyColorsDetected(void)
|
||||
{
|
||||
logoApplyColors(instance, logoGetBuiltinDetected(instance));
|
||||
logoApplyColors(logoGetBuiltinDetected());
|
||||
}
|
||||
|
||||
static void logoPrintStruct(FFinstance* instance, const FFlogo* logo)
|
||||
static void logoPrintStruct(const FFlogo* logo)
|
||||
{
|
||||
logoApplyColors(instance, logo);
|
||||
logoApplyColors(logo);
|
||||
|
||||
FFLogoOptions* options = &instance->config.logo;
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
|
||||
const char** colors = logo->builtinColors;
|
||||
for(int i = 0; *colors != NULL && i < FASTFETCH_LOGO_MAX_COLORS; i++, colors++)
|
||||
@@ -253,21 +253,21 @@ static void logoPrintStruct(FFinstance* instance, const FFlogo* logo)
|
||||
ffStrbufAppendS(&options->colors[i], *colors);
|
||||
}
|
||||
|
||||
ffLogoPrintChars(instance, logo->data, true);
|
||||
ffLogoPrintChars(logo->data, true);
|
||||
}
|
||||
|
||||
static void logoPrintNone(FFinstance* instance)
|
||||
static void logoPrintNone(void)
|
||||
{
|
||||
logoApplyColorsDetected(instance);
|
||||
instance->state.logoHeight = 0;
|
||||
instance->state.logoWidth = 0;
|
||||
logoApplyColorsDetected();
|
||||
instance.state.logoHeight = 0;
|
||||
instance.state.logoWidth = 0;
|
||||
}
|
||||
|
||||
static bool logoPrintBuiltinIfExists(FFinstance* instance, const char* name)
|
||||
static bool logoPrintBuiltinIfExists(const char* name)
|
||||
{
|
||||
if(strcasecmp(name, "none") == 0)
|
||||
{
|
||||
logoPrintNone(instance);
|
||||
logoPrintNone();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -275,36 +275,36 @@ static bool logoPrintBuiltinIfExists(FFinstance* instance, const char* name)
|
||||
if(logo == NULL)
|
||||
return false;
|
||||
|
||||
logoPrintStruct(instance, logo);
|
||||
logoPrintStruct(logo);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void logoPrintDetected(FFinstance* instance)
|
||||
static inline void logoPrintDetected(void)
|
||||
{
|
||||
logoPrintStruct(instance, logoGetBuiltinDetected(instance));
|
||||
logoPrintStruct(logoGetBuiltinDetected());
|
||||
}
|
||||
|
||||
static bool logoPrintData(FFinstance* instance, bool doColorReplacement) {
|
||||
FFLogoOptions* options = &instance->config.logo;
|
||||
static bool logoPrintData(bool doColorReplacement) {
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
if(options->source.length == 0)
|
||||
return false;
|
||||
|
||||
ffLogoPrintChars(instance, options->source.chars, doColorReplacement);
|
||||
logoApplyColorsDetected(instance);
|
||||
ffLogoPrintChars(options->source.chars, doColorReplacement);
|
||||
logoApplyColorsDetected();
|
||||
return true;
|
||||
}
|
||||
|
||||
static void updateLogoPath(FFinstance* instance)
|
||||
static void updateLogoPath(void)
|
||||
{
|
||||
FFLogoOptions* options = &instance->config.logo;
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
|
||||
if(ffPathExists(options->source.chars, FF_PATHTYPE_FILE))
|
||||
return;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY fullPath = ffStrbufCreate();
|
||||
|
||||
FF_LIST_FOR_EACH(FFstrbuf, dataDir, instance->state.platform.dataDirs)
|
||||
FF_LIST_FOR_EACH(FFstrbuf, dataDir, instance.state.platform.dataDirs)
|
||||
{
|
||||
//We need to copy it, because multiple threads might be using dataDirs at the same time
|
||||
ffStrbufSet(&fullPath, dataDir);
|
||||
@@ -319,9 +319,9 @@ static void updateLogoPath(FFinstance* instance)
|
||||
}
|
||||
}
|
||||
|
||||
static bool logoPrintFileIfExists(FFinstance* instance, bool doColorReplacement, bool raw)
|
||||
static bool logoPrintFileIfExists(bool doColorReplacement, bool raw)
|
||||
{
|
||||
FFLogoOptions* options = &instance->config.logo;
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY content = ffStrbufCreate();
|
||||
|
||||
@@ -331,50 +331,50 @@ static bool logoPrintFileIfExists(FFinstance* instance, bool doColorReplacement,
|
||||
return false;
|
||||
}
|
||||
|
||||
logoApplyColorsDetected(instance);
|
||||
logoApplyColorsDetected();
|
||||
if(raw)
|
||||
ffLogoPrintCharsRaw(instance, content.chars, content.length);
|
||||
ffLogoPrintCharsRaw(content.chars, content.length);
|
||||
else
|
||||
ffLogoPrintChars(instance, content.chars, doColorReplacement);
|
||||
ffLogoPrintChars(content.chars, doColorReplacement);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool logoPrintImageIfExists(FFinstance* instance, FFLogoType logo, bool printError)
|
||||
static bool logoPrintImageIfExists(FFLogoType logo, bool printError)
|
||||
{
|
||||
if(!ffLogoPrintImageIfExists(instance, logo, printError))
|
||||
if(!ffLogoPrintImageIfExists(logo, printError))
|
||||
return false;
|
||||
|
||||
logoApplyColorsDetected(instance);
|
||||
logoApplyColorsDetected();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool logoTryKnownType(FFinstance* instance)
|
||||
static bool logoTryKnownType(void)
|
||||
{
|
||||
FFLogoOptions* options = &instance->config.logo;
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
|
||||
if(options->type == FF_LOGO_TYPE_NONE)
|
||||
{
|
||||
logoApplyColorsDetected(instance);
|
||||
logoApplyColorsDetected();
|
||||
return true;
|
||||
}
|
||||
|
||||
if(options->type == FF_LOGO_TYPE_BUILTIN)
|
||||
return logoPrintBuiltinIfExists(instance, options->source.chars);
|
||||
return logoPrintBuiltinIfExists(options->source.chars);
|
||||
|
||||
if(options->type == FF_LOGO_TYPE_DATA)
|
||||
return logoPrintData(instance, true);
|
||||
return logoPrintData(true);
|
||||
|
||||
if(options->type == FF_LOGO_TYPE_DATA_RAW)
|
||||
return logoPrintData(instance, false);
|
||||
return logoPrintData(false);
|
||||
|
||||
updateLogoPath(instance); //We sure have a file, resolve relative paths
|
||||
updateLogoPath(); //We sure have a file, resolve relative paths
|
||||
|
||||
if(options->type == FF_LOGO_TYPE_FILE)
|
||||
return logoPrintFileIfExists(instance, true, false);
|
||||
return logoPrintFileIfExists(true, false);
|
||||
|
||||
if(options->type == FF_LOGO_TYPE_FILE_RAW)
|
||||
return logoPrintFileIfExists(instance, false, false);
|
||||
return logoPrintFileIfExists(false, false);
|
||||
|
||||
if(options->type == FF_LOGO_TYPE_IMAGE_RAW)
|
||||
{
|
||||
@@ -384,54 +384,54 @@ static bool logoTryKnownType(FFinstance* instance)
|
||||
return false;
|
||||
}
|
||||
|
||||
return logoPrintFileIfExists(instance, false, true);
|
||||
return logoPrintFileIfExists(false, true);
|
||||
}
|
||||
|
||||
return logoPrintImageIfExists(instance, options->type, true);
|
||||
return logoPrintImageIfExists(options->type, true);
|
||||
}
|
||||
|
||||
static void logoPrintKnownType(FFinstance* instance)
|
||||
static void logoPrintKnownType(void)
|
||||
{
|
||||
if(!logoTryKnownType(instance))
|
||||
logoPrintDetected(instance);
|
||||
if(!logoTryKnownType())
|
||||
logoPrintDetected();
|
||||
}
|
||||
|
||||
void ffLogoPrint(FFinstance* instance)
|
||||
void ffLogoPrint(void)
|
||||
{
|
||||
//In pipe mode, we don't have a logo or padding.
|
||||
//We also don't need to set main color, because it won't be printed anyway.
|
||||
//So we can return quickly here.
|
||||
if(instance->config.pipe)
|
||||
if(instance.config.pipe)
|
||||
{
|
||||
instance->state.logoHeight = 0;
|
||||
instance->state.logoWidth = 0;
|
||||
instance.state.logoHeight = 0;
|
||||
instance.state.logoWidth = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
const FFLogoOptions* options = &instance->config.logo;
|
||||
const FFLogoOptions* options = &instance.config.logo;
|
||||
|
||||
//If the source is not set, we can directly print the detected logo.
|
||||
if(options->source.length == 0)
|
||||
{
|
||||
logoPrintDetected(instance);
|
||||
logoPrintDetected();
|
||||
return;
|
||||
}
|
||||
|
||||
//If the source and source type is set to something else than auto, always print with the set type.
|
||||
if(options->source.length > 0 && options->type != FF_LOGO_TYPE_AUTO)
|
||||
{
|
||||
logoPrintKnownType(instance);
|
||||
logoPrintKnownType();
|
||||
return;
|
||||
}
|
||||
|
||||
//If source matches the name of a builtin logo, print it and return.
|
||||
if(logoPrintBuiltinIfExists(instance, options->source.chars))
|
||||
if(logoPrintBuiltinIfExists(options->source.chars))
|
||||
return;
|
||||
|
||||
//Make sure the logo path is set correctly.
|
||||
updateLogoPath(instance);
|
||||
updateLogoPath();
|
||||
|
||||
const FFTerminalShellResult* terminalShell = ffDetectTerminalShell(instance);
|
||||
const FFTerminalShellResult* terminalShell = ffDetectTerminalShell();
|
||||
|
||||
//Terminal emulators that support kitty graphics protocol.
|
||||
bool supportsKitty =
|
||||
@@ -441,48 +441,48 @@ void ffLogoPrint(FFinstance* instance)
|
||||
ffStrbufIgnCaseCompS(&terminalShell->terminalProcessName, "wayst") == 0;
|
||||
|
||||
//Try to load the logo as an image. If it succeeds, print it and return.
|
||||
if(logoPrintImageIfExists(instance, supportsKitty ? FF_LOGO_TYPE_IMAGE_KITTY : FF_LOGO_TYPE_IMAGE_CHAFA, false))
|
||||
if(logoPrintImageIfExists(supportsKitty ? FF_LOGO_TYPE_IMAGE_KITTY : FF_LOGO_TYPE_IMAGE_CHAFA, false))
|
||||
return;
|
||||
|
||||
//Try to load the logo as a file. If it succeeds, print it and return.
|
||||
if(logoPrintFileIfExists(instance, true, false))
|
||||
if(logoPrintFileIfExists(true, false))
|
||||
return;
|
||||
|
||||
logoPrintDetected(instance);
|
||||
logoPrintDetected();
|
||||
}
|
||||
|
||||
void ffLogoPrintLine(FFinstance* instance)
|
||||
void ffLogoPrintLine(void)
|
||||
{
|
||||
if(instance->state.logoWidth > 0)
|
||||
printf("\033[%uC", instance->state.logoWidth);
|
||||
if(instance.state.logoWidth > 0)
|
||||
printf("\033[%uC", instance.state.logoWidth);
|
||||
|
||||
++instance->state.keysHeight;
|
||||
++instance.state.keysHeight;
|
||||
}
|
||||
|
||||
void ffLogoPrintRemaining(FFinstance* instance)
|
||||
void ffLogoPrintRemaining(void)
|
||||
{
|
||||
while(instance->state.keysHeight <= instance->state.logoHeight)
|
||||
while(instance.state.keysHeight <= instance.state.logoHeight)
|
||||
{
|
||||
ffLogoPrintLine(instance);
|
||||
ffLogoPrintLine();
|
||||
putchar('\n');
|
||||
}
|
||||
}
|
||||
|
||||
void ffLogoBuiltinPrint(FFinstance* instance)
|
||||
void ffLogoBuiltinPrint(void)
|
||||
{
|
||||
GetLogoMethod* methods = ffLogoBuiltinGetAll();
|
||||
FFLogoOptions* options = &instance->config.logo;
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
|
||||
while(*methods != NULL)
|
||||
{
|
||||
const FFlogo* logo = (*methods)();
|
||||
printf("\033[%sm%s:\033[0m\n", logo->builtinColors[0], logo->names[0]);
|
||||
logoPrintStruct(instance, logo);
|
||||
ffLogoPrintRemaining(instance);
|
||||
logoPrintStruct(logo);
|
||||
ffLogoPrintRemaining();
|
||||
|
||||
//reset everything
|
||||
instance->state.logoHeight = 0;
|
||||
instance->state.keysHeight = 0;
|
||||
instance.state.logoHeight = 0;
|
||||
instance.state.keysHeight = 0;
|
||||
for(uint8_t i = 0; i < FASTFETCH_LOGO_MAX_COLORS; i++)
|
||||
ffStrbufClear(&options->colors[i]);
|
||||
|
||||
@@ -491,7 +491,7 @@ void ffLogoBuiltinPrint(FFinstance* instance)
|
||||
}
|
||||
}
|
||||
|
||||
void ffLogoBuiltinList()
|
||||
void ffLogoBuiltinList(void)
|
||||
{
|
||||
GetLogoMethod* methods = ffLogoBuiltinGetAll();
|
||||
|
||||
@@ -516,7 +516,7 @@ void ffLogoBuiltinList()
|
||||
}
|
||||
}
|
||||
|
||||
void ffLogoBuiltinListAutocompletion()
|
||||
void ffLogoBuiltinListAutocompletion(void)
|
||||
{
|
||||
GetLogoMethod* methods = ffLogoBuiltinGetAll();
|
||||
|
||||
|
||||
+3
-3
@@ -17,19 +17,19 @@ typedef struct FFlogo
|
||||
typedef const FFlogo*(*GetLogoMethod)();
|
||||
|
||||
//logo.c
|
||||
void ffLogoPrintChars(FFinstance* instance, const char* data, bool doColorReplacement);
|
||||
void ffLogoPrintChars(const char* data, bool doColorReplacement);
|
||||
|
||||
//builtin.c
|
||||
const FFlogo* ffLogoBuiltinGetUnknown();
|
||||
GetLogoMethod* ffLogoBuiltinGetAll();
|
||||
|
||||
//image/image.c
|
||||
bool ffLogoPrintImageIfExists(FFinstance* instance, FFLogoType type, bool printError);
|
||||
bool ffLogoPrintImageIfExists(FFLogoType type, bool printError);
|
||||
|
||||
//option.c
|
||||
void ffInitLogoOptions(FFLogoOptions* options);
|
||||
bool ffParseLogoCommandOptions(FFLogoOptions* options, const char* key, const char* value);
|
||||
void ffDestroyLogoOptions(FFLogoOptions* options);
|
||||
const char* ffParseLogoJsonConfig(FFinstance* instance);
|
||||
const char* ffParseLogoJsonConfig();
|
||||
|
||||
#endif
|
||||
|
||||
+3
-3
@@ -189,11 +189,11 @@ void ffDestroyLogoOptions(FFLogoOptions* options)
|
||||
ffStrbufDestroy(&options->colors[i]);
|
||||
}
|
||||
|
||||
const char* ffParseLogoJsonConfig(FFinstance* instance)
|
||||
const char* ffParseLogoJsonConfig(void)
|
||||
{
|
||||
FFLogoOptions* options = &instance->config.logo;
|
||||
FFLogoOptions* options = &instance.config.logo;
|
||||
|
||||
yyjson_val* const root = yyjson_doc_get_root(instance->state.configDoc);
|
||||
yyjson_val* const root = yyjson_doc_get_root(instance.state.configDoc);
|
||||
assert(root);
|
||||
|
||||
if (!yyjson_is_obj(root))
|
||||
|
||||
Reference in New Issue
Block a user