summaryrefslogtreecommitdiffstats
path: root/presets/examples/25.jsonc
blob: ddb3fdf2da90da912a7dcbc7d189e8acddded80b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
// Based on #1576
{
    "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
    "display": {
        "color": {
            "keys": "blue"
        },
        "separator": "",
        // Constants are reusable strings referenced by {$1}, {$2}, etc.
        // These contain ANSI escape codes for cursor positioning
        "constants": [
            "──────────────────────────────────────────────", // {$1} - horizontal line for inner borders
            "\u001b[47D",                                     // {$2} - move cursor left 47 columns
            "\u001b[47C",                                     // {$3} - move cursor right 47 columns
            "\u001b[46C",                                     // {$4} - move cursor right 46 columns
            "══════════════════════════════════════════════"  // {$5} - horizontal line for outer borders
        ],
        "brightColor": false
    },
    "modules": [
        {
            "type": "version",
            "key": "╔═══════════════╦═{$5}╗\u001b[41D",
            "format": "\u001b[1m{#keys} {1} - {2} "
        },
        {
            "type": "os",
            // Key format breakdown for OS module:
            // "║  {icon}  \u001b[s{sysname}\u001b[u\u001b[10C│{$3}║{$2}"
            //
            // ║                    - Left border of key block
            //   {icon}             - OS icon (defined internally by fastfetch)
            //   \u001b[s           - ANSI escape: save cursor position (ESC[s)
            // {sysname}            - Format variable: system name (e.g., "Linux", "Darwin")
            // \u001b[u             - ANSI escape: restore cursor to saved position (ESC[u)
            //                        Necessary because the length of `{sysname}` differs between different platforms
            // \u001b[10C           - ANSI escape: move cursor right 10 columns (ESC[10C)
            // │                    - Right border of key block (always 10 columns from left border)
            // {$3}                 - Reference to constants[2]: move cursor right 47 columns
            // ║                    - Right border of value block
            // {$2}                 - Reference to constants[1]: move cursor left 47 columns
            //
            // This creates a fixed-width layout where the key block is exactly 10 columns wide,
            // regardless of the actual content length. The cursor manipulation ensures proper
            // alignment for the table-like structure.
            "key": "║  {icon}  \u001b[s{sysname}\u001b[u\u001b[10C║{$3}║{$2}"
        },
        {
            "type": "datetime",
            "key": "║  {icon}  Fetched   ║{$3}║{$2}",
            "format": "{year}-{month-pretty}-{day-pretty} {hour-pretty}:{minute-pretty}:{second-pretty} {timezone-name}"
        },
        {
            "type": "locale",
            "key": "║  {icon}  Locale    ║{$3}║{$2}"
        },

        // Hardware section with cyan color theme
        {
            "type": "custom",
            "key": "║{#cyan}┌──────────────┬{$1}┐{#keys}║\u001b[37D",
            "format": "{#bright_cyan} Hardware "
        },
        {
            "type": "chassis",
            // Similar structure but with cyan color formatting:
            // │{#cyan}│             - Left border with cyan color
            //  {icon}               - Chassis icon
            //  Chassis             - Fixed label text
            // │{$4}│{#keys}║{$2}    - Positioning and borders for value area
            "key": "║{#cyan}│ {icon}  Chassis   │{$4}│{#keys}║{$2}"
        },
        {
            "type": "memory",
            "key": "║{#cyan}│ {icon}  RAM       │{$4}│{#keys}║{$2}"
        },
        {
            "type": "swap",
            "key": "║{#cyan}│ {icon}  SWAP      │{$4}│{#keys}║{$2}"
        },
        {
            "type": "cpu",
            "key": "║{#cyan}│ {icon}  CPU       │{$4}│{#keys}║{$2}",
            "showPeCoreCount": true
        },
        {
            "type": "gpu",
            "key": "║{#cyan}│ {icon}  GPU       │{$4}│{#keys}║{$2}"
        },
        {
            "type": "disk",
            "key": "║{#cyan}│ {icon}  Disk      │{$4}│{#keys}║{$2}",
            "format": "{size-used} \/ {size-total} ({size-percentage}) - {filesystem}",
        },
        {
            "type": "battery",
            "key": "║{#cyan}│ {icon}  Battery   │{$4}│{#keys}║{$2}"
        },
        {
            "type": "custom",
            "key": "║{#cyan}└──────────────┴{$1}┘{#keys}║",
            "format": ""
        },

        // Desktop section with green color theme
        {
            "type": "custom",
            "key": "║{#green}┌──────────────┬{$1}┐{#keys}║\u001b[37D",
            "format": "{#bright_green} Desktop "
        },
        {
            "type": "de",
            "key": "║{#green}│ {icon}  Desktop   │{$4}│{#keys}║{$2}"
        },
        {
            "type": "wm",
            "key": "║{#green}│ {icon}  Session   │{$4}│{#keys}║{$2}"
        },
        {
            "type": "display",
            "key": "║{#green}│ {icon}  Display   │{$4}│{#keys}║{$2}",
            "compactType": "original-with-refresh-rate"
        },
        {
            "type": "gpu",
            "key": "║{#green}│ {icon}  G-Driver  │{$4}│{#keys}║{$2}",
            "format": "{driver}"
        },
        {
            "type": "custom",
            "key": "║{#green}└──────────────┴{$1}┘{#keys}║",
            "format": ""
        },

        // Terminal section with yellow color theme
        {
            "type": "custom",
            "key": "║{#yellow}┌──────────────┬{$1}┐{#keys}║\u001b[37D",
            "format": "{#bright_yellow} Terminal "
        },
        {
            "type": "shell",
            "key": "║{#yellow}│ {icon}  Shell     │{$4}│{#keys}║{$2}"
        },
        {
            "type": "terminal",
            "key": "║{#yellow}│ {icon}  Terminal  │{$4}│{#keys}║{$2}"
        },
        {
            "type": "terminalfont",
            "key": "║{#yellow}│ {icon}  Term Font │{$4}│{#keys}║{$2}"
        },
        {
            "type": "terminaltheme",
            "key": "║{#yellow}│ {icon}  Colors    │{$4}│{#keys}║{$2}"
        },
        {
            "type": "packages",
            "key": "║{#yellow}│ {icon}  Packages  │{$4}│{#keys}║{$2}"
        },
        {
            "type": "custom",
            "key": "║{#yellow}└──────────────┴{$1}┘{#keys}║",
            "format": ""
        },

        // Development section with red color theme
        {
            "type": "custom",
            "key": "║{#red}┌──────────────┬{$1}┐{#keys}║\u001b[39D",
            "format": "{#bright_red} Development "
        },
        {
            "type": "command",
            "keyIcon": "",                                   // Custom icon override
            "key": "║{#red}│ {icon}  Rust      │{$4}│{#keys}║{$2}",
            "text": "rustc --version",
            "format": "rustc {~6,13}"                         // Print 6th to 13th characters (version number)
        },
        {
            "type": "command",
            "condition": {
                "!system": "Windows"                          // Posix version
            },
            "keyIcon": "",
            "key": "║{#red}│ {icon}  Clang     │{$4}│{#keys}║{$2}",
            "text": "clang --version | sed -n 's/.*version \\([0-9][0-9.]*\\).*/\\1/p'",
            "format": "clang {}"
        },
        {
            "type": "command",
            "condition": {
                "system": "Windows"                           // Windows version
            },
            "keyIcon": "",
            "key": "║{#red}│ {icon}  Clang     │{$4}│{#keys}║{$2}",
            "text": "clang --version | findstr version",      // Finds the line with "version"
            "format": "clang {~-6}"                           // Prints the last 6 characters (version number)
        },
        {
            "type": "command",
            "keyIcon": "",
            "key": "║{#red}│ {icon}  NodeJS    │{$4}│{#keys}║{$2}",
            "text": "node --version",
            "format": "node {~1}"                             // {~1} removes first character (v)
        },
        {
            "type": "command",
            "keyIcon": "",
            "key": "║{#red}│ {icon}  Go        │{$4}│{#keys}║{$2}",
            "text": "go version | cut -d' ' -f3",
            "format": "go {~2}"                               // {~2} removes first 2 characters (go)
        },
        {
            "type": "command",
            "keyIcon": "",
            "key": "║{#red}│ {icon}  Zig       │{$4}│{#keys}║{$2}",
            "text": "zig version",
            "format": "zig {}"
        },
        {
            "type": "editor",
            "key": "║{#red}│ {icon}  Editor    │{$4}│{#keys}║{$2}"
        },
        {
            "type": "command",
            "keyIcon": "󰊢",
            "key": "║{#red}│ {icon}  Git       │{$4}│{#keys}║{$2}",
            "text": "git version",
            "format": "git {~12}"
        },
        {
            "type": "font",
            "key": "║{#red}│ {icon}  Interface │{$4}│{#keys}║{$2}"
        },
        {
            "type": "custom",
            "key": "║{#red}└──────────────┴{$1}┘{#keys}║",
            "format": ""
        },

        // Uptime section with magenta color theme
        {
            "type": "custom",
            "key": "║{#magenta}┌──────────────┬{$1}┐{#keys}║\u001b[36D",
            "format": "{#bright_magenta} Uptime "
        },
        {
            "type": "uptime",
            "key": "║{#magenta}│ {icon}  Uptime    │{$4}│{#keys}║{$2}"
        },
        {
            "type": "users",
            "myselfOnly": true,                               // Only show current user
            "keyIcon": "",
            "key": "║{#magenta}│ {icon}  Login     │{$4}│{#keys}║{$2}"
        },
        {
            "condition": {                                    // Conditional module: only show on non-macOS
                "!system": "macOS"
            },
            "type": "disk",
            "keyIcon": "",
            "key": "║{#magenta}│ {icon}  OS Age    │{$4}│{#keys}║{$2}",
            "folders": "/",                                   // Check root filesystem
            "format": "{create-time:10} [{days} days]"        // Show creation time and age in days
        },
        {
            "condition": {                                    // Conditional module: only show on macOS
                "system": "macOS"
            },
            "type": "disk",
            "keyIcon": "",
            "key": "║{#magenta}│ {icon}  OS Age    │{$4}│{#keys}║{$2}",
            "folders": "/System/Volumes/VM",                 // Work around for APFS on macOS
            "format": "{create-time:10} [{days} days]"
        },
        {
            "type": "custom",
            "key": "║{#magenta}└──────────────┴{$1}┘{#keys}║",
            "format": ""
        },
        {
            "type": "custom",
            "key": "╚═════════════════{$5}╝",                // Bottom border of the entire layout
            "format": ""
        },

        // End with color palette and line break
        "break",                                             // Add a blank line
        "colors"                                             // Display color palette
    ]
}

/*
Key Format Structure Explanation:

The key format uses a combination of:
1. Unicode box drawing characters (│ ┌ ┐ └ ┘ ┬ ┴) for borders
2. ANSI escape codes for cursor positioning (\u001b[...)
3. Format variables ({icon}, {sysname}, etc.)
4. Constant references ({$1}, {$2}, etc.)
5. Color formatting ({#color})

ANSI Escape Codes Used:
- \u001b[s      - Save cursor position (ESC[s)
- \u001b[u      - Restore cursor position (ESC[u)
- \u001b[nC     - Move cursor right n columns (ESC[nC)
- \u001b[nD     - Move cursor left n columns (ESC[nD)

This creates a table-like layout with fixed column widths and proper alignment,
regardless of the actual content length in each field.

For more ANSI escape code reference, see:
https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#cursor-controls
*/