-
-
Notifications
You must be signed in to change notification settings - Fork 12
Configuration
You can customize albafetch through a configuration file. There are multiple locations for this file and once one is found, it will be the only one parsed. The files are searched for in the following order:
$XDG_CONFIG_HOME/albafetch.conf$XDG_CONFIG_HOME/albafetch/albafetch.conf$HOME/.config/albafetch.conf$HOME/.config/albafetch/albafetch.conf/etc/xdg/albafetch.conf
This repository also contains an example file.
A custom file can also be given using the --config argument.
The config should contain entry = "value", pairs (using quotation marks is mandatory). During parsing, albafetch will look for the first string matching the entry (described further down), then locate the next quotation mark, check whether there is another quotation mark following it and if so take the value between the two.
There are three different types of data that will be parsed:
-
str [N]: No more thanNbytes between the quotation marks will be read, but every single one of those bytes will be used. -
int [N]: An integer smaller or equal toNwill be parsed using the C standardatoi()function (useman 3 atoifor further information). The provided value will always be considered unsigned (using something like -1 will therefore be treated as 2³²-1, or 4294967295) -
bool: The program will consider anything different from "false" as "true". -
array: A list of whitespace-separated strings denoted by quotes between two curly braces.
All of this means that, for example, AB"CboldDEF"whatever"wo"w will be parsed the exact same way as bold = "true", or bold"", but I would not recommend this as it makes everything less readable. I might also stop supporting this at any moment, so the specified syntax is the only one that's guaranteed to work.
I might also make the parser stricter in the future and configs written this way might stop working entirely.
Also, any ~ that you may want to use will NOT get expanded to the value of $HOME and will instead be parsed as they are. If you want to reference your home directory inside of this config file (e.g. to specify the path to a custom ascii art) you will have to do so explicitly.
Here is a list of all accepted config variables:
CLICK TO EXPAND
| Variable | Type | Default Value | Description |
|---|---|---|---|
align_infos |
bool |
"false" |
Left-alligns infos |
bold |
bool |
"true" |
Prints some parts in bold |
ascii_art |
str [96] |
Path to a custom ascii art | |
logo |
str [24] |
"linux" |
The logo to be used |
default_color |
str [8] |
The color to be used | |
dash |
str [16] |
": " |
Separates infos from labels |
spacing |
int [64] |
"5" |
The number of empty cells between the logo and the infos |
modules |
array |
{"title" "separator" "uptime" "separator" "os" "kernel" "desktop" "shell" "term" "packages" "separator "host" "cpu" "gpu" "memory" "space" "colors" "light_colors"} |
The modules and order to be printed |
separator_prefix |
str [64] |
"" |
String printed before separator modules |
separator_character |
str [8] |
"-" |
Character used as separator
|
spacing_prefix |
str [64] |
"" |
String printed before spacing modules |
title_prefix |
str [64] |
"" |
String printed before title modules |
colored_title |
bool |
true |
Whether the title should have colors |
user_prefix |
str [64] |
"User" |
String printed before user modules |
hostname_prefix |
str [64] |
"Hostname" |
String printed before hostname modules |
uptime_prefix |
str [64] |
"Uptime" |
String printed before uptime modules |
os_prefix |
str [64] |
"OS" |
String printed before os modules |
os_arch |
bool |
"true" |
Whether the architecture (e.g. x86_64) should be printed |
kernel_prefix |
str [64] |
"Kernel" |
String printed before kernel modules |
kernel_short |
bool |
"false" |
Truncates the kernel version at the first -
|
kernel_type |
bool |
"false" |
Prints the part after the last - in brackets (makes sense with kernel_short=true) |
desktop_prefix |
str [64] |
"Desktop" |
String printed before desktop modules |
desktop_type |
bool |
"true" |
Prints the session type in brackets (e.g. Wayland) |
desktop_version |
bool |
"false" |
On supported desktops, also prints the version |
gtk_theme_prefix |
str [64] |
"Theme" |
String printed before gtk_theme modules |
icon_theme_prefix |
str [64] |
"Icons" |
String printed before icon_theme modules |
cursor_theme_prefix |
str [64] |
"Cursor" |
String printed before cursor_theme modules |
shell_prefix |
str [64] |
"Shell" |
String printed before shell modules |
login_shell_prefix |
str [64] |
"Login" |
String printed before login_shell modules |
shell_path |
bool |
"false" |
Prints the full shell path instead of just the name (e.g. /usr/bin/bash) |
shell_path |
bool |
"false" |
Prints the full shell path instead of just the name (e.g. /usr/bin/bash) |
shell_version |
bool |
"false" |
On supported shells, also prints the version |
term_prefix |
str [64] |
"Terminal" |
String printed before term modules |
term_ssh |
bool |
"true" |
Appends (SSH) if running in a remote session |
term_version |
bool |
"false" |
On supported terminals, also prints the version |
pkg_prefix |
str [64] |
"Packages" |
String printed before packages modules |
pkg_mgr |
bool |
"true" |
Prints the package source before the count |
pkg_pacman |
bool |
"true" |
Whether pacman packages should be counted |
pkg_dpkg |
bool |
"true" |
Whether dpkg packages should be counted |
pkg_flatpak |
bool |
"true" |
Whether flatpak packages should be counted |
pkg_snap |
bool |
"true" |
Whether snap packages should be counted |
pkg_brew |
bool |
"true" |
Whether homebrew packages should be counted |
pkg_pip |
bool |
"false" |
Whether python packages should be counted (off by default because of speed) |
host_prefix |
str [64] |
"Host" |
String printed before host modules |
bios_prefix |
str [64] |
"Login" |
String printed before bios modules |
cpu_prefix |
str [64] |
"CPU" |
String printed before cpu modules |
cpu_brand |
bool |
"true" |
Prints the CPU manufacturer name (e.g. Intel) |
cpu_freq |
bool |
"true" |
Prints the current core 0 frequency |
cpu_count |
bool |
"true" |
Prints the number of threads |
cpu_temp |
bool |
"false" |
Prints the current cpu temperature |
gpu_prefix |
str [64] |
"GPU" |
String printed before gpu modules |
gpu_brand |
bool |
"true" |
Prints the GPU manufacturer name |
gpu_index |
int [3] |
"0" |
Selects what GPU to print (0 for all, otherwise a number 1-3) |
mem_prefix |
str [64] |
"Memory" |
String printed before memory modules |
mem_perc |
bool |
"true" |
Whether the current memory usage (in %) shoud be printed |
swap_prefix |
str [64] |
"Swap" |
String printed before swap modules |
swap_perc |
bool |
"true" |
Whether the current swap usage (in %) shoud be printed |
pub_prefix |
str [64] |
"Public IP" |
String printed before public_ip modules |
loc_prefix |
str [64] |
"Local IP" |
String printed before local_ip modules |
loc_localhost |
bool |
"false" |
Whether 127.0.0.1 should be shown as local IP |
loc_docker |
bool |
"false" |
Whether to show docker as local IP |
pwd_prefix |
str [64] |
"Directory" |
String printed before pwd modules |
pwd_path |
bool |
"true" |
Whether pwd prints the full path or just the base name |
date_prefix |
str [64] |
"Date" |
String printed before date modules |
date_format |
str [32] |
"%02d/%02d/%d %02d:%02d:%02d" |
Date format (formatted with printf, sorry if you wanted more freedom) |
bat_prefix |
str [64] |
"Battery" |
String printed before battery modules |
bat_status |
bool |
"true" |
Prints the battery status (e.g. Charging) |
colors_prefix |
str [64] |
"" |
String printed before colors modules |
colors_light_prefix |
str [64] |
"" |
String printed before light_colors modules |
col_block_str |
str [24] |
" " |
String used to display each color |
col_background |
bool |
"true" |
Selects what escape sequence is used to color col_block_str
|
A specific option that's worth spending some extra time talking about is ascii_art. This option expects the path to a file that contains a custom logo. Its syntax is really straight-forward: You can specify up to 40 lines you want to use as logo (which can not be longer than 256 bytes long, including the closing null character. Note that Unicode characters will be bigger than 1B), and eventually a color on the first line. Anything that's not recognized as a color ("colors" are defined as black, red, green, yellow, blue, purple, cyan, gray or white) Will be considered the first line of the logo.
This is what a logo file could look like:
blue
first_line
second_line
third_line
fourth_line
This file should NOT end with a new line, and every logo line should be equally long (you can achieve this simply by adding spaces at the end of the shorter lines), or albafetch will have alignment problems. There is no way to add comments in this file, everything will be used exactly as it is written (except some escape sequences, more about this further down).
The config can also contain an ordered whitespace-separated list of the modules that you want albafetch to print. The array has a different syntax in the config, as shown here:
modules = {
"module1"
"module2"
"module3"
}
The following modules are supported, while others will be treated as strings and printed as they are:
CLICK TO EXPAND
| Module | Description |
|---|---|
title |
A small user@hostname title |
uptime |
Current uptime |
os |
Current OS |
kernel |
Kernel version |
desktop |
Running desktop environment or compositor |
shell |
Name of the parent process |
login_shell |
Login shell |
term |
Used terminal |
packages |
Installed packages |
host |
Host machine name |
cpu |
Processor name |
gpu |
GPU name |
memory |
Total and used ram |
swap |
Total and used swap |
user |
Username |
hostname |
Hostname |
gtk_theme |
Current GTK theme |
icon_theme |
Current icon theme (GTK) |
cursor_theme |
Current cursor theme (GTK) |
bios |
BIOS vendor and version (Linux only) |
public_ip |
Current public IP |
local_ip |
Current local IP(s) |
pwd |
Working directory |
date |
Date and time |
battery |
Battery percentage and status (Linux only) |
separator |
A small separator (of the same length as the previous line) |
space |
An empty line |
colors |
The terminal colors |
light_colors |
The light versions of the terminal colors |
To parse this section, albafetch first locates a string matching modules in the config file, takes the part between the following curly braces, and reads the text between the following pairs of quotation marks.
Anything that doesn't match what the parser is looking for will be ignored, but the usage of explicit comments is encouraged: whatever stands between a ; or an # and the end of the line will not be read as part of the config. You can, however, still freely use # and ; in your config, as they will NOT be removed when enclosed in a string (that is, between a pair of quotation marks).
There is currently no way to have multi-line comments.
When albafetch parses a file (config or custom ascii art), it will also automatically unescape certain escape sequences, the following:
| File content | How it will be parsed |
|---|---|
| "\e" | '\033' (ANSI escape) |
| "\033" | '\033' (ANSI escape) |
| "\n" | '\n' (new line) |
| "\X" | 'X' (everything else) |
Since it might be useful, here are some of the most useful ANSI escape sequences (you can find a more complete list here)
| Function | Escape |
|---|---|
| Reset | \e[0m |
| Bold | \e[1m |
| Black | \e[30m |
| Red | \e[31m |
| Green | \e[32m |
| Yellow | \e[33m |
| Blue | \e[34m |
| Purple | \e[35m |
| Cyan | \e[36m |
| White | \e[97m |
Please note that these colors will be displayed as defined in the configuration of your terminal.
You can check how a certain string will look using something like echo -e "\e[1mHello, \e[31mWorld\e[0m".
These escape sequences may be placed at any point inside of your config or custom ascii art and they should get parsed correctly (as long as you stay inside of the size limits defined for each field). You can even use multiple inside a single line.