From 700bbdda8eaac0fa5b77ffaf73b14094faeb3ecf Mon Sep 17 00:00:00 2001 From: Luca Pattocchio Date: Thu, 22 Aug 2024 18:32:47 +0200 Subject: [PATCH] Add fastfetch config Check on config file Add migration --- configs/fastfetch.jsonc | 143 ++++++++++++++++++++++++++++++ install/terminal/app-fastfetch.sh | 7 ++ migrations/1724344367.sh | 11 +++ 3 files changed, 161 insertions(+) create mode 100644 configs/fastfetch.jsonc create mode 100644 migrations/1724344367.sh diff --git a/configs/fastfetch.jsonc b/configs/fastfetch.jsonc new file mode 100644 index 0000000..df5970d --- /dev/null +++ b/configs/fastfetch.jsonc @@ -0,0 +1,143 @@ +{ + "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json", + "logo": { + "padding": { + "top": 5, + "right": 6 + } + }, + "modules": [ + "break", + { + "type": "custom", + "format": "\u001b[90m┌──────────────────────Hardware──────────────────────┐" + }, + { + "type": "host", + "key": " PC", + "keyColor": "green" + }, + { + "type": "cpu", + "key": "│ ├", + "showPeCoreCount": true, + "keyColor": "green" + }, + { + "type": "gpu", + "key": "│ ├", + "detectionMethod": "pci", + "keyColor": "green" + }, + { + "type": "display", + "key": "│ ├󱄄", + "keyColor": "green" + }, + { + "type": "disk", + "key": "│ ├󰋊", + "keyColor": "green" + }, + { + "type": "memory", + "key": "│ ├", + "keyColor": "green" + }, + { + "type": "swap", + "key": "└ └󰓡 ", + "keyColor": "green", + }, + { + "type": "custom", + "format": "\u001b[90m└────────────────────────────────────────────────────┘" + }, + "break", + { + "type": "custom", + "format": "\u001b[90m┌──────────────────────Software──────────────────────┐" + }, + { + "type": "os", + "key": " OS", + "keyColor": "yellow" + }, + { + "type": "kernel", + "key": "│ ├", + "keyColor": "yellow" + }, + { + "type": "packages", + "key": "│ ├󰏖", + "keyColor": "yellow" + }, + { + "type": "shell", + "key": "└ └", + "keyColor": "yellow" + }, + "break", + { + "type": "de", + "key": " DE", + "keyColor": "blue" + }, + { + "type": "wm", + "key": "│ ├", + "keyColor": "blue" + }, + { + "type": "wmtheme", + "key": "│ ├󰉼", + "keyColor": "blue" + }, + { + "type": "icons", + "key": "│ ├󰀻", + "keyColor": "blue", + }, + { + "type": "cursor", + "key": "│ ├", + "keyColor": "blue", + }, + { + "type": "terminalfont", + "key": "│ ├", + "keyColor": "blue", + }, + { + "type": "terminal", + "key": "└ └", + "keyColor": "blue" + }, + { + "type": "custom", + "format": "\u001b[90m└────────────────────────────────────────────────────┘" + }, + "break", + { + "type": "custom", + "format": "\u001b[90m┌────────────────────Uptime / Age────────────────────┐" + }, + { + "type": "command", + "key": " OS Age ", + "keyColor": "magenta", + "text": "birth_install=$(stat -c %W /); current=$(date +%s); time_progression=$((current - birth_install)); days_difference=$((time_progression / 86400)); echo $days_difference days" + }, + { + "type": "uptime", + "key": " Uptime ", + "keyColor": "magenta" + }, + { + "type": "custom", + "format": "\u001b[90m└────────────────────────────────────────────────────┘" + }, + "break", + ] +} diff --git a/install/terminal/app-fastfetch.sh b/install/terminal/app-fastfetch.sh index fcc1a5f..9e7817e 100644 --- a/install/terminal/app-fastfetch.sh +++ b/install/terminal/app-fastfetch.sh @@ -2,3 +2,10 @@ sudo add-apt-repository -y ppa:zhangsongcui3371/fastfetch sudo apt update -y sudo apt install -y fastfetch + +# Only attempt to set configuration if fastfetch is not already set +if [ ! -f "$HOME/.config/fastfetch/config.jsonc" ]; then + # Use Omakub fastfetch config + mkdir -p ~/.config/fastfetch + cp ~/.local/share/omakub/configs/fastfetch.jsonc ~/.config/fastfetch/config.jsonc +fi diff --git a/migrations/1724344367.sh b/migrations/1724344367.sh new file mode 100644 index 0000000..74bcb22 --- /dev/null +++ b/migrations/1724344367.sh @@ -0,0 +1,11 @@ +# Check if fastfetch config.jsonc is already set +if [ -f "$HOME/.config/fastfetch/config.jsonc" ]; then + gum confirm "It appears that a fastfetch configuration is already set. Do you want to overwrite it?" && rm "$HOME/.config/fastfetch/config.jsonc" +fi + +# Only attempt to set configuration if fastfetch is not already set +if [ ! -f "$HOME/.config/fastfetch/config.jsonc" ]; then + # Use Omakub fastfetch config + mkdir -p ~/.config/fastfetch + cp "$OMAKUB_PATH/configs/fastfetch.jsonc" ~/.config/fastfetch/config.jsonc +fi