diff options
Diffstat (limited to '')
| -rw-r--r-- | .config/fastfetch/confgen.py | 104 |
1 files changed, 99 insertions, 5 deletions
diff --git a/.config/fastfetch/confgen.py b/.config/fastfetch/confgen.py index 92ed0d3..4452582 100644 --- a/.config/fastfetch/confgen.py +++ b/.config/fastfetch/confgen.py | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #!/usr/bin/env python3 | 1 | #!/usr/bin/env python3 |
| 2 | 2 | ||
| 3 | from typing import Optional | 3 | from typing import Optional, Any |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | class Node: | 6 | class Node: |
| @@ -8,15 +8,17 @@ class Node: | |||
| 8 | key: str | 8 | key: str |
| 9 | format: Optional[str] | 9 | format: Optional[str] |
| 10 | text: Optional[str] | 10 | text: Optional[str] |
| 11 | additional_entries: Optional[dict[str, type[Any]]] | ||
| 11 | font_effect: Optional[str] | 12 | font_effect: Optional[str] |
| 12 | neighbour_branches: str | 13 | neighbour_branches: str |
| 13 | children: list["Node"] = [] | 14 | children: list["Node"] = [] |
| 14 | 15 | ||
| 15 | def __init__(self, module, key, format=None, text=None, font_effect=None): | 16 | def __init__(self, module, key, format=None, additional_entries=None, text=None, font_effect=None): |
| 16 | self.module = module | 17 | self.module = module |
| 17 | self.key = key | 18 | self.key = key |
| 18 | self.format = format | 19 | self.format = format |
| 19 | self.text = text | 20 | self.text = text |
| 21 | self.additional_entries = additional_entries | ||
| 20 | self.font_effect = font_effect | 22 | self.font_effect = font_effect |
| 21 | 23 | ||
| 22 | def __str__(self) -> str: | 24 | def __str__(self) -> str: |
| @@ -42,7 +44,12 @@ class Node: | |||
| 42 | else: | 44 | else: |
| 43 | text = {} | 45 | text = {} |
| 44 | 46 | ||
| 45 | return module | key | format | text | 47 | if self.additional_entries: |
| 48 | additional_entries = self.additional_entries | ||
| 49 | else: | ||
| 50 | additional_entries = {} | ||
| 51 | |||
| 52 | return module | key | format | text | additional_entries | ||
| 46 | 53 | ||
| 47 | def add_children(self, *nodes: type["Node"]): | 54 | def add_children(self, *nodes: type["Node"]): |
| 48 | for node in nodes: | 55 | for node in nodes: |
| @@ -77,8 +84,95 @@ graphics = { | |||
| 77 | modules = { | 84 | modules = { |
| 78 | "software_root": Node("custom", "Software", font_effect=font_effects["software"]), | 85 | "software_root": Node("custom", "Software", font_effect=font_effects["software"]), |
| 79 | "os": Node("os", "OS"), | 86 | "os": Node("os", "OS"), |
| 87 | "bootmgr": Node("bootmgr", "Boot", format="{name}"), | ||
| 88 | "init": Node("initsystem", "Init"), | ||
| 89 | "kernel": Node("kernel", "Kernel"), | ||
| 90 | "lm": Node("lm", "LM"), | ||
| 91 | "packages": Node("packages", "Packages"), | ||
| 92 | "terminal": Node("terminal", "Terminal", font_effect=font_effects["terminal"]), | ||
| 93 | "terminal_font": Node("terminalfont", "Font"), | ||
| 94 | "shell": Node("shell", "Shell"), | ||
| 95 | "graphics": Node("custom", "Graphics", font_effect=font_effects["graphics"]), | ||
| 96 | "de": Node("de", "DE"), | ||
| 97 | "wm": Node("wm", "WM"), | ||
| 98 | "icons": Node("icons", "Icons"), | ||
| 99 | "cursor": Node("cursor", "Cursor"), | ||
| 100 | "font": Node("font", "Font"), | ||
| 101 | "theme": Node("theme", "Theme"), | ||
| 102 | "development": Node("custom", "Development", font_effect=font_effects["development"]), | ||
| 103 | "editor": Node("editor", "Editor"), | ||
| 104 | "git": Node("command", "Git", text="git --version", format="{~12}"), | ||
| 105 | "python": Node("command", "Python", text="python --version", format="{~7}"), | ||
| 106 | "gcc": Node("command", "GCC", text="gcc --version | head -1 | cut -d ' ' -f 3", format="{}"), | ||
| 107 | "clang": Node("command", "Clang", text="clang --version | head -1 | cut -d ' ' -f 3", format="{}"), | ||
| 108 | "nodejs": Node("command", "NodeJS", text="node --version", format="{}"), | ||
| 109 | "hardware_root": Node("custom", "Hardware", font_effect=font_effects["hardware"]), | ||
| 110 | "chassis": Node("chassis", "Chassis"), | ||
| 111 | "host": Node("host", "Host", format="{vendor} {name}"), | ||
| 112 | "board": Node("board", "Board"), | ||
| 113 | "bios": Node("bios", "BIOS", format="[{type}] {vendor} {version}"), | ||
| 114 | "cpu": Node("cpu", "CPU"), | ||
| 115 | "cpu_cache": Node("cpucache", "CPU Cache"), | ||
| 116 | "gpu": Node("gpu", "GPU", format="[{type}] {vendor} {name}"), | ||
| 117 | "gpu_driver": Node("gpu", "Driver", format="{driver}"), | ||
| 118 | "disk": Node("disk", "Disk"), | ||
| 119 | "ram": Node("memory", "RAM"), | ||
| 120 | "swap": Node("swap", "Swap"), | ||
| 121 | "battery": Node("battery", "Battery"), | ||
| 122 | "display": Node("display", "Display"), | ||
| 123 | "misc_root": Node("custom", "Miscellaneous information", font_effect=font_effects["miscellaneous"]), | ||
| 124 | "datetime": Node("datetime", "Date & Time"), | ||
| 125 | "uptime": Node("uptime", "Uptime"), | ||
| 126 | "os_age": Node("disk", "OS age", format="{days} days (since {create-time:10})", additional_entries={"folders": "/"}), | ||
| 127 | "media": Node("media", "Now playing"), | ||
| 128 | "version": Node("version", "Fastfetch", format="{version}"), | ||
| 80 | } | 129 | } |
| 81 | 130 | ||
| 82 | modules["software_root"].add_children(modules["os"]) | 131 | modules["software_root"].add_children( |
| 132 | modules["os"].add_children( | ||
| 133 | modules["bootmgr"], | ||
| 134 | modules["init"], | ||
| 135 | modules["kernel"], | ||
| 136 | modules["lm"], | ||
| 137 | modules["packages"], | ||
| 138 | ), | ||
| 139 | modules["terminal"].add_children( | ||
| 140 | modules["shell"], | ||
| 141 | modules["terminal_font"], | ||
| 142 | ), | ||
| 143 | modules["graphics"].add_children( | ||
| 144 | modules["de"], | ||
| 145 | modules["wm"], | ||
| 146 | modules["icons"], | ||
| 147 | modules["cursor"], | ||
| 148 | modules["font"], | ||
| 149 | modules["theme"], | ||
| 150 | ), | ||
| 151 | modules["development"].add_children( | ||
| 152 | modules["editor"], | ||
| 153 | modules["git"], | ||
| 154 | modules["python"], | ||
| 155 | modules["gcc"], | ||
| 156 | modules["clang"], | ||
| 157 | modules["nodejs"], | ||
| 158 | ), | ||
| 159 | ) | ||
| 160 | |||
| 161 | modules["hardware_root"].add_children( | ||
| 162 | modules["chassis"].add_children( | ||
| 163 | modules["host"], | ||
| 164 | modules["board"].add_children(modules["bios"]), | ||
| 165 | modules["cpu"].add_children(modules["cpu_cache"]), | ||
| 166 | modules["gpu"].add_children(modules["gpu_driver"]), | ||
| 167 | modules["disk"], | ||
| 168 | modules["ram"].add_children(modules["swap"]), | ||
| 169 | ), | ||
| 170 | modules["display"] | ||
| 171 | ) | ||
| 83 | 172 | ||
| 84 | print(modules["software_root"]) | 173 | modules["misc_root"].add_children( |
| 174 | modules["datetime"], | ||
| 175 | modules["uptime"], | ||
| 176 | modules["os_age"], | ||
| 177 | modules["version"], | ||
| 178 | ) | ||
