mirror of
https://github.com/HorlogeSkynet/archey4
synced 2025-05-13 16:00:20 +02:00
Compare commits
9 Commits
dec841b19c
...
4dc1232c41
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4dc1232c41 | ||
![]() |
8081a7ee2a | ||
![]() |
6691a8ad69 | ||
![]() |
e83b7a81ea | ||
![]() |
8874d7107f | ||
![]() |
a98ff305c6 | ||
![]() |
7f3b0f9c2c | ||
![]() |
0e244b0855 | ||
![]() |
d62c6d4860 |
@ -2,8 +2,6 @@
|
||||
|
||||
> Archey is a simple system information tool written in Python
|
||||
|
||||
This is a fork. Also take a look at the original. These are just my changes
|
||||
|
||||
<p align="center">
|
||||
<img src=".github/archey4.png" alt="Archey logo" title="CC-BY Brume Archey logo" longdesc="https://brume.ink/">
|
||||
<br />
|
||||
@ -272,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.
|
||||
|
@ -16,7 +16,7 @@ DEFAULT_CONFIG: Dict[str, Any] = {
|
||||
"suppress_warnings": False,
|
||||
"entries_color": "",
|
||||
"honor_ansi_color": True,
|
||||
"icon": False,
|
||||
"entries_icon": False,
|
||||
"default_strings": {
|
||||
"latest": "latest",
|
||||
"available": "available",
|
||||
|
@ -8,20 +8,11 @@ from typing import Dict, List
|
||||
|
||||
from archey.distributions import Distributions
|
||||
from archey.entry import Entry
|
||||
from archey.configuration import Configuration
|
||||
|
||||
|
||||
class CPU(Entry):
|
||||
|
||||
# Icons
|
||||
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = "\uf4bc CPU"
|
||||
|
||||
|
||||
# icon
|
||||
_ICON = "\uf4bc" # UTF-8 Code
|
||||
|
||||
"""
|
||||
Parse `/proc/cpuinfo` file to retrieve model names.
|
||||
|
@ -22,14 +22,10 @@ DE_DICT = {
|
||||
|
||||
|
||||
class DesktopEnvironment(Entry):
|
||||
# Icons
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = "\ue23c Desktop Environment"
|
||||
else:
|
||||
_PRETTY_NAME = "Desktop Environment"
|
||||
# icon and name
|
||||
_ICON = "\ue23c" # UTF-8 Code
|
||||
_PRETTY_NAME = "Desktop Environment"
|
||||
|
||||
"""
|
||||
Just iterate over running processes to find a known-entry.
|
||||
|
@ -3,24 +3,18 @@
|
||||
import platform
|
||||
import plistlib
|
||||
import re
|
||||
|
||||
from subprocess import DEVNULL, PIPE, check_output, run
|
||||
from typing import Dict, Iterable, List
|
||||
|
||||
from archey.colors import Colors
|
||||
from archey.configuration import Configuration
|
||||
from archey.entry import Entry
|
||||
|
||||
|
||||
class Disk(Entry):
|
||||
# Icons
|
||||
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
# icon
|
||||
_ICON = "\U000f16df" # UTF-8 Code
|
||||
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = " Disk"
|
||||
"""Uses `df` to compute disk usage across devices"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -4,19 +4,14 @@ import platform
|
||||
from subprocess import check_output
|
||||
from typing import Optional
|
||||
|
||||
from archey.configuration import Configuration
|
||||
from archey.distributions import Distributions
|
||||
from archey.entry import Entry
|
||||
|
||||
|
||||
class Distro(Entry):
|
||||
# Icons
|
||||
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = "\uf17c Distro"
|
||||
# icon
|
||||
_ICON = "\uf17c" # UTF-8 Code
|
||||
|
||||
"""Uses `distro` and `platform` modules to retrieve distribution and architecture information"""
|
||||
|
||||
|
@ -5,19 +5,13 @@ import re
|
||||
from subprocess import DEVNULL, CalledProcessError, check_output
|
||||
from typing import List
|
||||
|
||||
from archey.configuration import Configuration
|
||||
from archey.entry import Entry
|
||||
|
||||
|
||||
class GPU(Entry):
|
||||
# Icons
|
||||
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = "\ue735 GPU"
|
||||
|
||||
# icon
|
||||
_ICON = "\ue735" # UTF-8 Code
|
||||
|
||||
"""Relies on `lspci` or `pciconf` to retrieve graphical device(s) information"""
|
||||
|
||||
|
@ -3,18 +3,13 @@
|
||||
import platform
|
||||
from typing import Optional
|
||||
|
||||
from archey.configuration import Configuration
|
||||
from archey.entry import Entry
|
||||
|
||||
|
||||
class Hostname(Entry):
|
||||
# Icons
|
||||
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = " Hostname"
|
||||
# icon
|
||||
_ICON = "\U000f0318" # UTF-8 Code
|
||||
|
||||
"""Read system file with fallback on `platform` module to retrieve the system host-name"""
|
||||
|
||||
|
@ -14,13 +14,9 @@ from archey.utility import Utility
|
||||
|
||||
|
||||
class Kernel(Entry):
|
||||
# Icons
|
||||
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = "\uf305 Kernel"
|
||||
# icon
|
||||
_ICON = "\uf305" # UTF-8 Code
|
||||
|
||||
"""
|
||||
Retrieve kernel identity.
|
||||
|
@ -4,8 +4,6 @@ import ipaddress
|
||||
from itertools import islice
|
||||
from typing import Iterator
|
||||
|
||||
from archey.configuration import Configuration
|
||||
|
||||
try:
|
||||
import netifaces
|
||||
except ImportError:
|
||||
@ -15,18 +13,12 @@ from archey.entry import Entry
|
||||
|
||||
|
||||
class LanIP(Entry):
|
||||
# Icons
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = " LAN IP"
|
||||
else:
|
||||
_PRETTY_NAME = "LAN IP"
|
||||
# icon and name
|
||||
_ICON = "\U000f0a60" # UTF-8 Code
|
||||
_PRETTY_NAME = "LAN IP"
|
||||
|
||||
"""Relies on the `netifaces` module to detect LAN IP addresses"""
|
||||
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
@ -62,7 +54,7 @@ class LanIP(Entry):
|
||||
|
||||
@staticmethod
|
||||
def _lan_ip_addresses_generator(
|
||||
addr_families: list, show_global: bool, show_link_local: bool
|
||||
addr_families: list, show_global: bool, show_link_local: bool
|
||||
) -> Iterator[str]:
|
||||
"""Generator yielding local IP address according to passed address families"""
|
||||
# Loop through all available network interfaces.
|
||||
@ -77,9 +69,9 @@ class LanIP(Entry):
|
||||
|
||||
# Filter out loopback and public/link-local IP addresses (if enabled).
|
||||
if (
|
||||
not ip_addr.is_loopback
|
||||
and (not ip_addr.is_global or show_global)
|
||||
and (not ip_addr.is_link_local or show_link_local)
|
||||
not ip_addr.is_loopback
|
||||
and (not ip_addr.is_global or show_global)
|
||||
and (not ip_addr.is_link_local or show_link_local)
|
||||
):
|
||||
# Finally, yield the address compressed representation.
|
||||
yield ip_addr.compressed
|
||||
|
@ -4,19 +4,14 @@ import os
|
||||
from contextlib import suppress
|
||||
|
||||
from archey.colors import Colors
|
||||
from archey.configuration import Configuration
|
||||
from archey.entry import Entry
|
||||
|
||||
|
||||
class LoadAverage(Entry):
|
||||
# Icons
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
# icon and name
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = " Load Average"
|
||||
else:
|
||||
_PRETTY_NAME = "Load Average"
|
||||
_ICON = "\U000f051f" # UTF-8 Code
|
||||
_PRETTY_NAME = "Load Average"
|
||||
|
||||
"""System load average detection entry"""
|
||||
|
||||
|
@ -6,19 +6,14 @@ import re
|
||||
from subprocess import DEVNULL, CalledProcessError, check_output
|
||||
from typing import Optional
|
||||
|
||||
from archey.configuration import Configuration
|
||||
from archey.distributions import Distributions
|
||||
from archey.entry import Entry
|
||||
|
||||
|
||||
class Model(Entry):
|
||||
# Icons
|
||||
# icon
|
||||
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = "\ueabe model"
|
||||
_ICON = "\ueabe" # UTF-8 Code
|
||||
|
||||
"""Uses multiple methods to retrieve some information about the host hardware"""
|
||||
|
||||
|
@ -5,7 +5,6 @@ import typing
|
||||
from contextlib import suppress
|
||||
from subprocess import DEVNULL, CalledProcessError, check_output
|
||||
|
||||
from archey.configuration import Configuration
|
||||
from archey.distributions import Distributions
|
||||
from archey.entry import Entry
|
||||
|
||||
@ -47,13 +46,9 @@ PACKAGES_TOOLS = (
|
||||
|
||||
|
||||
class Packages(Entry):
|
||||
# Icons
|
||||
# icon
|
||||
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = "\ueb29 Packages"
|
||||
_ICON = "\ueb29" # UTF-8 Code
|
||||
|
||||
"""Relies on the first found packages manager to list the installed packages"""
|
||||
|
||||
|
@ -2,18 +2,12 @@
|
||||
|
||||
from archey.entry import Entry
|
||||
from archey.processes import Processes as ProcessesUtil
|
||||
from archey.configuration import Configuration
|
||||
|
||||
|
||||
class Processes(Entry):
|
||||
# icon
|
||||
|
||||
# Icons
|
||||
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = "\ueba2 Processes"
|
||||
_ICON = "\ueba2" # UTF-8 Code
|
||||
|
||||
"""
|
||||
Simple wrapper to `archey.processes` to provide the number of running processes as an entry.
|
||||
|
@ -8,19 +8,14 @@ from subprocess import check_output
|
||||
from typing import Tuple
|
||||
|
||||
from archey.colors import Colors
|
||||
from archey.configuration import Configuration
|
||||
from archey.entry import Entry
|
||||
from archey.exceptions import ArcheyException
|
||||
|
||||
|
||||
class RAM(Entry):
|
||||
# Icons
|
||||
# icon
|
||||
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = " RAM"
|
||||
_ICON = "\U000f035b" # UTF-8 Code
|
||||
|
||||
"""
|
||||
First tries to use the `free` command to retrieve RAM usage.
|
||||
|
@ -4,18 +4,13 @@ import os
|
||||
from subprocess import CalledProcessError, check_output
|
||||
from typing import Optional
|
||||
|
||||
from archey.configuration import Configuration
|
||||
from archey.entry import Entry
|
||||
|
||||
|
||||
class Shell(Entry):
|
||||
# Icons
|
||||
# icon
|
||||
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = " shell"
|
||||
_ICON = "\U000f018d" # UTF-8 Code
|
||||
|
||||
"""
|
||||
Simple shell path detection based either on the `SHELL` environment variable or
|
||||
|
@ -9,18 +9,13 @@ from glob import iglob
|
||||
from subprocess import DEVNULL, PIPE, CalledProcessError, check_output, run
|
||||
from typing import List, Optional
|
||||
|
||||
from archey.configuration import Configuration
|
||||
from archey.entry import Entry
|
||||
|
||||
|
||||
class Temperature(Entry):
|
||||
# Icons
|
||||
# icon
|
||||
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = " Temperature"
|
||||
_ICON = "\U000f1a45" # UTF-8 Code
|
||||
|
||||
"""
|
||||
Tries to compute an average temperature from `sensors` (LM-Sensors).
|
||||
|
@ -5,7 +5,6 @@ import re
|
||||
from typing import Optional
|
||||
|
||||
from archey.colors import Colors, Style
|
||||
from archey.configuration import Configuration
|
||||
from archey.entry import Entry
|
||||
|
||||
# We detect a terminal by using the following three constants in the order below:
|
||||
@ -56,13 +55,9 @@ ENV_DICT = {
|
||||
|
||||
|
||||
class Terminal(Entry):
|
||||
# Icons
|
||||
# icon
|
||||
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = "\uf120 Terminal"
|
||||
_ICON = "\uf120" # UTF-8 Code
|
||||
|
||||
"""
|
||||
Simple terminal detection based on the `TERM` environment variable.
|
||||
|
@ -6,19 +6,14 @@ from contextlib import suppress
|
||||
from datetime import timedelta
|
||||
from subprocess import PIPE, run
|
||||
|
||||
from archey.configuration import Configuration
|
||||
from archey.entry import Entry
|
||||
from archey.exceptions import ArcheyException
|
||||
|
||||
|
||||
class Uptime(Entry):
|
||||
# Icons
|
||||
# icon
|
||||
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = " Uptime"
|
||||
_ICON = "\U000f1925" # UTF-8 Code
|
||||
|
||||
"""Returns a pretty-formatted string representing the host uptime"""
|
||||
|
||||
|
@ -2,18 +2,13 @@
|
||||
|
||||
import getpass
|
||||
|
||||
from archey.configuration import Configuration
|
||||
from archey.entry import Entry
|
||||
|
||||
|
||||
class User(Entry):
|
||||
# Icons
|
||||
# icon
|
||||
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = "\uf007 User"
|
||||
_ICON = "\uf007" # UTF-8 Code
|
||||
|
||||
"""Retrieves the session name of the current logged in user"""
|
||||
|
||||
|
@ -6,20 +6,14 @@ from typing import Optional
|
||||
from urllib.error import URLError
|
||||
from urllib.request import urlopen
|
||||
|
||||
from archey.configuration import Configuration
|
||||
from archey.entry import Entry
|
||||
from archey.environment import Environment
|
||||
|
||||
|
||||
class WanIP(Entry):
|
||||
# Icons
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = " WAN IP"
|
||||
else:
|
||||
_PRETTY_NAME = "WAN IP"
|
||||
# icon and name
|
||||
_ICON = "\U000f0a60" # UTF-8 Code
|
||||
_PRETTY_NAME = "WAN IP"
|
||||
|
||||
"""Uses different ways to retrieve the public IPv{4,6} addresses"""
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
"""Windows manager detection class"""
|
||||
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
from subprocess import DEVNULL, CalledProcessError, check_output
|
||||
|
||||
from archey.configuration import Configuration
|
||||
from archey.entry import Entry
|
||||
from archey.processes import Processes
|
||||
|
||||
@ -50,14 +50,10 @@ WM_DICT = {
|
||||
|
||||
|
||||
class WindowManager(Entry):
|
||||
# Icons
|
||||
configuration = Configuration()
|
||||
icon = configuration.get("icon")
|
||||
# icon and name
|
||||
|
||||
if icon == True:
|
||||
_PRETTY_NAME = "\ueae4 Window Manager"
|
||||
else:
|
||||
_PRETTY_NAME = "Window Manager"
|
||||
_ICON = "\ueae4" # UTF-8 Code
|
||||
_PRETTY_NAME = "Window Manager"
|
||||
|
||||
"""
|
||||
Uses `wmctrl` to retrieve some information about the window manager.
|
||||
|
@ -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 @@ class Entry(AbstractBaseClass):
|
||||
# `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 {}
|
||||
|
||||
|
8
start.py
8
start.py
@ -1,8 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from archey.__main__ import main
|
||||
if __name__ == "__main__":
|
||||
sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
|
||||
sys.exit(main())
|
Loading…
x
Reference in New Issue
Block a user