Closed asrmarco13 closed 1 year ago
Does sleep 0.5
work?
In addition, you can always set --logo-width
and --logo-height
to bypass the getCharacterPixelDimensions()
function
Does
sleep 0.5
work?In addition, you can always set
--logo-width
and--logo-height
to bypass thegetCharacterPixelDimensions()
function
Hi @CarterLi , I followed your instructions.
If I use sleep 0.5
or --logo-width
or --logo-height
sometimes the logo appears and sometimes not.
What's wrong?
@LinusDierheimer Do you have some ideas?
I have wrote a small c program, to debug this. Can you compile and run it?
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include <termios.h>
#include <poll.h>
#include <sys/ioctl.h>
void ffGetTerminalResponse(const char* request, const char* format, ...)
{
struct termios oldTerm, newTerm;
if(tcgetattr(STDIN_FILENO, &oldTerm) == -1)
return;
newTerm = oldTerm;
newTerm.c_lflag &= (tcflag_t) ~(ICANON | ECHO);
if(tcsetattr(STDIN_FILENO, TCSANOW, &newTerm) == -1)
return;
fputs(request, stdout);
fflush(stdout);
struct pollfd pfd;
pfd.fd = STDIN_FILENO;
pfd.events = POLLIN;
pfd.revents = 0;
//Give the terminal 35ms to respond
if(poll(&pfd, 1, 500) <= 0)
{
tcsetattr(STDIN_FILENO, TCSANOW, &oldTerm);
return;
}
char buffer[512];
ssize_t readed = read(STDIN_FILENO, buffer, sizeof(buffer) - 1);
tcsetattr(STDIN_FILENO, TCSANOW, &oldTerm);
if(readed <= 0)
return;
buffer[readed] = '\0';
va_list args;
va_start(args, format);
vsscanf(buffer, format, args);
va_end(args);
}
static void printWinsize(struct winsize* win)
{
printf("winsize.ws_row: %hu\n", win->ws_row);
printf("winsize.ws_col: %hu\n", win->ws_col);
printf("winsize.ws_ypixel: %hu\n", win->ws_ypixel);
printf("winsize.ws_xpixel: %hu\n", win->ws_xpixel);
}
int main()
{
struct winsize winsize;
memset(&winsize, 0, sizeof(struct winsize));
ioctl(STDOUT_FILENO, TIOCGWINSZ, &winsize);
printWinsize(&winsize);
putchar('\n');
memset(&winsize, 0, sizeof(struct winsize));
ffGetTerminalResponse("\033[18t", "\033[8;%hu;%hut", &winsize.ws_row, &winsize.ws_col);
ffGetTerminalResponse("\033[14t", "\033[4;%hu;%hut", &winsize.ws_ypixel, &winsize.ws_xpixel);
printWinsize(&winsize);
}
@CarterLi BTW, this is the output within konsole
on my machine:
winsize.ws_row: 84
winsize.ws_col: 319
winsize.ws_ypixel: 1438
winsize.ws_xpixel: 2558
winsize.ws_row: 84
winsize.ws_col: 319
winsize.ws_ypixel: 1428
winsize.ws_xpixel: 2552
Slightly different values between ioctl and the escape sequences... Maybe this is causing the bugs with wrong calculated height. The difference gets even bigger when i enable tabbing:
winsize.ws_row: 82
winsize.ws_col: 319
winsize.ws_ypixel: 1405
winsize.ws_xpixel: 2558
winsize.ws_row: 82
winsize.ws_col: 319
winsize.ws_ypixel: 1394
winsize.ws_xpixel: 2552
Hi @LinusDierheimer , I run your program on my KDE Terminal Emulator (my default terminal):
> gcc fastefecth.c -o fastefecth && "/home/marcoorfei/"fastefecth
winsize.ws_row: 28
winsize.ws_col: 110
winsize.ws_ypixel: 728
winsize.ws_xpixel: 1326
winsize.ws_row: 28
winsize.ws_col: 110
winsize.ws_ypixel: 728
winsize.ws_xpixel: 1320
Tested on a VM, but I get the same results on physical machines...
I can still explain that there are compatibility problems with the kde konsole. but the output of the gnome terminal makes no sense to me.
It makes sense. Gnome terminal doesnt support the image protocol, thats all.
And AFAIK, Gnome terminal doesnt support any image protocols
The terminal support of image protocols varies greatly, since its a non-standard thing.
As for the preferred image protocol to use, kitty (with png) > iterm > others, and always use them with --logo-width and --logo-height specified
Hi LinusDierheimer, I run your program on my KDE Terminal Emulator (my default terminal)
This is really weird, it gets enough data to not fail. Fastfetch uses pretty much the same code, i don't have an idea why it doesn't work there
Tested on a VM, but I get the same results on physical machines...
Gnome terminal doesn't support any image protocol, thats why it looks the way it does.
Konsole is weird here. It does support both ways of getting the sizes. Is everything up to date in your installation? My outputs are from konsole too.
I can't reproduce this issue in the latest version of konsole (23.04.3) and I assume it was a terminal bug in old konsole versions. If you can reproduce it in konsole version 23.04.3 or later, please open a new issue.
Closing as stale.
Hello everyone. Few months ago I switch to Garuda Linux. I use Konsole as a terminal and my default shell is ZSH (with oh-my-zsh framework and powerlevel10k for theme). How to happens with the Fish Shell when opening the terminal, I want to replicate the same thing with ZSH shell using Fastfetch. I added the following lines to my .zshrc config file like fish .config file:
When i run the command:
I get everything working fine (I see the correct Garuda Dr460nized logo and informations).
But when I open a new terminal session I have the following error:
and the Garuda logo is not visible (informations displayed are correctly).
How can I fix it? Has anyone had the same problem as me and solved it?
Output of
fastfetch --version
:Output of
fastfetch --load-config devinfo
:Output of
fastfetch --load-config devinfo-verbose
:Output of
fastfetch --list-features
:Another information: Fastfetch is installed by default on Garuda Linux and function correctly with Fish