Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2c8261dc9a | |||
| 3219547c92 | |||
| b0bc4e64a9 | |||
| 7bb049ea20 | |||
| 73becf78c4 | |||
| 7f949fe6b2 | |||
| 9abdae5fb4 | |||
| 6ff45d0edd | |||
| 99f99efc1c | |||
| 0c08b3950f | |||
| 2fc419476d | |||
| abac3b2bb3 | |||
| 43924305b9 | |||
| 29f771caec | |||
| 35f5e6eec9 | |||
| 0a7356a560 | |||
| 6a5edd037a |
@@ -6,12 +6,21 @@ neofetch with pride flags <3
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
### Method 1: Install using Python pip (Recommended)
|
||||||
|
|
||||||
Install Python >= 3.7 first. Then, just do:
|
Install Python >= 3.7 first. Then, just do:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
pip install hyfetch
|
pip install hyfetch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Method 2: Install using system package manager
|
||||||
|
|
||||||
|
Currently, these distributions have existing packages for HyFetch:
|
||||||
|
|
||||||
|
* ArchLinux: `yay -S hyfetch` (Thanks to @ Aleksana)
|
||||||
|
* Guix: [In progress](https://issues.guix.gnu.org/54847#8-lineno27)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
When you run `hyfetch` for the first time, it will prompt you to choose a color system and a preset. Just follow the prompt, and everything should work (hopefully). If something doesn't work, feel free to submit an issue!
|
When you run `hyfetch` for the first time, it will prompt you to choose a color system and a preset. Just follow the prompt, and everything should work (hopefully). If something doesn't work, feel free to submit an issue!
|
||||||
@@ -34,6 +43,27 @@ Feel free to experiment with it!
|
|||||||
|
|
||||||
## Change Log
|
## Change Log
|
||||||
|
|
||||||
|
### TODO
|
||||||
|
|
||||||
|
* [ ] Add interactive configurator for adjusting brightness
|
||||||
|
* [ ] Add configuration to emphasize certain parts of the original ASCII art (to make icons like Fedora and Ubuntu look nicer)
|
||||||
|
|
||||||
|
### 1.0.7
|
||||||
|
|
||||||
|
* Fix: Make config path not on init but when it's actually needed.
|
||||||
|
|
||||||
|
### 1.0.6
|
||||||
|
|
||||||
|
* Remove `hypy_utils` dependency to make packaging easier.
|
||||||
|
|
||||||
|
### 1.0.5
|
||||||
|
|
||||||
|
* Fix terminal emulator detection ([PR #2](https://github.com/hykilpikonna/hyfetch/pull/2))
|
||||||
|
|
||||||
|
### 1.0.4
|
||||||
|
|
||||||
|
* Add more flags ([PR #1](https://github.com/hykilpikonna/hyfetch/pull/1))
|
||||||
|
|
||||||
### 1.0.3
|
### 1.0.3
|
||||||
|
|
||||||
* Fix missing dependency for setuptools
|
* Fix missing dependency for setuptools
|
||||||
@@ -53,6 +83,9 @@ Feel free to experiment with it!
|
|||||||
## More Screenshots
|
## More Screenshots
|
||||||
|
|
||||||

|

|
||||||
|

|
||||||
|
|
||||||
|
## Original Readme from Neofetch Below
|
||||||
|
|
||||||
<h3 align="center"><img src="https://i.imgur.com/ZQI2EYz.png" alt="logo" height="100px"></h3>
|
<h3 align="center"><img src="https://i.imgur.com/ZQI2EYz.png" alt="logo" height="100px"></h3>
|
||||||
<p align="center">A command-line system information tool written in bash 3.2+</p>
|
<p align="center">A command-line system information tool written in bash 3.2+</p>
|
||||||
|
|||||||
+2
-1
@@ -1,8 +1,9 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from . import main
|
from . import main
|
||||||
|
|
||||||
|
|
||||||
__version__ = '1.0.3'
|
__version__ = main.VERSION
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -7,6 +7,48 @@ from typing_extensions import Literal
|
|||||||
AnsiMode = Literal['default', 'ansi', '8bit', 'rgb']
|
AnsiMode = Literal['default', 'ansi', '8bit', 'rgb']
|
||||||
|
|
||||||
|
|
||||||
|
MINECRAFT_COLORS = ["&0/\033[0;30m", "&1/\033[0;34m", "&2/\033[0;32m", "&3/\033[0;36m", "&4/\033[0;31m",
|
||||||
|
"&5/\033[0;35m", "&6/\033[0;33m", "&7/\033[0;37m", "&8/\033[1;30m", "&9/\033[1;34m",
|
||||||
|
"&a/\033[1;32m", "&b/\033[1;36m", "&c/\033[1;31m", "&d/\033[1;35m", "&e/\033[1;33m",
|
||||||
|
"&f/\033[1;37m",
|
||||||
|
"&r/\033[0m", "&l/\033[1m", "&o/\033[3m", "&n/\033[4m", "&-/\n"]
|
||||||
|
MINECRAFT_COLORS = [(r[:2], r[3:]) for r in MINECRAFT_COLORS]
|
||||||
|
|
||||||
|
|
||||||
|
def color(msg: str) -> str:
|
||||||
|
"""
|
||||||
|
Replace extended minecraft color codes in string
|
||||||
|
:param msg: Message with minecraft color codes
|
||||||
|
:return: Message with escape codes
|
||||||
|
"""
|
||||||
|
for code, esc in MINECRAFT_COLORS:
|
||||||
|
msg = msg.replace(code, esc)
|
||||||
|
|
||||||
|
while '&gf(' in msg or '&gb(' in msg:
|
||||||
|
i = msg.index('&gf(') if '&gf(' in msg else msg.index('&gb(')
|
||||||
|
end = msg.index(')', i)
|
||||||
|
code = msg[i + 4:end]
|
||||||
|
fore = msg[i + 2] == 'f'
|
||||||
|
|
||||||
|
if code.startswith('#'):
|
||||||
|
rgb = tuple(int(code.lstrip('#')[i:i+2], 16) for i in (0, 2, 4))
|
||||||
|
else:
|
||||||
|
code = code.replace(',', ' ').replace(';', ' ').replace(' ', ' ')
|
||||||
|
rgb = tuple(int(c) for c in code.split(' '))
|
||||||
|
|
||||||
|
msg = msg[:i] + RGB(*rgb).to_ansi_rgb(foreground=fore) + msg[end + 1:]
|
||||||
|
|
||||||
|
return msg
|
||||||
|
|
||||||
|
|
||||||
|
def printc(msg: str):
|
||||||
|
"""
|
||||||
|
Print with color
|
||||||
|
:param msg: Message with minecraft color codes
|
||||||
|
"""
|
||||||
|
print(color(msg + '&r'))
|
||||||
|
|
||||||
|
|
||||||
def redistribute_rgb(r: int, g: int, b: int) -> tuple[int, int, int]:
|
def redistribute_rgb(r: int, g: int, b: int) -> tuple[int, int, int]:
|
||||||
"""
|
"""
|
||||||
Redistribute RGB after lightening
|
Redistribute RGB after lightening
|
||||||
|
|||||||
+9
-4
@@ -7,14 +7,13 @@ from dataclasses import dataclass
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Iterable
|
from typing import Iterable
|
||||||
|
|
||||||
from hypy_utils import printc, json_stringify, color
|
from .color_util import AnsiMode, printc, color
|
||||||
|
|
||||||
from .color_util import AnsiMode
|
|
||||||
from .neofetch_util import run_neofetch
|
from .neofetch_util import run_neofetch
|
||||||
from .presets import PRESETS, ColorProfile
|
from .presets import PRESETS, ColorProfile
|
||||||
|
from .serializer import json_stringify
|
||||||
|
|
||||||
CONFIG_PATH = Path.home() / '.config/hyfetch.json'
|
CONFIG_PATH = Path.home() / '.config/hyfetch.json'
|
||||||
CONFIG_PATH.parent.mkdir(exist_ok=True, parents=True)
|
VERSION = '1.0.7'
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -23,6 +22,7 @@ class Config:
|
|||||||
mode: AnsiMode
|
mode: AnsiMode
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
|
CONFIG_PATH.parent.mkdir(exist_ok=True, parents=True)
|
||||||
CONFIG_PATH.write_text(json_stringify(self), 'utf-8')
|
CONFIG_PATH.write_text(json_stringify(self), 'utf-8')
|
||||||
|
|
||||||
|
|
||||||
@@ -140,9 +140,14 @@ def run():
|
|||||||
parser.add_argument('-m', '--mode', help=f'Color mode', choices=['8bit', 'rgb'])
|
parser.add_argument('-m', '--mode', help=f'Color mode', choices=['8bit', 'rgb'])
|
||||||
parser.add_argument('--c-scale', dest='scale', help=f'Lighten colors by a multiplier', type=float)
|
parser.add_argument('--c-scale', dest='scale', help=f'Lighten colors by a multiplier', type=float)
|
||||||
parser.add_argument('--c-set-l', dest='light', help=f'Set lightness value of the colors', type=float)
|
parser.add_argument('--c-set-l', dest='light', help=f'Set lightness value of the colors', type=float)
|
||||||
|
parser.add_argument('-V', '--version', dest='version', action='store_true', help=f'Check version')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if args.version:
|
||||||
|
print(f'Version is {VERSION}')
|
||||||
|
return
|
||||||
|
|
||||||
# Load config
|
# Load config
|
||||||
config = check_config()
|
config = check_config()
|
||||||
|
|
||||||
|
|||||||
+126
-1
@@ -81,7 +81,6 @@ class ColorProfile:
|
|||||||
result += '\033[0m'
|
result += '\033[0m'
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
PRESETS: dict[str, ColorProfile] = {
|
PRESETS: dict[str, ColorProfile] = {
|
||||||
'rainbow': ColorProfile([
|
'rainbow': ColorProfile([
|
||||||
'#E50000',
|
'#E50000',
|
||||||
@@ -157,4 +156,130 @@ PRESETS: dict[str, ColorProfile] = {
|
|||||||
'#ABABAB',
|
'#ABABAB',
|
||||||
'#000000'
|
'#000000'
|
||||||
]),
|
]),
|
||||||
|
# below sourced from https://www.flagcolorcodes.com/flags/pride
|
||||||
|
# goto f"https://www.flagcolorcodes.com/{preset}" for info
|
||||||
|
# todo: sane sorting
|
||||||
|
'autosexual': ColorProfile([
|
||||||
|
'#99D9EA',
|
||||||
|
'#7F7F7F'
|
||||||
|
]),
|
||||||
|
'intergender': ColorProfile([
|
||||||
|
# todo: use weighted spacing
|
||||||
|
'#900DC2',
|
||||||
|
'#900DC2',
|
||||||
|
'#FFE54F',
|
||||||
|
'#900DC2',
|
||||||
|
'#900DC2',
|
||||||
|
]),
|
||||||
|
'greygender': ColorProfile([
|
||||||
|
'#B3B3B3',
|
||||||
|
'#B3B3B3',
|
||||||
|
'#FFFFFF',
|
||||||
|
'#062383',
|
||||||
|
'#062383',
|
||||||
|
'#FFFFFF',
|
||||||
|
'#535353',
|
||||||
|
'#535353',
|
||||||
|
]),
|
||||||
|
'akiosexual': ColorProfile([
|
||||||
|
'#F9485E',
|
||||||
|
'#FEA06A',
|
||||||
|
'#FEF44C',
|
||||||
|
'#FFFFFF',
|
||||||
|
'#000000',
|
||||||
|
]),
|
||||||
|
'transmasculine': ColorProfile([
|
||||||
|
'#FF8ABD',
|
||||||
|
'#CDF5FE',
|
||||||
|
'#9AEBFF',
|
||||||
|
'#74DFFF',
|
||||||
|
'#9AEBFF',
|
||||||
|
'#CDF5FE',
|
||||||
|
'#FF8ABD',
|
||||||
|
]),
|
||||||
|
'demifaun': ColorProfile([
|
||||||
|
'#7F7F7F',
|
||||||
|
'#7F7F7F',
|
||||||
|
'#C6C6C6',
|
||||||
|
'#C6C6C6',
|
||||||
|
'#FCC688',
|
||||||
|
'#FFF19C',
|
||||||
|
'#FFFFFF',
|
||||||
|
'#8DE0D5',
|
||||||
|
'#9682EC',
|
||||||
|
'#C6C6C6',
|
||||||
|
'#C6C6C6',
|
||||||
|
'#7F7F7F',
|
||||||
|
'#7F7F7F',
|
||||||
|
]),
|
||||||
|
'neutrois': ColorProfile([
|
||||||
|
'#FFFFFF',
|
||||||
|
'#1F9F00',
|
||||||
|
'#000000'
|
||||||
|
]),
|
||||||
|
'biromantic alt 2': ColorProfile([
|
||||||
|
'#8869A5',
|
||||||
|
'#D8A7D8',
|
||||||
|
'#FFFFFF',
|
||||||
|
'#FDB18D',
|
||||||
|
'#151638',
|
||||||
|
]),
|
||||||
|
'biromantic alt 2': ColorProfile([
|
||||||
|
'#740194',
|
||||||
|
'#AEB1AA',
|
||||||
|
'#FFFFFF',
|
||||||
|
'#AEB1AA',
|
||||||
|
'#740194',
|
||||||
|
]),
|
||||||
|
'autoromantic': ColorProfile([ # symbol interpreted
|
||||||
|
'#99D9EA',
|
||||||
|
'#99D9EA',
|
||||||
|
'#99D9EA',
|
||||||
|
'#99D9EA',
|
||||||
|
'#99D9EA',
|
||||||
|
'#000000',
|
||||||
|
'#3DA542',
|
||||||
|
'#3DA542',
|
||||||
|
'#000000',
|
||||||
|
'#7F7F7F',
|
||||||
|
'#7F7F7F',
|
||||||
|
'#7F7F7F',
|
||||||
|
'#7F7F7F',
|
||||||
|
'#7F7F7F',
|
||||||
|
]),
|
||||||
|
# i didn't expect this one to work. cool!
|
||||||
|
'boyflux alt 2': ColorProfile([
|
||||||
|
'#E48AE4',
|
||||||
|
'#9A81B4',
|
||||||
|
'#55BFAB',
|
||||||
|
'#FFFFFF',
|
||||||
|
'#A8A8A8',
|
||||||
|
'#81D5EF',
|
||||||
|
'#81D5EF',
|
||||||
|
'#81D5EF',
|
||||||
|
'#81D5EF',
|
||||||
|
'#81D5EF',
|
||||||
|
'#69ABE5',
|
||||||
|
'#69ABE5',
|
||||||
|
'#69ABE5',
|
||||||
|
'#69ABE5',
|
||||||
|
'#69ABE5',
|
||||||
|
'#69ABE5',
|
||||||
|
'#69ABE5',
|
||||||
|
'#69ABE5',
|
||||||
|
'#69ABE5',
|
||||||
|
'#69ABE5',
|
||||||
|
'#5276D4',
|
||||||
|
'#5276D4',
|
||||||
|
'#5276D4',
|
||||||
|
'#5276D4',
|
||||||
|
'#5276D4',
|
||||||
|
'#5276D4',
|
||||||
|
'#5276D4',
|
||||||
|
'#5276D4',
|
||||||
|
'#5276D4',
|
||||||
|
'#5276D4',
|
||||||
|
]),
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import dataclasses
|
||||||
|
import json
|
||||||
|
from datetime import datetime, date
|
||||||
|
|
||||||
|
|
||||||
|
class EnhancedJSONEncoder(json.JSONEncoder):
|
||||||
|
"""
|
||||||
|
An improvement to the json.JSONEncoder class, which supports:
|
||||||
|
encoding for dataclasses, encoding for datetime, and sets
|
||||||
|
"""
|
||||||
|
|
||||||
|
def default(self, o: object) -> object:
|
||||||
|
|
||||||
|
# Support encoding dataclasses
|
||||||
|
# https://stackoverflow.com/a/51286749/7346633
|
||||||
|
if dataclasses.is_dataclass(o):
|
||||||
|
return dataclasses.asdict(o)
|
||||||
|
|
||||||
|
# Support encoding datetime
|
||||||
|
if isinstance(o, (datetime, date)):
|
||||||
|
return o.isoformat()
|
||||||
|
|
||||||
|
# Support for sets
|
||||||
|
# https://stackoverflow.com/a/8230505/7346633
|
||||||
|
if isinstance(o, set):
|
||||||
|
return list(o)
|
||||||
|
|
||||||
|
return super().default(o)
|
||||||
|
|
||||||
|
|
||||||
|
def json_stringify(obj: object, indent: int | None = None) -> str:
|
||||||
|
"""
|
||||||
|
Serialize json string with support for dataclasses and datetime and sets and with custom
|
||||||
|
configuration.
|
||||||
|
Preconditions:
|
||||||
|
- obj != None
|
||||||
|
:param obj: Objects
|
||||||
|
:param indent: Indent size or none
|
||||||
|
:return: Json strings
|
||||||
|
"""
|
||||||
|
return json.dumps(obj, indent=indent, cls=EnhancedJSONEncoder, ensure_ascii=False)
|
||||||
@@ -3315,7 +3315,7 @@ get_term() {
|
|||||||
name="$(get_process_name "$parent")"
|
name="$(get_process_name "$parent")"
|
||||||
|
|
||||||
case ${name// } in
|
case ${name// } in
|
||||||
"${SHELL/*\/}"|*"sh"|"screen"|"su"*|"newgrp") ;;
|
"${SHELL/*\/}"|*"sh"|"screen"|"su"*|"newgrp"|"hyfetch") ;;
|
||||||
|
|
||||||
"login"*|*"Login"*|"init"|"(init)")
|
"login"*|*"Login"*|"init"|"(init)")
|
||||||
term="$(tty)"
|
term="$(tty)"
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ setup(
|
|||||||
packages=['hyfetch'],
|
packages=['hyfetch'],
|
||||||
package_data={'hyfetch': ['hyfetch/*']},
|
package_data={'hyfetch': ['hyfetch/*']},
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
install_requires=['setuptools', 'hypy_utils==1.0.6', 'typing_extensions'],
|
install_requires=['setuptools', 'typing_extensions'],
|
||||||
entry_points={
|
entry_points={
|
||||||
"console_scripts": [
|
"console_scripts": [
|
||||||
"hyfetch=hyfetch.main:run",
|
"hyfetch=hyfetch.main:run",
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
from hypy_utils import printc
|
from hyfetch.color_util import RGB, printc
|
||||||
|
|
||||||
from hyfetch.color_util import RGB
|
|
||||||
from hyfetch.neofetch_util import get_command_path, run_neofetch
|
from hyfetch.neofetch_util import get_command_path, run_neofetch
|
||||||
from hyfetch.presets import PRESETS
|
from hyfetch.presets import PRESETS
|
||||||
|
|
||||||
@@ -35,6 +33,5 @@ def test_rgb_8bit_conversion():
|
|||||||
print()
|
print()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test_rgb_8bit_conversion()
|
test_rgb_8bit_conversion()
|
||||||
|
|||||||
Reference in New Issue
Block a user