config.phundrak.com/org/config/neofetch.org

524 lines
16 KiB
Org Mode
Raw Normal View History

# -*- org-confirm-babel-evaluate: nil -*-
#+title: Neofetch configuration (WIP)
#+INCLUDE: headers
#+OPTIONS: auto-id:t
#+HTML_HEAD_EXTRA: <meta name="description" content="Phundrak's Neofetch config" />
#+HTML_HEAD_EXTRA: <meta property="og:title" content="Phundrak's Neofetch config" />
#+HTML_HEAD_EXTRA: <meta property="og:description" content="Description of the Neofetch config file of Phundrak" />
#+PROPERTY: header-args :noweb yes :exports code :tangle no :exports none
2020-05-17 18:32:23 +00:00
#+PROPERTY: header-args:sh :tangle ~/.config/neofetch/config.conf.bak :exports code :noweb yes
#+STARTUP: content
# #+INFOJS_OPT: view:plain home:https://phundrak.com/config toc:t
#+INFOJS_OPT: up:https://phundrak.com/config/neofetch
* Introduction
:PROPERTIES:
:CUSTOM_ID: h-1b7321bc-190e-41a7-a6e0-ff13e9a61b74
:END:
[[https://github.com/dylanaraps/neofetch][Neofetch]] is a CLI utility used to display system information. It was written
in Bash, and thus its configuration file is written as a Bash script too. This
document was written with org-mode, and my configuration file is tangled from
the source blocks you will see below to =~/.config/neofetch/config.conf=.
First, lets insert the Emacs config header in order to specify the mode to
open the file with.
#+BEGIN_SRC sh
# -*- mode: sh -*-
#+END_SRC
* The ~print_info~ functions
:PROPERTIES:
:CUSTOM_ID: h-3a3a5ade-adab-4508-9aa9-17896126b169
:END:
The ~print_info~ function is the function called by Neofetch in order to print
the system information it could fetch. In this function, well choose what to
display, and how. This function looks like this:
#+BEGIN_SRC sh
print_info() {
# Print information here…
}
#+END_SRC
Generally, what we will display will be shown through the ~info~ function,
redefined inside Neofetch (this is not ~info(1)~). This ~info~ function
accepts one or two arguments. With one argument, such as with ~info memory~,
we can get a result that looks like ~5136MiB / 15873MiB~, while calling it
with two arguments will treat the first one as a prefix and the second one as
the interesting information; ~info "Memory" memory~ will look like
~Memory: 5136MiB / 15873MiB~. Here is what we want to display:
#+NAME: info-elements-table
| Prefix | Information | What it does |
|----------+-------------+------------------------------|
| | line_break | Insert a blank line |
| | title | Username and hostname |
| | line_break | Insert a blank line |
| | cols | System theme |
| | line_break | Insert a blank line |
| OS | distro | Distribution name |
| Kernel | kernel | Kernel version |
| Uptime | uptime | Machine uptime |
| Packages | packages | Number of installed packages |
| Shell | shell | Users default shell |
| WM | wm | Users Window Manager |
| Terminal | term | Default terminal |
| CPU | cpu | CPU information |
| GPU | gpu | GPU information |
| Memory | memory | RAM information |
#+NAME: info-elements-gen
#+BEGIN_SRC emacs-lisp :var table=info-elements-table :cache yes
(mapconcat (lambda (x)
(format "info %s%s"
(if (not (string= (car x) ""))
(format "\"%s\" " (car x))
"")
(cadr x)))
table
"\n")
#+END_SRC
#+RESULTS[b674f32b66234a67929a0426ce187ce712d806f4]: info-elements-gen
#+begin_example
info line_break
info title
info line_break
info cols
info line_break
info "OS" distro
info "Kernel" kernel
info "Uptime" uptime
info "Packages" packages
info "Shell" shell
info "WM" wm
info "Terminal" term
info "CPU" cpu
info "GPU" gpu
info "Memory" memory
#+end_example
Hence, the function looks like so:
#+BEGIN_SRC sh
print_info() {
<<info-elements-gen()>>
}
#+END_SRC
Each of these modules can be tuned with the variables presented below.
* Information settings
:PROPERTIES:
:CUSTOM_ID: h-d1ddb7fc-e87a-42d1-a71b-6fc7b10c9f78
:END:
Each of the following variable tunes a function that can be called in
~print_info~ described above. It is possible to tune them by modifying this
document or the configuration file itself, and they can be overridden by the
command line with flags passed to ~neofetch~. I will divide these variables in
two main categories: hardware and software-related properties.
** Software
:PROPERTIES:
:CUSTOM_ID: h-2f562a5c-3530-4b50-b553-a0cb801affea
:END:
*** OS
:PROPERTIES:
:CUSTOM_ID: h-afe50abf-8988-48dd-9768-72eb0143b613
:END:
**** Kernel
:PROPERTIES:
:CUSTOM_ID: h-be4b75c8-2612-4e40-933f-bd451bd6fc5e
:END:
The variable below can shorten the output ofh the ~kernel~ function.
- Default value :: ~"on"~
- Values ::
- ~"on"~
- ~"off"~
- Flag :: ~"--kernel_shorthand"~
- Supports :: Everything except *BSDs (except PacBSD and PC-BSD)
- Examples ::
- on :: ~4.8.9-1-ARCH~
- off :: ~Linux 4.8.9-1-ARCH~
#+begin_src sh
kernel_shorthand="off"
#+end_src
**** Distro
:PROPERTIES:
:CUSTOM_ID: h-979a15ac-c2ac-41a4-91f2-5676feba6dd4
:END:
This variable can shorten the output of the ~distro~ function.
- Default value :: ~"on"~
- Values ::
- ~"on"~
- ~"off"~
- Flag :: ~"--distro_shorthand"~
- Supports :: Everything except Windows and Haiku
- Examples ::
- on :: ~Arch Linux~
- off :: ~Arch~
#+begin_src sh
distro_shorthand="off"
#+end_src
**** OS Architecture
:PROPERTIES:
:CUSTOM_ID: h-c621c645-f926-411f-852c-9b4508a0736a
:END:
This variable can show or hide the OS architecture in the ~distro~ output.
- Default value :: ~"off"~
- Values ::
- ~"on"~
- ~"off"~
- Flag :: ~"--os_arch"~
- Examples ::
- on :: ~Arch Linux x86_64~
- off :: ~Arch Linux~
#+begin_src sh
os_arch="off"
#+end_src
*** Uptime shorthand
:PROPERTIES:
:CUSTOM_ID: h-41f62c23-4306-4828-a824-7a33e19deee5
:END:
This variable can shorten the output of the ~uptime~ function. ~on~ shortens
it a bit, while ~tiny~ shortens it greatly.
- Default value :: ~"on"~
- Values ::
- ~"on"~
- ~"tiny"~
- ~"off"~
- Flag :: ~"--uptime_shorthand"~
- Examples ::
- on :: ~2 days, 10 hours, 3 mins~
- off :: ~2 days, 10 hours, 3 minutes~
- tiny :: ~2d 10h 3m~
#+begin_src sh
uptime_shorthand="on"
#+end_src
*** Shell
:PROPERTIES:
:CUSTOM_ID: h-759202dd-43a9-477f-8d11-df1790870673
:END:
**** Shell path
:PROPERTIES:
:CUSTOM_ID: h-dd92a375-1fa1-4e46-9427-503c03b83b83
:END:
This allows to show either the path of the users shell, or simply its
name.
- Default value :: ~"off"~
- Values ::
- ~"on"~
- ~"off"~
- Flag :: ~"--shell_path"~
- Examples ::
- on :: ~/bin/bash~
- off :: ~bash~
#+begin_src sh
shell_path="off"
#+end_src
**** Shell version
:PROPERTIES:
:CUSTOM_ID: h-636dfde0-f0d1-4166-870c-8f1ff31b6dc2
:END:
This allows to show the shells version in the output of ~shell~.
- Default value :: ~"on"~
- Values ::
- ~"on"~
- ~"off"~
- Flag :: ~"--shell_version"~
- Examples ::
- on :: ~bash 4.4.5~
- off :: ~bash~
#+begin_src sh
shell_version="off"
#+end_src
*** Theming
:PROPERTIES:
:CUSTOM_ID: h-e2ee7a72-d852-436d-b610-946508597696
:END:
This section will allow the user to modify what Neofetch can and cannot
display about the machines theming —by this, I mean its GTK theme, its
icons and its default font.
**** Shorten output
:PROPERTIES:
:CUSTOM_ID: h-19994d7e-908b-4e20-912c-a527eee19668
:END:
With this value, it is possible to shorten the output of the computers
theming.
- Default value :: ~"off"~
- Values ::
- ~"on"~
- ~"off"~
- Flag :: ~"--gtk_shorthand"~
- Examples ::
- on :: ~Numix, Adwaita~
- off :: ~Numix [GTK2], Adwaita [GTK3]~
#+begin_src sh
gtk_shorthand="on"
#+end_src
**** Enable or disable theming display for GTK2
:PROPERTIES:
:CUSTOM_ID: h-c9bf1b93-ec7b-4c48-b9f8-5d44edbcb8bc
:END:
It is possible to explicitely show or hide the computers theming with GTK2
with this variable.
- Default value :: ~"on"~
- Values ::
- ~"on"~
- ~"off"~
- Flag :: ~"--gtk2"~
- Examples ::
- on :: ~Numix [GTK2], Adwaita [GTK3]~
- off :: ~Adwaita [GTK3]~
#+begin_src sh
gtk2="off"
#+end_src
**** Enable or disable theming display for GTK3
:PROPERTIES:
:CUSTOM_ID: h-6d367bd6-bb5c-469c-bfd7-145ef0ecd6d9
:END:
The same variable as above is also available for GTK3.
- Default value :: ~"on"~
- Values ::
- ~"on"~
- ~"off"~
- Flag :: ~"--gtk3"~
- Examples ::
- on :: ~Numix [GTK2], Adwaita [GTK3]~
- off :: ~Numix [GTK2]~
#+begin_src sh
#+end_src
*** IP address
:PROPERTIES:
:CUSTOM_ID: h-2ec1b0c8-1663-4afa-bf91-b2dc811ba95b
:END:
It is possible to display the machines public IP address with the function
~ip~. The value below allows the user to change the website used to fetch
it.
- Default value :: ~"http://ident.me"~
- Value :: ~"url"~
- Flag :: ~"--ip_host"~
#+begin_src sh
public_ip_host="http://ident.me"
#+end_src
- Default value :: ~""~
- Values ::
- ~""~
- ~""~
- Flag :: ~""~
- Supports ::
- Examples ::
- on :: ~~
- off :: ~~
#+begin_src sh
#+end_src
** Hardware
:PROPERTIES:
:CUSTOM_ID: h-d7f87860-5c1d-427b-9d2e-f7674d9fbab5
:END:
*** CPU
:PROPERTIES:
:CUSTOM_ID: h-b2183b8b-de13-4812-a7da-9f2d4d66e42d
:END:
**** CPU brand
:PROPERTIES:
:CUSTOM_ID: h-7300f2bb-e8d2-4ede-8765-a6e8883af99e
:END:
With this variables, it is possible to show or hide the brand of a CPU in
the ~cpu~ output.
- Default value :: ~"on"~
- Values ::
- ~"on"~
- ~"off"~
- Flag :: ~"--cpu_brand"~
- Examples ::
- on :: ~Intel i7-6500U~
- off :: ~i7-6500U~
#+begin_src sh
cpu_brand="off"
#+end_src
**** CPU speed
:PROPERTIES:
:CUSTOM_ID: h-5cd70ef6-4ba3-45a3-a46e-ec2d5b76d36a
:END:
With this variable, it is possible to show or hide the speed of the CPU.
- Default value :: ~"on"~
- Values ::
- ~"on"~
- ~"off"~
- Flag :: ~"--cpu_speed"~
- Examples ::
- on :: ~Intel i7-6500U (4) @ 3.1GHz~
- off :: ~Intel i7-6500U (4)~
#+begin_src sh
cpu_speed="off"
#+end_src
**** CPU speed type
:PROPERTIES:
:CUSTOM_ID: h-61affc64-b69d-44f2-b950-1623cd908b6a
:END:
This allows Neofetch to know what type of speed it has to fetch regarding
the machines CPU. Any file in ~/sys/devices/system/cpu/cpu0/cpufreq~ can
be used as a value.
- Default value :: ~"bios_limit"~
- Values ::
- ~"scaling_cur_freq"~
- ~"scaling_min_freq"~
- ~"scaling_max_freq"~
- ~"bios_limit"~
- Flag :: ~"--speed_type"~
- Supports :: Linux with ~cpufreq~
#+begin_src sh
speed_type="bios_limit"
#+end_src
**** CPU speed shorthand
:PROPERTIES:
:CUSTOM_ID: h-6138e3bd-937f-4604-b2c0-db0a49b869bc
:END:
This value allows to show sorter CPU speed with less digits. This flag is
not supported in systems with CPU speed below 1GHz.
- Default value :: ~"off"~
- Values ::
- ~"on"~
- ~"on"~
- Flag :: ~"--speed_shorthand"~
- Examples ::
- on :: ~i7-6500U (4) @ 3.1GHz~
- off :: ~i7-6500U (4) @ 3.100GHz~
#+begin_src sh
speed_shorthand="on"
#+end_src
**** CPU cores
:PROPERTIES:
:CUSTOM_ID: h-eea09747-5334-49af-aef3-1a29f59ea40e
:END:
With this variable, it is possible to display the number of cores that are
available in the CPU.
- Default value :: ~"logical"~
- Values ::
- ~"logical"~
- ~"physical"~
- ~"off"~
- Flag :: ~"--cpu_cores"~
- Supports :: ~physical~ does not work on BSD.
- Examples ::
- logical :: ~Intel i7-6500U (4) @ 3.1GHz~ (All virtual cores)
- physical :: ~Intel i7-6500U (2) @ 3.1GHz~ (All physical cores)
- off :: ~Intel i7-6500U @ 3.1GHz~
#+begin_src sh
cpu_cores="off"
#+end_src
**** CPU temperature
:PROPERTIES:
:CUSTOM_ID: h-66633b86-2427-4079-9e62-e72b3d458a21
:END:
This variable allows the user to hide or show the CPUs temperature, and if
shown, the user can display it in Celcius or Farenheit degrees. For FreeBSD
and NetBSD-based systems, youll need to enable the ~coretemp~ kernel
module. This only supports newer Intel processors.
- Default value :: ~"off"~
- Values ::
- ~"C"~
- ~"F"~
- ~"off"~
- Flag :: ~"--cpu_temp"~
- Supports :: Linux, BSD
- Examples ::
- C :: ~Intel i7-6500U (4) @ 3.1GHz [27.2°C]~
- F :: ~Intel i7-6500U (4) @ 3.1GHz [82.0°F]~
- off :: ~Intel i7-6500U (4) @ 3.1GHz~
#+begin_src sh
cpu_temp="off"
#+end_src
*** GPU
:PROPERTIES:
:CUSTOM_ID: h-6138e3bd-937f-4604-b2c0-db0a49b869bc
:END:
The function responsible for displaying information regarding the GPUs is
~gpu~. It will try to list all available GPUs and display what it knows
about them.
**** GPU brand
:PROPERTIES:
:CUSTOM_ID: h-d2a0a4dd-7dc4-4584-8093-ce417b4bb59b
:END:
This value allows the user to hide or show the brand of their GPU in the
output of ~gpu~.
- Default value :: ~"on"~
- Values ::
- ~"on"~
- ~"off"~
- Flag :: ~"--gpu_brand"~
- Supports ::
- Examples ::
- on :: ~AMD HD 7950~
- off :: ~HD 7950~
#+begin_src sh
gpu_brand="off"
#+end_src
**** Which GPU to display
:PROPERTIES:
:CUSTOM_ID: h-4309d902-fc80-48c9-be89-02b932d1f650
:END:
This allows the user to choose which GPU appears in the output of the
function ~gpu~.
- Default value :: ~"all"~
- Values ::
- ~"all"~
- ~"dedicated"~
- ~"integrated"~
- Flag :: ~"--gpu_type"~
- Supports :: Linux
- Examples ::
- all ::
#+BEGIN_SRC text
GPU1: AMD HD 7950
GPU2: Intel Integrated Graphics
#+END_SRC
- dedicated :: ~GPU1: AMD HD 7950~
- integrated :: ~GPU1: Intel Integrated Graphics~
#+begin_src sh
gpu_type="all"
#+end_src
*** Resolution
:PROPERTIES:
:CUSTOM_ID: h-9803fa70-bf09-400a-800f-071de9f2d91d
:END:
This will try to list all the connected screens and display their resolution
individually. It is possible to display the refresh rate or to hide it.
- Default value :: ~"off"~
- Values ::
- ~"on"~
- ~"off"~
- Flag :: ~"--refresh_rate"~
- Supports :: Does not work on Windows
- Examples ::
- on :: ~1920x1080 @ 60Hz~
- off :: ~1920x1080~
#+begin_src sh
refresh_rate="off"
#+end_src
*** Disks
:PROPERTIES:
:CUSTOM_ID: h-87ce5b65-ae28-49a8-a91b-ed7a38ccc8b4
:END:
Neofetch can display the space available and the total space of disks