Skip to content

Conversation

CarterLi
Copy link
Member

@CarterLi CarterLi commented Oct 16, 2021

Used logic from https://github.com/dylanaraps/neofetch/blob/master/neofetch#L3293

As for

    if(result->terminalProcessName.length == 0)
        ffStrbufAppendS(&result->terminalProcessName, term);

Since we can only get here when terminalProcessName equals to login systemd init 0, we should always use a better name

Result (with patch applied):
image

@LinusDierheimer
Copy link
Collaborator

What happens when SSH_CONNECTION is set, but SSH_TTY is not, or empty?

@CarterLi
Copy link
Member Author

What happens when SSH_CONNECTION is set, but SSH_TTY is not, or empty?

How can it happen?

@LinusDierheimer
Copy link
Collaborator

LinusDierheimer commented Oct 17, 2021

I don't know, but during development of this project i learned that everything is possible. Just do something like this:

char* term;

//SSH
if(getnev("SSH_CONNECTION") != NULL)
    term = getenv("SSH_TTY");

//Windows Terminal
if((term == NULL || *term == '\0') && getenv("WT_SESSION") != NULL)
    term = "Windows Terminal";

//Normal Terminal
if(term == NULL || *term == '\0')
    term = getenv("TERM");

//TTY
if(term == NULL || *term == '\0' || strcasecmp(term, "linux") == 0)
    term = ttyname(STDIN_FILENO);

@LinusDierheimer
Copy link
Collaborator

Thanks for figuring out. Ignore codefactor complaining about complex method.

@LinusDierheimer LinusDierheimer merged commit 5f0c5a0 into fastfetch-cli:master Oct 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants