fastfetch-cli / fastfetch

An actively maintained, feature-rich and performance oriented, neofetch like system information tool.
MIT License
9.74k stars 390 forks source link

[Question] Still trying to understand/familiarize new config, how to set user@host to custom@string ??? #710

Closed sudoshindo closed 7 months ago

sudoshindo commented 7 months ago

I recently migrated my old conf file using the --migrate-config flag.

In the old config I remember that I was able to override the user@host part of the output with my own specified string.

Like for example changing john@linux to bob@linux.

I'm still not used to the new config and unsure how to do that.

My current config.jsonc, v2.2.3 (latest available version on Fedora 39)

{
  "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
  "logo": {
    "color": {
      "1": "38;5;27",
      "2": "38;5;255"
    }
  },
  "display": {
    "color": "38;5;39"
  },
  "modules": [
    "title",
    "separator",
    {
      "type": "os",
      "format": "{2} {9}"
    },
    {
      "type": "host",
      "format": "{2} {3}"
    },
    {
      "type": "kernel",
      "format": "{2}"
    },
    {
      "type": "uptime",
      "format": "{2}h {3}m"
    },
    "packages",
    {
      "type": "shell",
      "format": "{6} {4}"
    },
    {
      "type": "display",
      "key": "Display",
      "format": "{1}x{2}"
    },
    {
      "type": "de",
      "format": "{2} {3}"
    },
    "theme",
    "icons",
    {
      "type": "terminal",
      "format": "{5}"
    },
    {
      "type": "cpu",
      "format": "{1}"
    },
    {
      "type": "gpu",
      "format": "{1} {2}"
    },
    {
      "type": "memory",
      "format": "{1} / {2}"
    },
    "break",
    "colors",
    "break"
  ]
}
CarterLi commented 7 months ago

Maybe

{
    "type": "title",
    "format": "bob{7}{8}"
}

See fastfetch --help title-format for detail

sudoshindo commented 7 months ago

Okay, that does seem to work, but I guess fastfetch won't use the appropriate color on the custom string you specify.

Screenshot_2024 02 05_154349

Screenshot_2024 02 05_155353

CarterLi commented 7 months ago

You should use \u001b in JSON. Try \u001b[38;5;39m

sudoshindo commented 7 months ago

Okay, I got what I wanted with this "format": "\u001b[38;5;39m\u001b[1mbob\u001b[0m{7}{8}". Sets the color, makes it bold, undo the formatting before printing @.

I want to ask this though, would you be opposed to implementing config overrides for the user and host strings? Would that be too niche of a use-case since I'm the only one you encountered that tried to do this?

I would imagine it would look something like this:

{
  "modules": [
    {
      "type": "title",
      "overrides": {
        "host": "windows",
        "user": "bob"
      },
      "format": "{6}{7}{8}"
    }
  ]
}
sudoshindo commented 7 months ago

If I had to think of a reason why other people would use this option, it's just to customize the presentation of their outputs. These fetch utilities are mostly seen in unixporn screenshots after all, and those guys love presentation.

My personal reason for doing this is privacy, sometimes I don't want to show the default username that's set on my system.

CarterLi commented 7 months ago

No, I don't like the idea.

If you really want to change the username that fastfetch detected, you may use USER=bob fastfetch.

sudoshindo commented 7 months ago

No, I don't like the idea.

Very understandable.

you may use USER=bob fastfetch

This is way simpler, thanks. I could put this in an alias or function that overrides fastfetch.