master ohmu/fastfetch-openbsd / presets / examples / 25.jsonc
ohmu  ·  2026-10-15
  1// Based on #1576
  2{
  3    "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
  4    "display": {
  5        "color": {
  6            "keys": "blue"
  7        },
  8        "separator": "",
  9        // Constants are reusable strings referenced by {$1}, {$2}, etc.
 10        // These contain ANSI escape codes for cursor positioning
 11        "constants": [
 12            "──────────────────────────────────────────────", // {$1} - horizontal line for inner borders
 13            "\u001b[47D",                                     // {$2} - move cursor left 47 columns
 14            "\u001b[47C",                                     // {$3} - move cursor right 47 columns
 15            "\u001b[46C",                                     // {$4} - move cursor right 46 columns
 16            "══════════════════════════════════════════════"  // {$5} - horizontal line for outer borders
 17        ],
 18        "brightColor": false
 19    },
 20    "modules": [
 21        {
 22            "type": "version",
 23            "key": "╔═══════════════╦═{$5}╗\u001b[41D",
 24            "format": "\u001b[1m{#keys} {1} - {2} "
 25        },
 26        {
 27            "type": "os",
 28            // Key format breakdown for OS module:
 29            // "║  {icon}  \u001b[s{sysname}\u001b[u\u001b[10C│{$3}║{$2}"
 30            //
 31            // ║                    - Left border of key block
 32            //   {icon}             - OS icon (defined internally by fastfetch)
 33            //   \u001b[s           - ANSI escape: save cursor position (ESC[s)
 34            // {sysname}            - Format variable: system name (e.g., "Linux", "Darwin")
 35            // \u001b[u             - ANSI escape: restore cursor to saved position (ESC[u)
 36            //                        Necessary because the length of `{sysname}` differs between different platforms
 37            // \u001b[10C           - ANSI escape: move cursor right 10 columns (ESC[10C)
 38            // │                    - Right border of key block (always 10 columns from left border)
 39            // {$3}                 - Reference to constants[2]: move cursor right 47 columns
 40            // ║                    - Right border of value block
 41            // {$2}                 - Reference to constants[1]: move cursor left 47 columns
 42            //
 43            // This creates a fixed-width layout where the key block is exactly 10 columns wide,
 44            // regardless of the actual content length. The cursor manipulation ensures proper
 45            // alignment for the table-like structure.
 46            "key": "║  {icon}  \u001b[s{sysname}\u001b[u\u001b[10C║{$3}║{$2}"
 47        },
 48        {
 49            "type": "datetime",
 50            "key": "║  {icon}  Fetched   ║{$3}║{$2}",
 51            "format": "{year}-{month-pretty}-{day-pretty} {hour-pretty}:{minute-pretty}:{second-pretty} {timezone-name}"
 52        },
 53        {
 54            "type": "locale",
 55            "key": "║  {icon}  Locale    ║{$3}║{$2}"
 56        },
 57
 58        // Hardware section with cyan color theme
 59        {
 60            "type": "custom",
 61            "key": "║{#cyan}┌──────────────┬{$1}┐{#keys}║\u001b[37D",
 62            "format": "{#bright_cyan} Hardware "
 63        },
 64        {
 65            "type": "chassis",
 66            // Similar structure but with cyan color formatting:
 67            // │{#cyan}│             - Left border with cyan color
 68            //  {icon}               - Chassis icon
 69            //  Chassis             - Fixed label text
 70            // │{$4}│{#keys}║{$2}    - Positioning and borders for value area
 71            "key": "║{#cyan}│ {icon}  Chassis   │{$4}│{#keys}║{$2}"
 72        },
 73        {
 74            "type": "memory",
 75            "key": "║{#cyan}│ {icon}  RAM       │{$4}│{#keys}║{$2}"
 76        },
 77        {
 78            "type": "swap",
 79            "key": "║{#cyan}│ {icon}  SWAP      │{$4}│{#keys}║{$2}"
 80        },
 81        {
 82            "type": "cpu",
 83            "key": "║{#cyan}│ {icon}  CPU       │{$4}│{#keys}║{$2}",
 84            "showPeCoreCount": true
 85        },
 86        {
 87            "type": "gpu",
 88            "key": "║{#cyan}│ {icon}  GPU       │{$4}│{#keys}║{$2}"
 89        },
 90        {
 91            "type": "disk",
 92            "key": "║{#cyan}│ {icon}  Disk      │{$4}│{#keys}║{$2}",
 93            "format": "{mountpoint} {size-used} \/ {size-total} ({size-percentage}) - {filesystem}",
 94        },
 95        {
 96            "type": "battery",
 97            "key": "║{#cyan}│ {icon}  Battery   │{$4}│{#keys}║{$2}"
 98        },
 99        {
100            "type": "custom",
101            "key": "║{#cyan}└──────────────┴{$1}┘{#keys}║",
102            "format": ""
103        },
104
105        // Desktop section with green color theme
106        {
107            "type": "custom",
108            "key": "║{#green}┌──────────────┬{$1}┐{#keys}║\u001b[37D",
109            "format": "{#bright_green} Desktop "
110        },
111        {
112            "type": "de",
113            "key": "║{#green}│ {icon}  Desktop   │{$4}│{#keys}║{$2}"
114        },
115        {
116            "type": "wm",
117            "key": "║{#green}│ {icon}  Session   │{$4}│{#keys}║{$2}"
118        },
119        {
120            "type": "display",
121            "key": "║{#green}│ {icon}  Display   │{$4}│{#keys}║{$2}",
122            "compactType": "original-with-refresh-rate"
123        },
124        {
125            "type": "gpu",
126            "key": "║{#green}│ {icon}  G-Driver  │{$4}│{#keys}║{$2}",
127            "format": "{driver}"
128        },
129        {
130            "type": "custom",
131            "key": "║{#green}└──────────────┴{$1}┘{#keys}║",
132            "format": ""
133        },
134
135        // Terminal section with yellow color theme
136        {
137            "type": "custom",
138            "key": "║{#yellow}┌──────────────┬{$1}┐{#keys}║\u001b[37D",
139            "format": "{#bright_yellow} Terminal "
140        },
141        {
142            "type": "shell",
143            "key": "║{#yellow}│ {icon}  Shell     │{$4}│{#keys}║{$2}"
144        },
145        {
146            "type": "terminal",
147            "key": "║{#yellow}│ {icon}  Terminal  │{$4}│{#keys}║{$2}"
148        },
149        {
150            "type": "terminalfont",
151            "key": "║{#yellow}│ {icon}  Term Font │{$4}│{#keys}║{$2}"
152        },
153        {
154            "type": "terminaltheme",
155            "key": "║{#yellow}│ {icon}  Colors    │{$4}│{#keys}║{$2}"
156        },
157        {
158            "type": "packages",
159            "key": "║{#yellow}│ {icon}  Packages  │{$4}│{#keys}║{$2}"
160        },
161        {
162            "type": "custom",
163            "key": "║{#yellow}└──────────────┴{$1}┘{#keys}║",
164            "format": ""
165        },
166
167        // Development section with red color theme
168        {
169            "type": "custom",
170            "key": "║{#red}┌──────────────┬{$1}┐{#keys}║\u001b[39D",
171            "format": "{#bright_red} Development "
172        },
173        {
174            "type": "command",
175            "keyIcon": "",                                   // Custom icon override
176            "key": "║{#red}│ {icon}  Rust      │{$4}│{#keys}║{$2}",
177            "text": "rustc --version",
178            "format": "rustc {~6,13}"                         // Print 6th to 13th characters (version number)
179        },
180        {
181            "type": "command",
182            "condition": {
183                "!system": "Windows"                          // Posix version
184            },
185            "keyIcon": "",
186            "key": "║{#red}│ {icon}  Clang     │{$4}│{#keys}║{$2}",
187            "text": "clang --version | sed -n 's/.*version \\([0-9][0-9.]*\\).*/\\1/p'",
188            "format": "clang {}"
189        },
190        {
191            "type": "command",
192            "condition": {
193                "system": "Windows"                           // Windows version
194            },
195            "keyIcon": "",
196            "key": "║{#red}│ {icon}  Clang     │{$4}│{#keys}║{$2}",
197            "text": "clang --version | findstr version",      // Finds the line with "version"
198            "format": "clang {~14,20}"                        // Prints 14~20 characters (version number)
199        },
200        {
201            "type": "command",
202            "keyIcon": "",
203            "key": "║{#red}│ {icon}  NodeJS    │{$4}│{#keys}║{$2}",
204            "text": "node --version",
205            "format": "node {~1}"                             // {~1} removes first character (v)
206        },
207		{
208			"type": "command",
209			"keyIcon": "",
210			"key": "║{#red}│ {icon}  Python    │{$4}│{#keys}║{$2}",
211			"text": "python --version",
212			"format": "python {~7}"                           // {~7} removes first 7 characters ("Python" with extra space)
213		},
214        {
215            "type": "command",
216            "keyIcon": "",
217            "key": "║{#red}│ {icon}  Go        │{$4}│{#keys}║{$2}",
218            "text": "go version | cut -d' ' -f3",
219            "format": "go {~2}"                               // {~2} removes first 2 characters (go)
220        },
221        {
222            "type": "command",
223            "keyIcon": "",
224            "key": "║{#red}│ {icon}  Zig       │{$4}│{#keys}║{$2}",
225            "text": "zig version",
226            "format": "zig {}"
227        },
228        {
229            "type": "editor",
230            "key": "║{#red}│ {icon}  Editor    │{$4}│{#keys}║{$2}"
231        },
232        {
233            "type": "command",
234            "keyIcon": "󰊢",
235            "key": "║{#red}│ {icon}  Git       │{$4}│{#keys}║{$2}",
236            "text": "git version",
237            "format": "git {~12}"
238        },
239        {
240            "type": "font",
241            "key": "║{#red}│ {icon}  Interface │{$4}│{#keys}║{$2}"
242        },
243        {
244            "type": "custom",
245            "key": "║{#red}└──────────────┴{$1}┘{#keys}║",
246            "format": ""
247        },
248
249        // Uptime section with magenta color theme
250        {
251            "type": "custom",
252            "key": "║{#magenta}┌──────────────┬{$1}┐{#keys}║\u001b[36D",
253            "format": "{#bright_magenta} Uptime "
254        },
255        {
256            "type": "uptime",
257            "key": "║{#magenta}│ {icon}  Uptime    │{$4}│{#keys}║{$2}"
258        },
259        {
260            "type": "users",
261            "myselfOnly": true,                               // Only show current user
262            "keyIcon": "",
263            "key": "║{#magenta}│ {icon}  Login     │{$4}│{#keys}║{$2}"
264        },
265        {
266            "condition": {                                    // Conditional module: only show on non-macOS
267                "!system": "macOS"
268            },
269            "type": "disk",
270            "keyIcon": "",
271            "key": "║{#magenta}│ {icon}  OS Age    │{$4}│{#keys}║{$2}",
272            "folders": "/",                                   // Check root filesystem
273            "format": "{create-time:10} [{days} days]"        // Show creation time and age in days
274        },
275        {
276            "condition": {                                    // Conditional module: only show on macOS
277                "system": "macOS"
278            },
279            "type": "disk",
280            "keyIcon": "",
281            "key": "║{#magenta}│ {icon}  OS Age    │{$4}│{#keys}║{$2}",
282            "folders": "/System/Volumes/VM",                 // Work around for APFS on macOS
283            "format": "{create-time:10} [{days} days]"
284        },
285        {
286            "type": "custom",
287            "key": "║{#magenta}└──────────────┴{$1}┘{#keys}║",
288            "format": ""
289        },
290        {
291            "type": "custom",
292            "key": "╚═════════════════{$5}╝",                // Bottom border of the entire layout
293            "format": ""
294        },
295
296        // End with color palette and line break
297        "break",                                             // Add a blank line
298        "colors"                                             // Display color palette
299    ]
300}
301
302/*
303Key Format Structure Explanation:
304
305The key format uses a combination of:
3061. Unicode box drawing characters (│ ┌ ┐ └ ┘ ┬ ┴) for borders
3072. ANSI escape codes for cursor positioning (\u001b[...)
3083. Format variables ({icon}, {sysname}, etc.)
3094. Constant references ({$1}, {$2}, etc.)
3105. Color formatting ({#color})
311
312ANSI Escape Codes Used:
313- \u001b[s      - Save cursor position (ESC[s)
314- \u001b[u      - Restore cursor position (ESC[u)
315- \u001b[nC     - Move cursor right n columns (ESC[nC)
316- \u001b[nD     - Move cursor left n columns (ESC[nD)
317
318This creates a table-like layout with fixed column widths and proper alignment,
319regardless of the actual content length in each field.
320
321For more ANSI escape code reference, see:
322https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#cursor-controls
323*/