Skip to content

Faster neofetch alternative, written in C. Still improving :)

License

Notifications You must be signed in to change notification settings

alba4k/albafetch

Repository files navigation

albafetch ~by alba4k

Note: to prevent merge conflicts, please open your pull requests to the "development" branch, and check that one out before doing anything. Master is more stagnant and only updated when I know what I'm currently working on works as expected (most of the time).

intro

albafetch is a simple and fast program to display a lot of system information in a neofetch-like layout in way less than a second. I decided to make this as a challenge for myself and since I found neofetch too slow (which is understandable given that we're talking about a 10k+ lines shell script).

Preview This is what albafetch will likely look like by default:

default

And this is what my configuration looks like custom

Here is a time comparison (exact execution times change between machines and runs):

Time comparison

neofetch albafetch

You will find a lot of useful usage and configuration related info inside of the user manual and a small list of the things I changed since the last release in the changelog.

It currently supports a lot of GNU/Linux distributions, macOS (both x64 and arm64 macs) and even Android (only tested in Termux). Feel free to test any other platform :)

Table of contents

  1. Dependencies
  2. Compilation
  3. Installation
  1. Configuration

    example config

  2. Contributing

Dependencies

Build dependencies

These will usually also install the relative runtime dependencies Dependencies marked with an asterisk are optional. This means that if not installed at compile-time, albafetch will be compiles with custom implementations of the functions used.

Runtime dependencies

I would like to eventually remove those, by checking at runtime if they are installed and not use them if not so. Dependencies marked with an asterisk are optional. This means that if not installed at compile-time, albafetch will be compiles with custom implementations of the functions used. If the binary was compiled with the dependency installed, however, it will be needed at runtime too.

Compilation

Using the Makefile

This will need you to have a C compiler installed and will still use meson/ninja under the hood.

$ git clone https://github.com/alba4k/albafetch
$ cd albafetch
$ make

Using meson

If you prefer to build with meson/ninja directly, you can use these commands:

$ git clone https://github.com/alba4k/albafetch
$ cd albafetch
$ meson setup build
$ meson compile -C build

In both cases, an executable file should appear as build/albafetch if the compilation succeeds.

Debug builds

It is possible to build a debug binary (build/debug) that will test every single function and make sure it runs correctly. This can be done by running

$ make debug

Using meson

If you prefer to build with meson/ninja directly, you can use these commands:

$ meson setup build
$ meson compile -C build
$ build/debug

Using nix

Building with nix can make compiling in some ways much easier, such as when compiling statically or cross compiling. A few convenience outputs are included:

nix build .#albafetch # regular, dynamically linked build
nix build .#albafetch-static # statically linked build (only available on linux)
nix build .#albafetch-arm # cross compiling from x86_64 to arm (only available on x86_64)

Installation

For Arch Linux

An AUR package is available, albafetch-git. There are three packages on the AUR that provide albafetch:

  • albafetch will compile the source code of the latest release
  • albafetch-bin will install a pre-compiled binary from the latest release
  • albafetch-git will compile the source of the latest commit in master

You can find more information on how to install packages from the AUR in the Arch Wiki

For Debian

You can create a DEB package from the repo itself

This can be done via a guided procedure

$ git clone https://github.com/alba4k/albafetch
$ cd albafetch

$ make deb

This will create a deb package for you and ask if you want to install it.

For NixOS

nix profile:

$ nix profile install .#albafetch

nix-env:

$ nix-env -iA packages.<your platform>.albafetch # platform examples: x86_64-linux, aarch64-linux, aarch64-darwin

Using the overlay (Flake):

{
  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
    albafetch = {
      url = "github:alba4k/albafetch";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {nixpkgs, albafetch, ...}: {
    nixosConfigurations.host = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        ./configuration.nix
        {
          nixpkgs.overlays = [albafetch.overlays.default];
          environment.systemPackages = [pkgs.albafetch];
        }
      ];
    };
  };
}

Using the overlay (builtins.fetchTarball):

{pkgs, ...}: {
  nixpkgs.overlays = [(import (builtins.fetchTarball "https://github.com/alba4k/albafetch/master.tar.gz")).overlays.default];
  environment.systemPackages = with pkgs; [
    albafetch
  ];
}

For older macOS versions

On older macOS (~11 and lower) versions, albafetch likely won't build natively.

You can, however, install albafetch on those using the package on MacPorts

This can be easily done with the following

# port install albafetch 

Manual installation

What if your OS is not included in the ones mentioned? In this case, you can either compile the source code yourself and install albafetch manually, or you can grab an executable from the latest release.

Please note that albafetch currently won't run on Windows (despite albafetch --logo windows being an option), but I'm planning to eventually add support (sooner or later). Feel free to help :)

$ git clone https://github.com/alba4k/albafetch
$ cd albafetch

$ make
# make install

make install needs elevated privileges on Linux (e.g. sudo or a root shell) to write to /usr/bin, while /usr/local/bin can be accessed as a normal user on macOS.

Alternatively, you may prefer meson to perform the installation:

$ git clone https://github.com/alba4k/albafetch
$ cd albafetch
$ meson setup build
$ meson compile -C build
$ meson install -C build

Meson will install the executable to /usr/local/bin, which you may or may not want (executables in this directory are ran instead of ones in /usr/bin).

Configuration

albafetch can be customized using a config file, usually ~/.config/albafetch.conf for your user or /etc/xdg/albafetch.conf.

You can find an example configuration file (which only provides the default values of every option) here. Although this file includes some short comments on how the various options work, I highly recommend checking out the user manual for a deeper understanding of the way this config file works.

Contributing

Almost everything included in this program is written in C.

If you want to, you can directly modify the source code contained in this repository and recompile the program afterwards to get some features you might want or need.

New logos can be added in src/logos.h (be careful to follow the format), new infos in src/info and src/info/info.h. Config options are mainly parsed in src/utils.c. You will also need to edit src/main.c afterwards to fully enable the new features.

Don't mind opening a pull request if you think some of the changes you made should be in the public version, just try to follow the coding style that I used in the rest of the project.

Any contribution, even just a fix of a typo, is highly appreciated.


© Aaron Blasko
Initially started in March 2022