Skip to content

MrSom3body/gotcha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐹 gotcha, my small fetch tool

preview

gotcha is a small fetcher written in go. It has absolutely no customization (at least for now) and is primarily intended for my system.

✨ features

  • speedy boi (on my machine <2ms)
  • no dependencies besides linux and the binary itself (and go for building duh)
  • displays:
    • distribution
    • kernel version
    • uptime (in days too 😈)
    • shell
    • desktop environment/window manager
    • memory usage
    • (by default your loopback1) ip

🛠️ benchmarks

With my AMD Ryzen 9 6900HX CPU I get the following results from some fetches I know (and mine ofc):

Command Mean [ms] Min [ms] Max [ms] Relative
gotcha 1.6 ± 0.2 1.2 2.1 1.00
macchina 11.6 ± 0.7 10.3 15.4 7.06 ± 0.83
neofetch 527.8 ± 11.7 507.7 547.8 320.03 ± 33.31
fastfetch 62.5 ± 1.2 60.6 67.1 37.91 ± 3.93
pfetch 130.8 ± 1.3 127.9 134.0 79.33 ± 8.11

created with hyperfine

📦 installation

❄️ nix (with flakes)

Add this thingy to your inputs:

inputs = {
  # ...
  gotcha = {
    url = "github:MrSom3body/gotcha";
    inputs = {
      nixpkgs.follows = "nixpkgs";
    };
  };
  # ...
};

Andddd add this the package to home-manager or your system wide nix config:

inputs.gotcha.packages.${pkgs.system}.default

🐧 all other distributions

Get the latest release or compile it yourself if you want an useful output for your local IP. You can do that really easy by installing go and running the following commands:

git clone https://github.com/MrSom3body/gotcha
cd gotcha
go build -ldflags="-s -w"

🧰 overrides

There is no real configuration, but you can override some values to change some things. The process of this is imo easier for nix but if you compile it yourself because you use a inferior different distro you need to do so with some flags.

Key Default Value Description
ifaceName lo The interface name from which to display the ip
color 6 The integer value of the color (0-72) you want to use for the keys

❄️ nix overrides

If you want to change the interface name for the IP you can override the package like this:

(inputs.gotcha.packages.${pkgs.system}.default.override {
  <key> = "<value>";
})

🔨 compiling

For every override you want to add you must add this -X 'github.com/MrSom3body/gotcha/cmd.<key>=<value>' to the -ldflags like so:

go build -ldflags="-s -w -X 'github.com/MrSom3body/gotcha/cmd.<key>=<value>'"

🤔 why this name?

go + fetch → gofetch → gotch → gotcha

I know gotcha makes absolutely no sense for a fetcher but idc :)

Footnotes

  1. why loopback you may ask? Because gotcha builds with a looback interface by default (see here on how to override), because you're ought to override it yourself :)

  2. Use one of these commands to display the 8 colors:
    bash: for i in $(seq 0 7); do tput setaf $i && echo $i; done
    fish: for i in (seq 0 7); tput setaf $i && echo $i; end