fastfetch-cli / fastfetch

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

How to shorten the theme name? #728

Closed CarterLi closed 2 months ago

CarterLi commented 7 months ago

Discussed in https://github.com/fastfetch-cli/fastfetch/discussions/724

Originally posted by **SherLock707** February 18, 2024 My current theme name looks like this: ![image](https://github.com/fastfetch-cli/fastfetch/assets/26952545/be2918d1-fac9-4cc9-a3fe-bb03b7e3a4e6) my jsonc: ` { "type": "theme", "key": " 󰉼" },` `"format": "{1}"` or any other index does not give me a shorten version of the name. How do I shorten this without manually hard-coding theme name?
kojq commented 6 months ago

It does not seem needed. If it is, perhaps indicating upon which dash to perform string manipulation for a theme:

0 for no string 1 for Catppuccin [GTK2/3] (truncate from first dash instance) 2 for Catppuccin-Mocha [GTK2/3] 3 for Catppuccin-Mocha-Standard [GTK2/3] 50 for Catppuccin-Mocha-Standard-Mauve-Dark [GTK2/3] (out of bounds, but since 50th dash doesn't exist, leave as is)

buufmax commented 3 months ago

I Use KDE/QT, I would also like to cut some settings from themes and icons.

{
      "type": "theme",
      "key": "Theme",
      "format": "{1}",
      "keyColor": "white"
},
From: Papirus-Dark [QT], Papirus-Dark [GTK2/3/4]
To:   Papirus-Dark [QT]
From: Breeze (Monochrome) [QT], Breeze-Dark [GTK2], Breeze [GTK3]
To:   Breeze (Monochrome) [QT]

I wish you implement it and give us on KDE this opportunity.

CarterLi commented 3 months ago

@niri-san Done in the dev branch

buufmax commented 3 months ago

@CarterLi, Please make sure also Font to be included, something to "Font - Ink Free (10pt) [QT]" I want to reach it with similar code

   {
      "type": "font",
      "key": "Font",
      "format": "{1}",
      "keyColor": "blue"
   },

I haven't tested the dev branch yet, but once you make a release, also my distro openSUSE Tumbleweed enable it in its repository, I will test it. Thanks for looking at it.

CarterLi commented 3 months ago

Font should have been supported in current release

buufmax commented 3 months ago

Indeed it is supported on current release, but is missing that [QT]

With "format": "{1}" display as, Screenshot_20240606_195140

While without format string it display as: Screenshot_20240606_195421

All in all, wish it to be displayed as FONT - Ink Free (10pt) [QT]

CarterLi commented 3 months ago

"format": "{1} [QT]"

buufmax commented 3 months ago

Ok, I'm setting it manually by hand. Since we are here, I found out that in TTY Font does not appear. Please check when you are on TTY.

   {
      "type": "font",
      "key": "Font",
      "format": "{1} [QT]",
      "keyColor": "blue"
   },

20240607_074602

CarterLi commented 3 months ago

TTY font should be in terminalfont module.

CarterLi commented 3 months ago

Fastfetch "format" supports a syntax that you can write simple if-else in it. See fastfetch -h format

buufmax commented 3 months ago

Okay, I'm looking at doing something manually.

I just tested the latest version 2.15.0 from fastfetch-linux-amd64.zip Everything seems fine, this ticket/issue seems completed and you may close it if there are no other things.

Thank you for your fast assistance.

CarterLi commented 3 months ago

Would you mind share your config file to add it into presets/examples?

buufmax commented 3 months ago

With Pleasure. I have not finally finished yet. However, there is enough data allready.

P.S. I just jumped in fastfetch from a neofetch (fork), I am honestly surprised by the speed and the many possibilities of extracting information. This preset all.jsonc has helped me a lot.

Many thanks for puting your soul into this amazing project.

//   _____ _____ _____ _____ _____ _____ _____ _____ _____
//  |   __|  _  |   __|_   _|   __|   __|_   _|     |  |  |
//  |   __|     |__   | | | |   __|   __| | | |   --|     |
//  |__|  |__|__|_____| |_| |__|  |_____| |_| |_____|__|__|
//
//  By CarterLi - https://github.com/CarterLi
//  Homepage - https://github.com/fastfetch-cli/fastfetch
//  config.jsonc - ニリ
//  pokemon-colorscripts - https://gitlab.com/phoneybadger/pokemon-colorscripts

{
      "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
      "logo": {
      "source": "$(ls ~/.config/fastfetch/colorscripts/large/regular/* | shuf -n 1)",
      "padding": {
      "top": 1,
      "left": 2,
      "right": 3
   }
},

"display":  {
      "separator": " - "
   },

"modules": [
   {
      "type": "custom",
   },
   {
      "type": "custom", // HardwareInfo
      "format": "• \u001b[32mSYSTEM INFORMATION\u001b[0m"
   },
   {
      "type": "host",
      "key": "HOST",
      "format": "{?2}{2}{?}{?5} ({5}){?}",
      "keyColor": "green"
   },
   {
      "type": "chassis",
      "key": "COMPUTER TYPE",
      "format": "{?1}{1}{?}{?2}",
      "keyColor": "green"
   },
   {
      "type": "cpu",
      "key": "CPU",
      "keyColor": "green"
   },
   {
      "type": "gpu",
      "key": "GPU",
      "keyColor": "green"
   },
   {
      "type": "memory",
      "key": "MEMORY USED",
      "keyColor": "green"
   },
   {
      "type": "swap",
      "key": "SWAP USED",
      "keyColor": "green"
   },
   {
      "type": "disk",
      "key": "DISK",
      "folders": "/",
      "keyColor": "green"
   },
   {
      "type": "custom", // SoftwareInfo
      "format": "• \u001b[31mSOFTWARE INFORMATION\u001b[0m"
   },
   {
      "type": "os",
      "key": "DISTRO",
      "keyColor": "red"
   },
   {
      "type": "command",
      "text": "ls -lact --full-time /etc |awk 'END {print $6}'",
      "key": "INSTALLED DATE",
      "keyColor": "red"
   },
   {
      "type": "kernel",
      "key": "KERNEL",
      "format": "{2}",
      "keyColor": "red"
   },
   {
      "type": "packages",
      "key": "PACKAGES",
      "keyColor": "red"
   },
   {
      "type": "uptime",
      "key": "UPTIME",
      "keyColor": "red"
   },
   {
      "type": "custom", // DisplayInfo
      "format": "• \u001b[34mDISPLAY INFORMATION\u001b[0m"
   },
   {
      "type": "de",
      "key": "DESKTOP ENVIRONMENT",
      "format": "{2} {3}",
      "keyColor": "blue"
   },
   {
      "type": "lm",
      "key": "LOGIN MANAGER",
      "format": "{2}",
      "keyColor": "blue"
   },
   {
      "type": "wm",
      "key": "WM",
      "format": "{2} ({3})",
      "keyColor": "blue"
   },
   {
      "type": "wmtheme",
      "key": "WM THEME",
      "keyColor": "blue"
   },
   {
      "type": "display",
      "key": "MONITOR",
      "format": "{6}",
      "keyColor": "blue"
   },
   {
      "type": "monitor",
      "key": "RESOLUTION",
      "keyColor": "blue"
   },
   {
      "type": "custom", // DesignInfo
      "format": "• \u001b[33mDESIGN INFORMATION\u001b[0m"
   },
   {
      "type": "wallpaper",
      "key": "WALLPAPER",
      "keyColor": "yellow"
   },
   {
      "type": "theme",
      "key": "KDE THEME",
      "format": "{1}",
      "keyColor": "yellow"
   },
   {
      "type": "icons",
      "key": "ICON THEME",
      "format": "{1}",
      "keyColor": "yellow"
   },
   {
      "type": "font",
      "key": "FONT",
      "format": "{1} [QT]",
      "keyColor": "yellow"
   },
   {
      "type": "terminalfont",
      "key": "TERMINAL FONT",
      "format": "{1} [QT]",
      "keyColor": "yellow"
   },
   {
      "type": "cursor",
      "key": "CURSOR",
      "keyColor": "yellow"
   },
   {
      "type": "custom", // OtherInfo
      "format": "• \u001b[36mVARIOUS INFORMATION\u001b[0m"
   },
   {
      "type": "media",
      "key": "NOW PLAYING",
      "format": "{3} - {2}",
      "keyColor": "cyan"
   },
   {
      "type": "weather",
      "key": "WEATHER",
      "timeout": 1000,
      "keyColor": "cyan"
   },
   {
      "type": "version",
      "key": "INFO",
      "keyColor": "cyan"
   },
      "break",
      "colors",
      "break",
      "break"
    ]
}
CarterLi commented 3 months ago

Did a little clean up

image
//   _____ _____ _____ _____ _____ _____ _____ _____ _____
//  |   __|  _  |   __|_   _|   __|   __|_   _|     |  |  |
//  |   __|     |__   | | | |   __|   __| | | |   --|     |
//  |__|  |__|__|_____| |_| |__|  |_____| |_| |_____|__|__|
//
//  By CarterLi - https://github.com/CarterLi
//  Homepage - https://github.com/fastfetch-cli/fastfetch
//  config.jsonc - ニリ
//  pokemon-colorscripts - https://gitlab.com/phoneybadger/pokemon-colorscripts
{
    "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
    "logo": {
        "source": " _____ _____ _____ _____ _____ _____ _____ _____ _____\n|   __|  _  |   __|_   _|   __|   __|_   _|     |  |  |\n|   __|     |__   | | | |   __|   __| | | |   --|     |\n|__|  |__|__|_____| |_| |__|  |_____| |_| |_____|__|__|",
        "type": "data",
        "separate": true,
        "padding": {
            "right": 2
        }
    },
    "display": {
        "separator": " - "
    },
    "modules": [
        {
            "type": "custom", // HardwareInfo
            "format": "• {#green}SYSTEM INFORMATION"
        },
        {
            "type": "host",
            "key": "HOST",
            "format": "{name}{?vendor} ({vendor}){?}",
            "keyColor": "green"
        },
        {
            "type": "chassis",
            "key": "COMPUTER TYPE",
            "keyColor": "green"
        },
        {
            "type": "cpu",
            "key": "CPU",
            "keyColor": "green"
        },
        {
            "type": "gpu",
            "key": "GPU",
            "keyColor": "green"
        },
        {
            "type": "memory",
            "key": "MEMORY USED",
            "keyColor": "green"
        },
        {
            "type": "swap",
            "key": "SWAP USED",
            "keyColor": "green"
        },
        {
            "type": "disk",
            "key": "DISK",
            "folders": "/",
            "keyColor": "green"
        },
        {
            "type": "custom", // SoftwareInfo
            "format": "• {#red}SOFTWARE INFORMATION"
        },
        {
            "type": "os",
            "key": "DISTRO",
            "keyColor": "red"
        },
        {
            "type": "disk",
            "folders": "/", // Use "/System/Volumes/VM" or something else on macOS
            "format": "{create-time}",
            "key": "INSTALLED DATE",
            "keyColor": "red"
        },
        {
            "type": "kernel",
            "key": "KERNEL",
            "keyColor": "red"
        },
        {
            "type": "packages",
            "key": "PACKAGES",
            "keyColor": "red"
        },
        {
            "type": "uptime",
            "key": "UPTIME",
            "keyColor": "red"
        },
        {
            "type": "custom", // DisplayInfo
            "format": "• {#blue}DISPLAY INFORMATION"
        },
        {
            "type": "de",
            "key": "DESKTOP ENVIRONMENT",
            "keyColor": "blue"
        },
        {
            "type": "lm",
            "key": "LOGIN MANAGER",
            "format": "{type}",
            "keyColor": "blue"
        },
        {
            "type": "wm",
            "key": "WM",
            "keyColor": "blue"
        },
        {
            "type": "wmtheme",
            "key": "WM THEME",
            "keyColor": "blue"
        },
        {
            "type": "monitor",
            "key": "MONITOR ({name})",
            "keyColor": "blue"
        },
        {
            "type": "custom", // DesignInfo
            "format": "• {#yellow}DESIGN INFORMATION"
        },
        {
            "type": "wallpaper",
            "key": "WALLPAPER",
            "keyColor": "yellow"
        },
        {
            "type": "theme",
            "key": "KDE THEME",
            "format": "{1}",
            "keyColor": "yellow"
        },
        {
            "type": "icons",
            "key": "ICON THEME",
            "format": "{1}",
            "keyColor": "yellow"
        },
        {
            "type": "font",
            "key": "FONT",
            "format": "{?1}{1} [QT]{?}{/1}Unknown", // Remove "[QT]" if not using Qt
            "keyColor": "yellow"
        },
        {
            "type": "terminalfont",
            "key": "TERMINAL FONT",
            "keyColor": "yellow"
        },
        {
            "type": "cursor",
            "key": "CURSOR",
            "keyColor": "yellow"
        },
        {
            "type": "custom", // OtherInfo
            "format": "• {#cyan}VARIOUS INFORMATION"
        },
        {
            "type": "media",
            "key": "NOW PLAYING",
            "format": "{?artist}{artist} - {?}{title}",
            "keyColor": "cyan"
        },
        {
            "type": "weather",
            "key": "WEATHER",
            "timeout": 1000,
            "keyColor": "cyan"
        },
        {
            "type": "version",
            "key": "INFO",
            "keyColor": "cyan"
        },
        "break",
        "colors",
        "break"
    ]
}
CarterLi commented 3 months ago

Added

CarterLi commented 2 months ago

1043 should fix this issue