diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b3116368..4acf4ef62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,7 @@ function(fastfetch_load_text FILENAME OUTVAR) set("${OUTVAR}" "${TEMP}" PARENT_SCOPE) endfunction(fastfetch_load_text) +fastfetch_load_text(src/data/structure.txt DATATEXT_STRUCTURE) fastfetch_load_text(src/data/config.txt DATATEXT_CONFIG) fastfetch_load_text(src/data/modules.txt DATATEXT_MODULES) fastfetch_load_text(src/data/help.txt DATATEXT_HELP) diff --git a/completions/bash b/completions/bash index 2a6d0a04b..fa02bdb95 100644 --- a/completions/bash +++ b/completions/bash @@ -99,12 +99,12 @@ __fastfetch_completion() "-v" "--version" "--list-logos" + "--list-modules" + "--list-presets" + "--list-features" "--print-logos" - "--print-default-config" - "--print-default-structure" - "--print-available-modules" - "--print-available-presets" - "--list-supported-features" + "--print-config" + "--print-structure" ) local FF_OPTIONS_HELP=( diff --git a/presets/all b/presets/all new file mode 100644 index 000000000..fa3ba4398 --- /dev/null +++ b/presets/all @@ -0,0 +1 @@ +--structure Title:Separator:OS:Host:Kernel:Uptime:Processes:Packages:Shell:Resolution:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:GPU:Memory:Disk:Battery:LocalIP:Locale:Break:Colors diff --git a/src/data/config.txt b/src/data/config.txt index b1261db46..2a1b82588 100644 --- a/src/data/config.txt +++ b/src/data/config.txt @@ -3,6 +3,96 @@ # Direct arguments will overwrite the corresponding ones in this file. # Whitespaces are trimmed at the beginning and the end. # Empty lines or lines starting with # are ignored. -# There are more arguments possible than the ones listed here, take a look at fastfetch --help + # This file was shipped with $"FASTFETCH_PROJECT_VERSION$". -# Use fastfetch --print-default-config > ~/.config/fastfetch/config.conf to generate a new one with current default +# Use fastfetch --print-config > ~/.config/fastfetch/config.conf to generate the current default one + +# Below some options are listed. Uncomment and modify them so they take affect. +# Note that there are a lot more options than listed here, take a look at "fastfetch --help". +# Notably all the --*-format and --*-key options are missing. +# Of course all of the can be made persistent here too. + +# Config option: +# Load additional config files. +# Some are shipped with fastfetch, list them with "fastfetch --list-presets". +# Must be a path to a config file or the name of a shipped preset. +# The config file is completly loaded before continuing in the current file, so the placement of this option matters, as later options overwrite already set ones. +# Can be used multiple times to load multiple config files / presets. +#--load-config /path/to/config.txt + +# Structure option: +# Sets the modules to use and their order. +# List available modules with "fastfetch --list-modules". +# Get the default structure with "fastfetch --print-structure". +# Must be a list of module names, separated by colons. +# Default is $"FASTFETCH_DATATEXT_STRUCTURE$". +#--structure $"FASTFETCH_DATATEXT_STRUCTURE$" + +# Logo option: +# Sets the logo to use. +# List available logos with "fastfetch --list-logos". +# Print available logos with "fastfetch --print-logos". +# Must be the name of an available logo or a path to a text file containing a custom logo. +# Default is the current distribution. +#--logo arch + +# Color option: +# Sets the color of the keys. +# Must be linux console color codes. +# Default is the primary color of the logo. +# Use "fastfetch --help color" to learn more and see examples. +#--color 35 + +# Spacing option: +# Sets the amount of whitespace between the logo and keys. +# Must be an positive integer. +# Default is 4. +#--spacing 4 + +# Separator option: +# Sets the string placed between a key and its value. +# Can be any string. +# Default is ": ". +#--separator ": " + +# Offset option: +# Sets the amount of whitespace before the logo. Can be negative to cut the logo. +# Must be an integer. +# Default is 0. +#--offsetx 0 + +# Linewrap option: +# Sets if fastfetch should disable linewrap during the run. +# Must be true or false. +# Default is true. +#--disable-linewrap true + +# Cursor option: +# Sets if fastfetch should hide the console cursor during the run. +# Must be true or false. +# Default is true. +#--hide-cursor true + +# Remaing logo option: +# Sets if the remaining logo should be printed, if it is higher than the information printed. +# Must be true or false. +# Default is true. +#--print-remaining-logo true + +# Multithreading option: +# Sets if fastfetch should use multiple threads to detect the values. +# Must be true or false. +# Default is true. +#--multithreading true + +# Slow operations option: +# Sets if fastfetch is allowed to use known slow operations to detect more / better values. +# Must be true or false. +# Default is false. +#--allow-slow-operations false + +# Color logo option: +# Sets if the logo should be colored. +# Must be true or false. +# Default is true. +#--color-logo true diff --git a/src/data/help.txt b/src/data/help.txt index 7fb0f4eeb..634163c86 100644 --- a/src/data/help.txt +++ b/src/data/help.txt @@ -1,19 +1,19 @@ Usage: fastfetch Informative options: - -h, --help: shows this message and exits - -h , --help : shows help for a specific command and exits - -v --version: prints the version of fastfetch and exits - --list-logos: list available logos and exits - --print-logos: shows available logos and exits - --print-default-config: prints the default config and exits - --print-default-structure: prints the default stucture and exits - --print-available-modules: prints a list of available modules and exits - --print-available-presets: list presets fastfetch knows about. They can be loaded with --load-config. (+) - --list-supported-features: list the supported features fastfetch was compiled with. Mainly for development. + -h, --help: shows this message and exits + -h , --help : shows help for a specific command and exits + -v --version: prints the version of fastfetch and exits + --list-logos: list available logos and exits + --list-modules: lists available modules and exits + --list-presets: list presets fastfetch knows about and exits. They can be loaded with --load-config. (+) + --list-features: list the supported features fastfetch was compiled with and exits. Mainly for development. + --print-logos: show available logos and exits + --print-config: prints the default config and exits + --print-structure: prints the default stucture and exits General options: - --structure : sets the structure of the fetch. Must be a colon separated list of keys. Use --print-available-modules to show th + --structure : sets the structure of the fetch. Must be a colon separated list of keys. Use "fastfetch --list-modules" to see the ones available. --set : hard set the value of a key -c , --color : sets the color of the keys. Must be a linux console color code (+) --spacing : sets the distance between logo and text @@ -30,7 +30,7 @@ General options: --hide-cursor : Hide the cursor during the run Logo options: - -l , --logo : sets the shown logo. Also changes the main color accordingly. This will also load file contents as logo if the given argument + -l , --logo : sets the shown logo. Also changes the main color accordingly. This will also load file contents as logo if the given argument is a valid path. --color-logo : if set to false, the logo will be black / white Format options: Provide the format string for custom output. Use fastfetch --help *-format for specific help. diff --git a/src/data/structure.txt b/src/data/structure.txt new file mode 100644 index 000000000..f7b0006a8 --- /dev/null +++ b/src/data/structure.txt @@ -0,0 +1 @@ +Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Resolution:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:GPU:Memory:Disk:Battery:Locale:Break:Colors \ No newline at end of file diff --git a/src/fastfetch.c b/src/fastfetch.c index 31d89088d..f87ede772 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -8,8 +8,6 @@ #include #include -#define FASTFETCH_DEFAULT_STRUCTURE "Title:Separator:OS:Host:Kernel:Uptime:Packages:Shell:Resolution:DE:WM:WMTheme:Theme:Icons:Font:Cursor:Terminal:TerminalFont:CPU:GPU:Memory:Disk:Battery:Locale:Break:Colors" - // Things only needed by fastfetch typedef struct FFdata { @@ -522,27 +520,27 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con ffPrintLogos(instance); exit(0); } - else if(strcasecmp(key, "--print-default-config") == 0) + else if(strcasecmp(key, "--print-config") == 0) { fputs(FASTFETCH_DATATEXT_CONFIG, stdout); exit(0); } - else if(strcasecmp(key, "--print-default-structure") == 0) + else if(strcasecmp(key, "--print-structure") == 0) { - fputs(FASTFETCH_DEFAULT_STRUCTURE, stdout); + puts(FASTFETCH_DATATEXT_STRUCTURE); exit(0); } - else if(strcasecmp(key, "--print-available-modules") == 0) + else if(strcasecmp(key, "--list-modules") == 0) { fputs(FASTFETCH_DATATEXT_MODULES, stdout); exit(0); } - else if(strcasecmp(key, "--print-available-presets") == 0) + else if(strcasecmp(key, "--list-presets") == 0) { listAvailablePresets(instance); exit(0); } - else if(strcasecmp(key, "--list-supported-features") == 0) + else if(strcasecmp(key, "--list-features") == 0) { listSupportedFeatures(); exit(0); @@ -904,7 +902,7 @@ static void run(FFinstance* instance, FFdata* data) ffStartDetectionThreads(instance); if(data->structure.length == 0) - ffStrbufSetS(&data->structure, FASTFETCH_DEFAULT_STRUCTURE); + ffStrbufSetS(&data->structure, FASTFETCH_DATATEXT_STRUCTURE); ffStart(instance); diff --git a/src/fastfetch_config.h.in b/src/fastfetch_config.h.in index cfe29dff4..2c4a7bee7 100644 --- a/src/fastfetch_config.h.in +++ b/src/fastfetch_config.h.in @@ -6,7 +6,8 @@ #ifndef FASTFETCH_BUILD_FLASHFETCH -#define FASTFETCH_DATATEXT_CONFIG "@DATATEXT_CONFIG@" +#define FASTFETCH_DATATEXT_STRUCTURE "@DATATEXT_STRUCTURE@" +#define FASTFETCH_DATATEXT_CONFIG "@DATATEXT_CONFIG@" //Requires FASTFETCH_PROJECT_VERSION and FASTFETCH_DATATEXT_STRUCTURE to be set #define FASTFETCH_DATATEXT_MODULES "@DATATEXT_MODULES@" #define FASTFETCH_DATATEXT_HELP "@DATATEXT_HELP@" #define FASTFETCH_DATATEXT_HELP_COLOR "@DATATEXT_HELP_COLOR@"