# rsfetch 2.0.0 This is the functional and technical specification for the 2.0 release of `rsfetch`, and it defines the new features and changes that will be made in that release. This spec is, to the best of my knowledge, fairly complete. If there's something I've forgotten, contact me and it will be added. ## Non-goals This version will NOT support the following: - support for new package managers (CRUX, KISS, NixOS, Slackware, Bedrock) (*will be completed in next release*) - new GPU information field. (*will be completed in next release*) - new Disk information field. (*will be completed in next release*) - custom (textual) information field. (*will be completed in next release*) - CPU temperature information field. - GTK (icon) theme information field. - Pictures in the terminal instead of ASCII art. (via w3m or VTE escape sequences) Some of these things may be implemented in future releases, others will never be implemented. ## Output Style Currently, rsfetch has some negative options (e.g. `--no-kernel`) and a few positive options (e.g. `--ip_address`). I suggest these be turned into all positive options, with the exception of `--no-bold` and `--no-borders`. This will result in a cleaner and more consistent user interface. This also has the side effect that `rsfetch`, by default, will not output anything unless it is specifically told to via CLI arguments. ### New layout flags #### UI rsfetch 2.0 will include an `-N`/`--neofetch` flag for outputting information out in a style similar to Neofetch. Example: ``` (\/) os: void ( . .) wm: dwm c(")(") pkgs: 5000 ``` #### Technical Implementation > NOTE: the terminal cursor is represented by `<>` ASCII art will first be printed: ``` (\/) ( . .) c(")(") <> ``` then the terminal cursor will be moved up to the beginning of the ASCII art using the escape sequence `\033[A`: ``` <> (\/) ( . .) c(")(") ``` Then, for each information field, the cursor will be moved one line down (with `\033[1B`) and to the right until it's clear of the ASCII art: ``` (\/) <> ( . .) c(")(") ``` and the information is printed. ``` (\/) os: void<> ( . .) c(")(") ``` ## New Information Fields `rsfetch` will also include a number of new information fields in the new release. ### Terminal Displays the terminal currently in use for the current shell.
This does not display the default shell, nor the shell for any other processes, just the shell for the current one. #### UI `rsfetch` will display the terminal without any capitalization, version number, or punctuation.
Examples: `xterm`, `urxvt`, `alacritty`, and `st`.

In addition, some terminal names will automatically be converted. Specifically: - `gnome-terminal-` will have the trailing dash trimmed off. - `urxvtd` will become just `urxvt`. #### Technical Implementation `rsfetch` will recursively retrieve the parent process of the current shell.
(On subsequent iterations, it will retrieve the parent process of the last retrieved parent process instead.) - If the retrieved process name matches any of the following non-terminal names, it will continue. - `tmux` - `screen` - If the process name matches any of the following names, it will give the name of the current TTY connected to `stdin` (i.e. like the `tty` command). - `login` - `init` - If the process name is a path (e.g. `/usr/bin/xterm`) it will return only the file name (in this case, `xterm`). ### CPU Information Displays CPU information. #### UI `rsfetch` will display the CPU model, number of **logical** cores, and maximum frequency in the following format: ``` () @ ``` Example: `BCM2835 (1) @ 1.000Ghz` #### Technical Implementation rsfetch will start by parsing `/proc/cpuinfo`, which has the following format: ``` processor : 0 model name : ARMv6-compatible processor rev 7 (v6l) BogoMIPS : 697.95 Features : half thumb fastmult vfp edsp java tls CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xb76 CPU revision : 7 Hardware : BCM2835 Revision : 9000c1 Serial : 00000000806f3bba Model : Raspberry Pi Zero W Rev 1.1 ``` where `Hardware` corresponds to the CPU model and `processor` is the number of logical cores minus one. Then, the file `/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq` is read, which contains the maximum frequency of the CPU in Hz. This value can then be parsed into a `usize` and simply divided by `1000000` to get the maximum frequency in GHz. ### Memory Information Displays RAM information. #### UI `rsfetch` will simply display the total used amount of memory and the total amount of memory in megabytes in the following format: ``` MB / MB ``` Example: `60MB / 8000MB` #### Technical Implementation rsfetch will read the contents of `/proc/meminfo`, which is of the following format: ``` MemTotal: 666 kB --- snip --- MemAvailable: 333 kB --- snip --- Shmem: 333 kB SReclaimable: blah blah kB ``` This information will then be split on the whitespace and parsed into a data structure of the following format: ``` struct MemoryInfo { total: usize, available: usize, used: usize, } ``` ...where `MemoryInfo.total` is equal to `MemTotal` from `/proc/meminfo`, `MemoryInfo.available` is equal to `MemAvailable`, and `MemoryInfo.used` equal to `Shmem`. This can then be displayed as appropriate. ## Modification to existing information fields ### Uptime In the new release, rsfetch will retrieve the contents of `/proc/uptime` and manually parse it into the appropriate format instead of using `uptime_lib`. ## Internal changes ### Removing superfluous dependencies - bytecount will be removed and replaced with manual line counting. - pwd will also be removed and replaced with by reading the `USER` environment variable. ### Extensive cleanup Currently, `src/main.rs` is a huge mess of random functions scattered throughout. This will have to be organized into different files based on modules. Each file will have it's own meta structure (e.g., for "Packages" infomation field, `struct pkgs`) and implementation (`impl pkgs {}`) so retrieving the package information will be `pkgs.get(PKG_MANAGER_GENTOO).unwrap()` instead of `get_package_count_*()`. In addition to the information fields, output will also be refactored. ## Author(s) - Kied Llaentenn @kiedtl u/kiedtl Special thanks goes to the various creators and maintainers of `neofetch`.