Skip to content

Navigation Menu

Sign in
Sign up

Configuration

Rashil Gandhi edited this page Nov 6, 2021 · 12 revisions

Basic configuration

The configuration is stored at ~/.config/winfetch/config.ps1 (or $env:USERPROFILE/.config/winfetch/config.ps1).

It can be overridden by using the -configpath parameter or the WINFETCH_CONFIG_PATH environment variable.

The default configuration is generated automatically if your config doesn't exist, however, you can also reset your configuration back to default by using:

winfetch -genconf

The default configuration looks like this:

# ===== WINFETCH CONFIGURATION =====
# $image = "~/winfetch.png"
# $noimage = $true
# Switch the default Windows logo
# $switchlogo = $true
# Make the logo blink
# $blink = $true
# Display all built-in info segments.
# $all = $true
# Add a custom info line
# function info_custom_time {
# return @{
# title = "Time"
# content = (Get-Date)
# }
# }
# Configure which disks are shown
# $ShowDisks = @("C:", "D:")
# Show all available disks
# $ShowDisks = @("*")
# Configure which package managers are shown
# disabling unused ones will improve speed
# $ShowPkgs = @("scoop", "choco")
# Use the following option to specify custom package managers.
# Create a function with that name as suffix, and which returns
# the number of packages. Two examples are shown here:
# $CustomPkgs = @("cargo", "just-install")
# function info_pkg_cargo {
# return (cargo install --list | Where-Object {$_ -like "*:" }).Length
# }
# function info_pkg_just-install {
# return (just-install list).Length
# }
# Configure how to show info for levels
# Default is for text only.
# 'bar' is for bar only.
# 'textbar' is for text + bar.
# 'bartext' is for bar + text.
# $cpustyle = 'bar'
# $memorystyle = 'textbar'
# $diskstyle = 'bartext'
# $batterystyle = 'bartext'
# Remove the '#' from any of the lines in
# the following to **enable** their output.
@(
 "title"
 "dashes"
 "os"
 "computer"
 "kernel"
 "motherboard"
 # "custom_time" # use custom info line
 "uptime"
 "pkgs"
 "pwsh"
 "resolution"
 "terminal"
 # "theme"
 "cpu"
 "gpu"
 # "cpu_usage" # takes some time
 "memory"
 "disk"
 # "battery"
 # "locale"
 # "weather"
 # "local_ip"
 # "public_ip"
 "blank"
 "colorbar"
)

To disable an information field, just add a # in front of that line:

 "disk" # ENABLED
# "battery"	 # DISABLED

Custom info segments

You can add custom info segments to your winfetch config, which you can use to provide new info or to modify the output of built-in segments.

To do this create a function prefixed with info_, this function should return a hashtable with a title and content property. Info functions can return multiple info lines by returning an array of hashtables (see the built-in info_disk function). Finally, add the function name without the info_ prefix to the segment list as shown in the example below.

function info_custom_time {
 return @{
 title = "Time"
 content = (Get-Date)
 }
}
@(
 ...
 "motherboard"
 "custom_time" # use custom info line
 "uptime"
 ...
)

Custom package managers

Winfetch allows you to show packages from any package manager you want; you just have to create a small function that returns the count. Use the $CustomPkgs array to add names of package managers, and create a function called info_pkgs_<name>, where name is the same name you added in the $CustomPkgs array (remove the angled brackets) in the config file.

An example is shown below:

$CustomPkgs = @("cargo")
function info_pkg_cargo {
 return (cargo install --list | Where-Object {$_ -like "*:" }).Length
}

Clone this wiki locally

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /