From f042908f8205f18baba033099848338b8c7a4cc0 Mon Sep 17 00:00:00 2001 From: Tobilike <80016610+Tobilike@users.noreply.github.com> Date: Sun, 7 Jan 2024 17:12:45 +0100 Subject: [PATCH 01/12] Rebase Possibly --- README.md | 4 ++++ config.json | 1 + 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 598a4fdf..a03c0352 100644 --- a/README.md +++ b/README.md @@ -270,6 +270,10 @@ Below stand further descriptions for each available (default) option : // For example, "retro" would show the retro styled Apple logo on Darwin platforms. // Note that the `--logo-style` argument overrides this setting. "logo_style": "", + // Enable icons + // A nerd font is required to activate the icons. Otherwise, these are simply missing and a placeholder can be seen. https://github.com/ryanoasis/nerd-fonts + // Make sure that UTF-8 is supported on your system + "entries_icon": false, // Entries list. // Add a `disabled` option set to `true` to temporary hide one. // You may change entry displayed name by adding a `name` option. diff --git a/config.json b/config.json index 4c6e24b8..d858dbf6 100644 --- a/config.json +++ b/config.json @@ -5,6 +5,7 @@ "entries_color": "", "honor_ansi_color": true, "logo_style": "", + "entries_icon": false, "entries": [ { "type": "User" }, { "type": "Hostname" }, From 4260094f22a2ee8875ab068cc50595ab0cefd731 Mon Sep 17 00:00:00 2001 From: Tobilike <80016610+Tobilike@users.noreply.github.com> Date: Sun, 7 Jan 2024 17:17:16 +0100 Subject: [PATCH 02/12] Add files via upload rebase possibly --- archey/configuration.py | 1 + archey/entry.py | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/archey/configuration.py b/archey/configuration.py index 3271c370..ea89ba41 100644 --- a/archey/configuration.py +++ b/archey/configuration.py @@ -16,6 +16,7 @@ "suppress_warnings": False, "entries_color": "", "honor_ansi_color": True, + "entries_icon": False, "default_strings": { "latest": "latest", "available": "available", diff --git a/archey/entry.py b/archey/entry.py index e4bc1bca..c562037b 100644 --- a/archey/entry.py +++ b/archey/entry.py @@ -12,6 +12,7 @@ class Entry(AbstractBaseClass): """Module base class""" _PRETTY_NAME: Optional[str] = None + _ICON: Optional[str] = None def __new__(cls, *_, **kwargs): """Hook object instantiation to handle our particular `disabled` config field""" @@ -26,7 +27,18 @@ def __init__(self, name: Optional[str] = None, value=None, options: Optional[dic # `name`: key (defaults to the instantiated entry class name); # `value`: value of entry as an appropriate object; # `options`: configuration options *specific* to an entry instance; - self.name = name or self._PRETTY_NAME or self.__class__.__name__ + + configuration = Configuration() + icon = configuration.get("entries_icon") + + if icon == True: + if self._ICON == None: + self.name = name or self._PRETTY_NAME or self.__class__.__name__ + else: + self.name = name or self._PRETTY_NAME or self.__class__.__name__ + self.name = self._ICON + " " + self.name + else: + self.name = name or self._PRETTY_NAME or self.__class__.__name__ self.value = value self.options = options or {} From 250e0afdba90cd064bb3cb3e47e31ed08704d394 Mon Sep 17 00:00:00 2001 From: Tobilike <80016610+Tobilike@users.noreply.github.com> Date: Sun, 7 Jan 2024 17:18:17 +0100 Subject: [PATCH 03/12] rebase possibly --- archey/entries/cpu.py | 2 ++ archey/entries/desktop_environment.py | 2 +- archey/entries/disk.py | 2 ++ archey/entries/distro.py | 2 ++ archey/entries/gpu.py | 2 ++ archey/entries/hostname.py | 2 ++ archey/entries/kernel.py | 2 ++ archey/entries/lan_ip.py | 1 + archey/entries/load_average.py | 1 + archey/entries/model.py | 2 ++ archey/entries/packages.py | 2 ++ archey/entries/processes.py | 2 ++ archey/entries/ram.py | 2 ++ archey/entries/shell.py | 2 ++ archey/entries/temperature.py | 2 ++ archey/entries/terminal.py | 2 ++ archey/entries/uptime.py | 2 ++ archey/entries/user.py | 2 ++ archey/entries/wan_ip.py | 1 + archey/entries/window_manager.py | 1 + 20 files changed, 35 insertions(+), 1 deletion(-) diff --git a/archey/entries/cpu.py b/archey/entries/cpu.py index ccec9297..16df3979 100644 --- a/archey/entries/cpu.py +++ b/archey/entries/cpu.py @@ -19,6 +19,8 @@ class CPU(Entry): Each `dict` **SHOULD** contain only one entry (CPU model name as key and cores count as value). """ + _ICON = "\uf4bc" # UTF-8 Code + _MODEL_NAME_REGEXP = re.compile( r"^model name\s*:\s*(.*)$", flags=re.IGNORECASE | re.MULTILINE, diff --git a/archey/entries/desktop_environment.py b/archey/entries/desktop_environment.py index d4787a50..f935f0a6 100644 --- a/archey/entries/desktop_environment.py +++ b/archey/entries/desktop_environment.py @@ -25,7 +25,7 @@ class DesktopEnvironment(Entry): Just iterate over running processes to find a known-entry. If not, rely on the `XDG_CURRENT_DESKTOP` environment variable. """ - + _ICON = "\ue23c" # UTF-8 Code _PRETTY_NAME = "Desktop Environment" def __init__(self, *args, **kwargs): diff --git a/archey/entries/disk.py b/archey/entries/disk.py index f48cb38d..86ff137a 100644 --- a/archey/entries/disk.py +++ b/archey/entries/disk.py @@ -13,6 +13,8 @@ class Disk(Entry): """Uses `df` to compute disk usage across devices""" + _ICON = "\U000f16df" # UTF-8 Code + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/distro.py b/archey/entries/distro.py index 12bc4c98..acfc108a 100644 --- a/archey/entries/distro.py +++ b/archey/entries/distro.py @@ -11,6 +11,8 @@ class Distro(Entry): """Uses `distro` and `platform` modules to retrieve distribution and architecture information""" + _ICON = "\uf17c" # UTF-8 Code + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/gpu.py b/archey/entries/gpu.py index 89b0c718..13b359c1 100644 --- a/archey/entries/gpu.py +++ b/archey/entries/gpu.py @@ -11,6 +11,8 @@ class GPU(Entry): """Relies on `lspci` or `pciconf` to retrieve graphical device(s) information""" + _ICON = "\ue735" # UTF-8 Code + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/hostname.py b/archey/entries/hostname.py index cbc48c4c..2b98c456 100644 --- a/archey/entries/hostname.py +++ b/archey/entries/hostname.py @@ -9,6 +9,8 @@ class Hostname(Entry): """Read system file with fallback on `platform` module to retrieve the system host-name""" + _ICON = "\U000f0318" # UTF-8 Code + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/kernel.py b/archey/entries/kernel.py index 03a13832..c6bbed4b 100644 --- a/archey/entries/kernel.py +++ b/archey/entries/kernel.py @@ -18,6 +18,8 @@ class Kernel(Entry): [GNU/LINUX] If user-enabled, implement a version comparison against upstream data. """ + _ICON = "\uf305" # UTF-8 Code + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/lan_ip.py b/archey/entries/lan_ip.py index a68f76d9..486a7126 100644 --- a/archey/entries/lan_ip.py +++ b/archey/entries/lan_ip.py @@ -15,6 +15,7 @@ class LanIP(Entry): """Relies on the `netifaces` module to detect LAN IP addresses""" + _ICON = "\U000f0a60" # UTF-8 Code _PRETTY_NAME = "LAN IP" def __init__(self, *args, **kwargs): diff --git a/archey/entries/load_average.py b/archey/entries/load_average.py index d648f8ba..8aedd80a 100644 --- a/archey/entries/load_average.py +++ b/archey/entries/load_average.py @@ -10,6 +10,7 @@ class LoadAverage(Entry): """System load average detection entry""" + _ICON = "\U000f051f" # UTF-8 Code _PRETTY_NAME = "Load Average" def __init__(self, *args, **kwargs): diff --git a/archey/entries/model.py b/archey/entries/model.py index 6bc42705..883ca043 100644 --- a/archey/entries/model.py +++ b/archey/entries/model.py @@ -13,6 +13,8 @@ class Model(Entry): """Uses multiple methods to retrieve some information about the host hardware""" + _ICON = "\ueabe" # UTF-8 Code + LINUX_DMI_SYS_PATH = "/sys/devices/virtual/dmi/id" def __init__(self, *args, **kwargs): diff --git a/archey/entries/packages.py b/archey/entries/packages.py index 982866a7..14f3d9ef 100644 --- a/archey/entries/packages.py +++ b/archey/entries/packages.py @@ -48,6 +48,8 @@ def get_homebrew_cellar_path() -> str: class Packages(Entry): """Relies on the first found packages manager to list the installed packages""" + _ICON = "\ueb29" # UTF-8 Code + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/processes.py b/archey/entries/processes.py index f2c83581..997d3c27 100644 --- a/archey/entries/processes.py +++ b/archey/entries/processes.py @@ -9,6 +9,8 @@ class Processes(Entry): Simple wrapper to `archey.processes` to provide the number of running processes as an entry. """ + _ICON = "\ueba2" # UTF-8 Code + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/ram.py b/archey/entries/ram.py index 79877a5a..318211cf 100644 --- a/archey/entries/ram.py +++ b/archey/entries/ram.py @@ -18,6 +18,8 @@ class RAM(Entry): If not available, falls back on the parsing of `/proc/meminfo` file. """ + _ICON = "\U000f035b" # UTF-8 Code + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/shell.py b/archey/entries/shell.py index d00037c8..309d7c6e 100644 --- a/archey/entries/shell.py +++ b/archey/entries/shell.py @@ -13,6 +13,8 @@ class Shell(Entry): the local administrative database. """ + _ICON = "\U000f018d" # UTF-8 Code + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/temperature.py b/archey/entries/temperature.py index 442a3384..e5cfd2b1 100644 --- a/archey/entries/temperature.py +++ b/archey/entries/temperature.py @@ -20,6 +20,8 @@ class Temperature(Entry): On Raspberry devices, retrieves temperature from the `vcgencmd` binary. """ + _ICON = "\U000f1a45" # UTF-8 Code + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/terminal.py b/archey/entries/terminal.py index 0d5919b5..406b5d28 100644 --- a/archey/entries/terminal.py +++ b/archey/entries/terminal.py @@ -60,6 +60,8 @@ class Terminal(Entry): It also displays the colors palette afterwards. """ + _ICON = "\uf120" # UTF-8 Code + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/uptime.py b/archey/entries/uptime.py index 873a0e31..91087907 100644 --- a/archey/entries/uptime.py +++ b/archey/entries/uptime.py @@ -13,6 +13,8 @@ class Uptime(Entry): """Returns a pretty-formatted string representing the host uptime""" + _ICON = "\U000f1925" # UTF-8 Code + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/user.py b/archey/entries/user.py index 9a3eebd4..3f580151 100644 --- a/archey/entries/user.py +++ b/archey/entries/user.py @@ -8,6 +8,8 @@ class User(Entry): """Retrieves the session name of the current logged in user""" + _ICON = "\uf007" # UTF-8 Code + def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/wan_ip.py b/archey/entries/wan_ip.py index 4b031686..8de8d6e3 100644 --- a/archey/entries/wan_ip.py +++ b/archey/entries/wan_ip.py @@ -13,6 +13,7 @@ class WanIP(Entry): """Uses different ways to retrieve the public IPv{4,6} addresses""" + _ICON = "\U000f0a60" # UTF-8 Code _PRETTY_NAME = "WAN IP" def __init__(self, *args, **kwargs): diff --git a/archey/entries/window_manager.py b/archey/entries/window_manager.py index c62ba307..716d80ba 100644 --- a/archey/entries/window_manager.py +++ b/archey/entries/window_manager.py @@ -54,6 +54,7 @@ class WindowManager(Entry): If not available, fall back on a simple iteration over the processes. """ + _ICON = "\ueae4" # UTF-8 Code _PRETTY_NAME = "Window Manager" def __init__(self, *args, **kwargs): From 58b2d37705e949918c156a490c7aa8bdea8069d9 Mon Sep 17 00:00:00 2001 From: Tobilike Date: Wed, 10 Jan 2024 11:40:17 +0100 Subject: [PATCH 04/12] [Icons] Comments updated --- archey/entries/cpu.py | 2 +- archey/entries/desktop_environment.py | 2 +- archey/entries/disk.py | 2 +- archey/entries/distro.py | 2 +- archey/entries/gpu.py | 2 +- archey/entries/hostname.py | 2 +- archey/entries/kernel.py | 2 +- archey/entries/lan_ip.py | 2 +- archey/entries/load_average.py | 2 +- archey/entries/model.py | 2 +- archey/entries/packages.py | 2 +- archey/entries/processes.py | 2 +- archey/entries/ram.py | 2 +- archey/entries/shell.py | 2 +- archey/entries/temperature.py | 2 +- archey/entries/terminal.py | 2 +- archey/entries/uptime.py | 2 +- archey/entries/user.py | 2 +- archey/entries/wan_ip.py | 2 +- archey/entries/window_manager.py | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/archey/entries/cpu.py b/archey/entries/cpu.py index 16df3979..b3f9d4e4 100644 --- a/archey/entries/cpu.py +++ b/archey/entries/cpu.py @@ -19,7 +19,7 @@ class CPU(Entry): Each `dict` **SHOULD** contain only one entry (CPU model name as key and cores count as value). """ - _ICON = "\uf4bc" # UTF-8 Code + _ICON = "\uf4bc" # oct_cpu  _MODEL_NAME_REGEXP = re.compile( r"^model name\s*:\s*(.*)$", diff --git a/archey/entries/desktop_environment.py b/archey/entries/desktop_environment.py index f935f0a6..e56c8402 100644 --- a/archey/entries/desktop_environment.py +++ b/archey/entries/desktop_environment.py @@ -25,7 +25,7 @@ class DesktopEnvironment(Entry): Just iterate over running processes to find a known-entry. If not, rely on the `XDG_CURRENT_DESKTOP` environment variable. """ - _ICON = "\ue23c" # UTF-8 Code + _ICON = "\ue23c" # fae_restore  _PRETTY_NAME = "Desktop Environment" def __init__(self, *args, **kwargs): diff --git a/archey/entries/disk.py b/archey/entries/disk.py index 86ff137a..271380f9 100644 --- a/archey/entries/disk.py +++ b/archey/entries/disk.py @@ -13,7 +13,7 @@ class Disk(Entry): """Uses `df` to compute disk usage across devices""" - _ICON = "\U000f16df" # UTF-8 Code + _ICON = "\U000f16df" # md_tape_drive 󱛟 def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/distro.py b/archey/entries/distro.py index acfc108a..a920bc38 100644 --- a/archey/entries/distro.py +++ b/archey/entries/distro.py @@ -11,7 +11,7 @@ class Distro(Entry): """Uses `distro` and `platform` modules to retrieve distribution and architecture information""" - _ICON = "\uf17c" # UTF-8 Code + _ICON = "\uf17c" # fa_linux  def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/gpu.py b/archey/entries/gpu.py index 13b359c1..99ea1582 100644 --- a/archey/entries/gpu.py +++ b/archey/entries/gpu.py @@ -11,7 +11,7 @@ class GPU(Entry): """Relies on `lspci` or `pciconf` to retrieve graphical device(s) information""" - _ICON = "\ue735" # UTF-8 Code + _ICON = "\ue735" # dev_html5_3d_effects  def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/hostname.py b/archey/entries/hostname.py index 2b98c456..9a5e795c 100644 --- a/archey/entries/hostname.py +++ b/archey/entries/hostname.py @@ -9,7 +9,7 @@ class Hostname(Entry): """Read system file with fallback on `platform` module to retrieve the system host-name""" - _ICON = "\U000f0318" # UTF-8 Code + _ICON = "\U000f0318" # md_lan_connect 󰌘 def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/kernel.py b/archey/entries/kernel.py index c6bbed4b..047b3579 100644 --- a/archey/entries/kernel.py +++ b/archey/entries/kernel.py @@ -18,7 +18,7 @@ class Kernel(Entry): [GNU/LINUX] If user-enabled, implement a version comparison against upstream data. """ - _ICON = "\uf305" # UTF-8 Code + _ICON = "\uf305" # linux_coreos  def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/lan_ip.py b/archey/entries/lan_ip.py index 486a7126..eb56fe42 100644 --- a/archey/entries/lan_ip.py +++ b/archey/entries/lan_ip.py @@ -15,7 +15,7 @@ class LanIP(Entry): """Relies on the `netifaces` module to detect LAN IP addresses""" - _ICON = "\U000f0a60" # UTF-8 Code + _ICON = "\U000f0a60" # md_ip_network 󰩠 _PRETTY_NAME = "LAN IP" def __init__(self, *args, **kwargs): diff --git a/archey/entries/load_average.py b/archey/entries/load_average.py index 8aedd80a..06b65f39 100644 --- a/archey/entries/load_average.py +++ b/archey/entries/load_average.py @@ -10,7 +10,7 @@ class LoadAverage(Entry): """System load average detection entry""" - _ICON = "\U000f051f" # UTF-8 Code + _ICON = "\U000f051f" # md_timer_sand 󰔟 _PRETTY_NAME = "Load Average" def __init__(self, *args, **kwargs): diff --git a/archey/entries/model.py b/archey/entries/model.py index 883ca043..8299334c 100644 --- a/archey/entries/model.py +++ b/archey/entries/model.py @@ -13,7 +13,7 @@ class Model(Entry): """Uses multiple methods to retrieve some information about the host hardware""" - _ICON = "\ueabe" # UTF-8 Code + _ICON = "\ueabe" # cod_circuit_board  LINUX_DMI_SYS_PATH = "/sys/devices/virtual/dmi/id" diff --git a/archey/entries/packages.py b/archey/entries/packages.py index 14f3d9ef..d8dff0fc 100644 --- a/archey/entries/packages.py +++ b/archey/entries/packages.py @@ -48,7 +48,7 @@ def get_homebrew_cellar_path() -> str: class Packages(Entry): """Relies on the first found packages manager to list the installed packages""" - _ICON = "\ueb29" # UTF-8 Code + _ICON = "\ueb29" # cod_package  def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/processes.py b/archey/entries/processes.py index 997d3c27..2fc80b2b 100644 --- a/archey/entries/processes.py +++ b/archey/entries/processes.py @@ -9,7 +9,7 @@ class Processes(Entry): Simple wrapper to `archey.processes` to provide the number of running processes as an entry. """ - _ICON = "\ueba2" # UTF-8 Code + _ICON = "\ueba2" # cod_server_process  def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/ram.py b/archey/entries/ram.py index 318211cf..425e7117 100644 --- a/archey/entries/ram.py +++ b/archey/entries/ram.py @@ -18,7 +18,7 @@ class RAM(Entry): If not available, falls back on the parsing of `/proc/meminfo` file. """ - _ICON = "\U000f035b" # UTF-8 Code + _ICON = "\U000f035b" # md_memory 󰍛 def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/shell.py b/archey/entries/shell.py index 309d7c6e..98e7ddb7 100644 --- a/archey/entries/shell.py +++ b/archey/entries/shell.py @@ -13,7 +13,7 @@ class Shell(Entry): the local administrative database. """ - _ICON = "\U000f018d" # UTF-8 Code + _ICON = "\U000f018d" # md_console 󰆍 def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/temperature.py b/archey/entries/temperature.py index e5cfd2b1..d748b6ed 100644 --- a/archey/entries/temperature.py +++ b/archey/entries/temperature.py @@ -20,7 +20,7 @@ class Temperature(Entry): On Raspberry devices, retrieves temperature from the `vcgencmd` binary. """ - _ICON = "\U000f1a45" # UTF-8 Code + _ICON = "\U000f1a45" # md_heat_wave 󱩅 def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/terminal.py b/archey/entries/terminal.py index 406b5d28..ab4fef68 100644 --- a/archey/entries/terminal.py +++ b/archey/entries/terminal.py @@ -60,7 +60,7 @@ class Terminal(Entry): It also displays the colors palette afterwards. """ - _ICON = "\uf120" # UTF-8 Code + _ICON = "\uf120" # fa_terminal  def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/uptime.py b/archey/entries/uptime.py index 91087907..a8825106 100644 --- a/archey/entries/uptime.py +++ b/archey/entries/uptime.py @@ -13,7 +13,7 @@ class Uptime(Entry): """Returns a pretty-formatted string representing the host uptime""" - _ICON = "\U000f1925" # UTF-8 Code + _ICON = "\U000f1925" # md_timer_cog 󱤥 def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/user.py b/archey/entries/user.py index 3f580151..4e98db97 100644 --- a/archey/entries/user.py +++ b/archey/entries/user.py @@ -8,7 +8,7 @@ class User(Entry): """Retrieves the session name of the current logged in user""" - _ICON = "\uf007" # UTF-8 Code + _ICON = "\uf007" # fa_user  def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/wan_ip.py b/archey/entries/wan_ip.py index 8de8d6e3..ebafafb8 100644 --- a/archey/entries/wan_ip.py +++ b/archey/entries/wan_ip.py @@ -13,7 +13,7 @@ class WanIP(Entry): """Uses different ways to retrieve the public IPv{4,6} addresses""" - _ICON = "\U000f0a60" # UTF-8 Code + _ICON = "\U000f0a60" # # md_ip_network 󰩠 _PRETTY_NAME = "WAN IP" def __init__(self, *args, **kwargs): diff --git a/archey/entries/window_manager.py b/archey/entries/window_manager.py index 716d80ba..2e9900a0 100644 --- a/archey/entries/window_manager.py +++ b/archey/entries/window_manager.py @@ -54,7 +54,7 @@ class WindowManager(Entry): If not available, fall back on a simple iteration over the processes. """ - _ICON = "\ueae4" # UTF-8 Code + _ICON = "\ueae4" # cod_empty_window  _PRETTY_NAME = "Window Manager" def __init__(self, *args, **kwargs): From 61541a5e4de91215a49849e01d0d6b9a4efc96d6 Mon Sep 17 00:00:00 2001 From: Tobilike Date: Wed, 10 Jan 2024 11:46:43 +0100 Subject: [PATCH 05/12] [Icons] readme improved --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a03c0352..37681f8d 100644 --- a/README.md +++ b/README.md @@ -270,9 +270,10 @@ Below stand further descriptions for each available (default) option : // For example, "retro" would show the retro styled Apple logo on Darwin platforms. // Note that the `--logo-style` argument overrides this setting. "logo_style": "", - // Enable icons - // A nerd font is required to activate the icons. Otherwise, these are simply missing and a placeholder can be seen. https://github.com/ryanoasis/nerd-fonts - // Make sure that UTF-8 is supported on your system + // Enable icons for entries + // A nerd font is required to activate the icons. Otherwise, these are simply missing and a placeholder can be seen. + // You can also refer to : . + // Make sure that your system locale supports UTF-8. "entries_icon": false, // Entries list. // Add a `disabled` option set to `true` to temporary hide one. From 9d2c46869c38c107c6edf71ecba7b164784fc9b4 Mon Sep 17 00:00:00 2001 From: Tobilike Date: Wed, 10 Jan 2024 11:56:22 +0100 Subject: [PATCH 06/12] [Icons] If query is now clearer. unittest now pass. --- archey/entry.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/archey/entry.py b/archey/entry.py index c562037b..170a786a 100644 --- a/archey/entry.py +++ b/archey/entry.py @@ -31,14 +31,9 @@ def __init__(self, name: Optional[str] = None, value=None, options: Optional[dic configuration = Configuration() icon = configuration.get("entries_icon") - if icon == True: - if self._ICON == None: - self.name = name or self._PRETTY_NAME or self.__class__.__name__ - else: - self.name = name or self._PRETTY_NAME or self.__class__.__name__ - self.name = self._ICON + " " + self.name - else: - self.name = name or self._PRETTY_NAME or self.__class__.__name__ + self.name = name or self._PRETTY_NAME or self.__class__.__name__ + if self._ICON is not None and Configuration().get("entries_icon"): + self.name = f"{self._ICON} {self.name}" self.value = value self.options = options or {} From 022eff8ebb8479337528cbac51a376c9263c29b2 Mon Sep 17 00:00:00 2001 From: Tobilike Date: Wed, 10 Jan 2024 13:05:52 +0100 Subject: [PATCH 07/12] [Icons] Reformatted with black. --- archey/entries/desktop_environment.py | 1 + 1 file changed, 1 insertion(+) diff --git a/archey/entries/desktop_environment.py b/archey/entries/desktop_environment.py index e56c8402..f3ca50ce 100644 --- a/archey/entries/desktop_environment.py +++ b/archey/entries/desktop_environment.py @@ -25,6 +25,7 @@ class DesktopEnvironment(Entry): Just iterate over running processes to find a known-entry. If not, rely on the `XDG_CURRENT_DESKTOP` environment variable. """ + _ICON = "\ue23c" # fae_restore  _PRETTY_NAME = "Desktop Environment" From 7818a269ae00fd1cde1e0d8d8731d96a1e5bf0ca Mon Sep 17 00:00:00 2001 From: Michael Bromilow <12384431+ingrinder@users.noreply.github.com> Date: Wed, 10 Jan 2024 22:31:48 +0000 Subject: [PATCH 08/12] [Entry] Remove unused vars --- archey/entry.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/archey/entry.py b/archey/entry.py index 170a786a..6fb08242 100644 --- a/archey/entry.py +++ b/archey/entry.py @@ -28,9 +28,6 @@ def __init__(self, name: Optional[str] = None, value=None, options: Optional[dic # `value`: value of entry as an appropriate object; # `options`: configuration options *specific* to an entry instance; - configuration = Configuration() - icon = configuration.get("entries_icon") - self.name = name or self._PRETTY_NAME or self.__class__.__name__ if self._ICON is not None and Configuration().get("entries_icon"): self.name = f"{self._ICON} {self.name}" From 76adaa15a5c949f60d613f95ef6f50ef91479678 Mon Sep 17 00:00:00 2001 From: Tobilike Date: Fri, 12 Jan 2024 05:47:32 +0100 Subject: [PATCH 09/12] [Icons] Fix expected call. --- archey/test/entries/test_archey_lan_ip.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/archey/test/entries/test_archey_lan_ip.py b/archey/test/entries/test_archey_lan_ip.py index d27d3d3d..9dd3aa5e 100644 --- a/archey/test/entries/test_archey_lan_ip.py +++ b/archey/test/entries/test_archey_lan_ip.py @@ -247,9 +247,9 @@ def test_ipv6_and_limit_and_ether(self, _, __): self.assertEqual(output_mock.append.call_count, 3) output_mock.append.assert_has_calls( [ - call("LAN IP", "192.168.1.55"), - call("LAN IP", "2001::45:6789:abcd:6817"), - call("LAN IP", "fe80::abcd:ef0:abef:dead"), + call("\U000f0a60 LAN IP", "192.168.1.55"), + call("\U000f0a60 LAN IP", "2001::45:6789:abcd:6817"), + call("\U000f0a60 LAN IP", "fe80::abcd:ef0:abef:dead"), ] ) From 0bebbf2c40e5431640b32abe600bed1ec4492261 Mon Sep 17 00:00:00 2001 From: Tobilike <80016610+Tobilike@users.noreply.github.com> Date: Fri, 12 Jan 2024 07:48:08 +0100 Subject: [PATCH 10/12] [icons] Revert change. Tests read and apply the config.json. That was unexpected. I have turned the icons on in my config. For testing. --- archey/test/entries/test_archey_lan_ip.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/archey/test/entries/test_archey_lan_ip.py b/archey/test/entries/test_archey_lan_ip.py index 9dd3aa5e..d27d3d3d 100644 --- a/archey/test/entries/test_archey_lan_ip.py +++ b/archey/test/entries/test_archey_lan_ip.py @@ -247,9 +247,9 @@ def test_ipv6_and_limit_and_ether(self, _, __): self.assertEqual(output_mock.append.call_count, 3) output_mock.append.assert_has_calls( [ - call("\U000f0a60 LAN IP", "192.168.1.55"), - call("\U000f0a60 LAN IP", "2001::45:6789:abcd:6817"), - call("\U000f0a60 LAN IP", "fe80::abcd:ef0:abef:dead"), + call("LAN IP", "192.168.1.55"), + call("LAN IP", "2001::45:6789:abcd:6817"), + call("LAN IP", "fe80::abcd:ef0:abef:dead"), ] ) From 320927d35a200c0fea4618613c4ee59671480c2b Mon Sep 17 00:00:00 2001 From: Samuel FORESTIER Date: Sat, 13 Jan 2024 17:11:27 +0100 Subject: [PATCH 11/12] [CORE] Adds (Nerd Fonts) icons for entries --- README.md | 8 +++++--- archey/entries/cpu.py | 2 +- archey/entries/custom.py | 2 ++ archey/entries/desktop_environment.py | 2 +- archey/entries/disk.py | 2 +- archey/entries/distro.py | 2 +- archey/entries/gpu.py | 2 +- archey/entries/hostname.py | 2 +- archey/entries/kernel.py | 2 +- archey/entries/lan_ip.py | 2 +- archey/entries/load_average.py | 2 +- archey/entries/model.py | 2 +- archey/entries/packages.py | 2 +- archey/entries/processes.py | 2 +- archey/entries/ram.py | 2 +- archey/entries/shell.py | 2 +- archey/entries/temperature.py | 2 +- archey/entries/terminal.py | 2 +- archey/entries/uptime.py | 2 +- archey/entries/user.py | 2 +- archey/entries/wan_ip.py | 2 +- archey/entries/window_manager.py | 2 +- archey/entry.py | 14 +++++++++----- 23 files changed, 36 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 45727e3b..05441a89 100644 --- a/README.md +++ b/README.md @@ -270,14 +270,15 @@ Below stand further descriptions for each available (default) option : // For example, "retro" would show the retro styled Apple logo on Darwin platforms. // Note that the `--logo-style` argument overrides this setting. "logo_style": "", - // Enable icons for entries - // A nerd font is required to activate the icons. Otherwise, these are simply missing and a placeholder can be seen. + // Enable icons for entries. + // A terminal "nerd font" is required to display the icons. Otherwise, these are simply missing and a placeholder will be seen. // You can also refer to : . // Make sure that your system locale supports UTF-8. "entries_icon": false, // Entries list. // Add a `disabled` option set to `true` to temporary hide one. // You may change entry displayed name by adding a `name` option. + // You may change entry displayed icon by adding an `icon` option. // You may re-order the entries list as you wish. "entries": [ { "type": "User" }, @@ -441,8 +442,9 @@ Below stand further descriptions for each available (default) option : { "type": "Custom", // `command` option is mandatory. `shell` option defaults to `false`. - // Don't forget to set a `name` ! + // Don't forget to set a `name` (and optionally an icon) ! "name": "GPU", + "icon": "\ue735", // The custom shell command to execute. "shell": true, "command": "lshw -C display 2> /dev/null | rg product | cut -d ':' -f 2", diff --git a/archey/entries/cpu.py b/archey/entries/cpu.py index b3f9d4e4..75ca9e08 100644 --- a/archey/entries/cpu.py +++ b/archey/entries/cpu.py @@ -19,7 +19,7 @@ class CPU(Entry): Each `dict` **SHOULD** contain only one entry (CPU model name as key and cores count as value). """ - _ICON = "\uf4bc" # oct_cpu  + _ICON = "\uf4bc" # oct_cpu _MODEL_NAME_REGEXP = re.compile( r"^model name\s*:\s*(.*)$", diff --git a/archey/entries/custom.py b/archey/entries/custom.py index 10a4d0bf..cd83038b 100644 --- a/archey/entries/custom.py +++ b/archey/entries/custom.py @@ -14,6 +14,8 @@ class Custom(Entry): """Custom entry gathering info based on configuration options""" + _ICON = "\uf013" + def __new__(cls, *_, **kwargs): # Don't load this entry if a configuration file has too broad permissions. # We want to mitigate LPE attacks, as arbitrary commands could be run from a configuration diff --git a/archey/entries/desktop_environment.py b/archey/entries/desktop_environment.py index f3ca50ce..306e2b9f 100644 --- a/archey/entries/desktop_environment.py +++ b/archey/entries/desktop_environment.py @@ -26,7 +26,7 @@ class DesktopEnvironment(Entry): If not, rely on the `XDG_CURRENT_DESKTOP` environment variable. """ - _ICON = "\ue23c" # fae_restore  + _ICON = "\ue23c" # fae_restore _PRETTY_NAME = "Desktop Environment" def __init__(self, *args, **kwargs): diff --git a/archey/entries/disk.py b/archey/entries/disk.py index 271380f9..abafc3ec 100644 --- a/archey/entries/disk.py +++ b/archey/entries/disk.py @@ -13,7 +13,7 @@ class Disk(Entry): """Uses `df` to compute disk usage across devices""" - _ICON = "\U000f16df" # md_tape_drive 󱛟 + _ICON = "\U000f16df" # md_tape_drive def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/distro.py b/archey/entries/distro.py index a920bc38..263d1033 100644 --- a/archey/entries/distro.py +++ b/archey/entries/distro.py @@ -11,7 +11,7 @@ class Distro(Entry): """Uses `distro` and `platform` modules to retrieve distribution and architecture information""" - _ICON = "\uf17c" # fa_linux  + _ICON = "\uf17c" # fa_linux def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/gpu.py b/archey/entries/gpu.py index 99ea1582..26f30ce7 100644 --- a/archey/entries/gpu.py +++ b/archey/entries/gpu.py @@ -11,7 +11,7 @@ class GPU(Entry): """Relies on `lspci` or `pciconf` to retrieve graphical device(s) information""" - _ICON = "\ue735" # dev_html5_3d_effects  + _ICON = "\ue735" # dev_html5_3d_effects def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/hostname.py b/archey/entries/hostname.py index 9a5e795c..234b16a7 100644 --- a/archey/entries/hostname.py +++ b/archey/entries/hostname.py @@ -9,7 +9,7 @@ class Hostname(Entry): """Read system file with fallback on `platform` module to retrieve the system host-name""" - _ICON = "\U000f0318" # md_lan_connect 󰌘 + _ICON = "\U000f0318" # md_lan_connect def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/kernel.py b/archey/entries/kernel.py index 047b3579..30647cf1 100644 --- a/archey/entries/kernel.py +++ b/archey/entries/kernel.py @@ -18,7 +18,7 @@ class Kernel(Entry): [GNU/LINUX] If user-enabled, implement a version comparison against upstream data. """ - _ICON = "\uf305" # linux_coreos  + _ICON = "\uf305" # linux_coreos def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/lan_ip.py b/archey/entries/lan_ip.py index eb56fe42..5f31e79b 100644 --- a/archey/entries/lan_ip.py +++ b/archey/entries/lan_ip.py @@ -15,7 +15,7 @@ class LanIP(Entry): """Relies on the `netifaces` module to detect LAN IP addresses""" - _ICON = "\U000f0a60" # md_ip_network 󰩠 + _ICON = "\U000f0a60" # md_ip_network _PRETTY_NAME = "LAN IP" def __init__(self, *args, **kwargs): diff --git a/archey/entries/load_average.py b/archey/entries/load_average.py index 06b65f39..1d76fa0a 100644 --- a/archey/entries/load_average.py +++ b/archey/entries/load_average.py @@ -10,7 +10,7 @@ class LoadAverage(Entry): """System load average detection entry""" - _ICON = "\U000f051f" # md_timer_sand 󰔟 + _ICON = "\U000f051f" # md_timer_sand _PRETTY_NAME = "Load Average" def __init__(self, *args, **kwargs): diff --git a/archey/entries/model.py b/archey/entries/model.py index 8299334c..681ef089 100644 --- a/archey/entries/model.py +++ b/archey/entries/model.py @@ -13,7 +13,7 @@ class Model(Entry): """Uses multiple methods to retrieve some information about the host hardware""" - _ICON = "\ueabe" # cod_circuit_board  + _ICON = "\ueabe" # cod_circuit_board LINUX_DMI_SYS_PATH = "/sys/devices/virtual/dmi/id" diff --git a/archey/entries/packages.py b/archey/entries/packages.py index d8dff0fc..8633ddbf 100644 --- a/archey/entries/packages.py +++ b/archey/entries/packages.py @@ -48,7 +48,7 @@ def get_homebrew_cellar_path() -> str: class Packages(Entry): """Relies on the first found packages manager to list the installed packages""" - _ICON = "\ueb29" # cod_package  + _ICON = "\ueb29" # cod_package def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/processes.py b/archey/entries/processes.py index 2fc80b2b..3fe3153a 100644 --- a/archey/entries/processes.py +++ b/archey/entries/processes.py @@ -9,7 +9,7 @@ class Processes(Entry): Simple wrapper to `archey.processes` to provide the number of running processes as an entry. """ - _ICON = "\ueba2" # cod_server_process  + _ICON = "\ueba2" # cod_server_process def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/ram.py b/archey/entries/ram.py index 425e7117..ba87f0bb 100644 --- a/archey/entries/ram.py +++ b/archey/entries/ram.py @@ -18,7 +18,7 @@ class RAM(Entry): If not available, falls back on the parsing of `/proc/meminfo` file. """ - _ICON = "\U000f035b" # md_memory 󰍛 + _ICON = "\U000f035b" # md_memory def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/shell.py b/archey/entries/shell.py index 98e7ddb7..4050d25c 100644 --- a/archey/entries/shell.py +++ b/archey/entries/shell.py @@ -13,7 +13,7 @@ class Shell(Entry): the local administrative database. """ - _ICON = "\U000f018d" # md_console 󰆍 + _ICON = "\U000f018d" # md_console def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/temperature.py b/archey/entries/temperature.py index d748b6ed..4b878645 100644 --- a/archey/entries/temperature.py +++ b/archey/entries/temperature.py @@ -20,7 +20,7 @@ class Temperature(Entry): On Raspberry devices, retrieves temperature from the `vcgencmd` binary. """ - _ICON = "\U000f1a45" # md_heat_wave 󱩅 + _ICON = "\U000f1a45" # md_heat_wave def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/terminal.py b/archey/entries/terminal.py index ab4fef68..3b5648ce 100644 --- a/archey/entries/terminal.py +++ b/archey/entries/terminal.py @@ -60,7 +60,7 @@ class Terminal(Entry): It also displays the colors palette afterwards. """ - _ICON = "\uf120" # fa_terminal  + _ICON = "\uf120" # fa_terminal def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/uptime.py b/archey/entries/uptime.py index a8825106..09b02224 100644 --- a/archey/entries/uptime.py +++ b/archey/entries/uptime.py @@ -13,7 +13,7 @@ class Uptime(Entry): """Returns a pretty-formatted string representing the host uptime""" - _ICON = "\U000f1925" # md_timer_cog 󱤥 + _ICON = "\U000f1925" # md_timer_cog def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/user.py b/archey/entries/user.py index 4e98db97..be4b48aa 100644 --- a/archey/entries/user.py +++ b/archey/entries/user.py @@ -8,7 +8,7 @@ class User(Entry): """Retrieves the session name of the current logged in user""" - _ICON = "\uf007" # fa_user  + _ICON = "\uf007" # fa_user def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) diff --git a/archey/entries/wan_ip.py b/archey/entries/wan_ip.py index ebafafb8..5b6b96e8 100644 --- a/archey/entries/wan_ip.py +++ b/archey/entries/wan_ip.py @@ -13,7 +13,7 @@ class WanIP(Entry): """Uses different ways to retrieve the public IPv{4,6} addresses""" - _ICON = "\U000f0a60" # # md_ip_network 󰩠 + _ICON = "\U000f0a60" # md_ip_network _PRETTY_NAME = "WAN IP" def __init__(self, *args, **kwargs): diff --git a/archey/entries/window_manager.py b/archey/entries/window_manager.py index 241e105b..3a9e9e8c 100644 --- a/archey/entries/window_manager.py +++ b/archey/entries/window_manager.py @@ -60,7 +60,7 @@ class WindowManager(Entry): If not available, fall back on a simple iteration over the processes. """ - _ICON = "\ueae4" # cod_empty_window  + _ICON = "\ueae4" # cod_empty_window _PRETTY_NAME = "Window Manager" def __init__(self, *args, **kwargs): diff --git a/archey/entry.py b/archey/entry.py index 6fb08242..539bbd6b 100644 --- a/archey/entry.py +++ b/archey/entry.py @@ -11,8 +11,8 @@ class Entry(AbstractBaseClass): """Module base class""" - _PRETTY_NAME: Optional[str] = None _ICON: Optional[str] = None + _PRETTY_NAME: Optional[str] = None def __new__(cls, *_, **kwargs): """Hook object instantiation to handle our particular `disabled` config field""" @@ -23,19 +23,23 @@ def __new__(cls, *_, **kwargs): @abstractmethod def __init__(self, name: Optional[str] = None, value=None, options: Optional[dict] = None): + configuration = Configuration() + # Each entry will have always have the following attributes... # `name`: key (defaults to the instantiated entry class name); # `value`: value of entry as an appropriate object; # `options`: configuration options *specific* to an entry instance; - self.name = name or self._PRETTY_NAME or self.__class__.__name__ - if self._ICON is not None and Configuration().get("entries_icon"): - self.name = f"{self._ICON} {self.name}" self.value = value self.options = options or {} + # optionally prepend entry name with an icon + icon = self.options.get("icon", self._ICON) + if icon is not None and configuration.get("entries_icon"): + self.name = f"{icon} {self.name}" + # Propagates a reference to default strings specified in `Configuration`. - self._default_strings = Configuration().get("default_strings") + self._default_strings = configuration.get("default_strings") # Provision a logger for each entry. self._logger = logging.getLogger(self.__module__) From 48ce75c166826881d26e7398df1009ca8329ef91 Mon Sep 17 00:00:00 2001 From: Samuel FORESTIER Date: Sun, 14 Jan 2024 18:52:09 +0100 Subject: [PATCH 12/12] [CUSTOM] Adds missing entry icon "pretty name" --- archey/entries/custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archey/entries/custom.py b/archey/entries/custom.py index cd83038b..191a7045 100644 --- a/archey/entries/custom.py +++ b/archey/entries/custom.py @@ -14,7 +14,7 @@ class Custom(Entry): """Custom entry gathering info based on configuration options""" - _ICON = "\uf013" + _ICON = "\uf013" # fa_cog def __new__(cls, *_, **kwargs): # Don't load this entry if a configuration file has too broad permissions.