charmbracelet / freeze

Generate images of code and terminal output 📸
MIT License
3.36k stars 58 forks source link

Make user config the default config #90

Open okmanideep opened 6 months ago

okmanideep commented 6 months ago

Is your feature request related to a problem? Please describe. Currently having to pass -c user every time. Also for some reason freeze -c user is slower compared to freeze (Checked with ls | freeze)

Describe the solution you'd like Make $XDG_CONFIG/freeze/user.json the default config when no config is passed

Describe alternatives you've considered NA

Additional context MacOS 14.4.1 (23E224), installed via brew install charmbracelet/tap/freeze

AlejandroSuero commented 5 months ago

@okmanideep when testing out the changes for #107 I realised that even when using freeze -c full still takes a lot of time but if you output it to .svg it will create it instantly both with -c user or -c full.

My assumption here is that to encode the .png image, takes a lot of time if is not the base config.

I logged out the time between getting the config and parsing the json, here are the results:

image from command ![full](https://github.com/charmbracelet/freeze/assets/71392160/36f5798f-6aac-45a7-b963-df76875634ed)
image from command ![user](https://github.com/charmbracelet/freeze/assets/71392160/5cf248e7-98fc-41cd-9617-93a680de682b)
my user.json ```json { "background": "#171717", "margin": [ 0, 0, 0, 0 ], "padding": [ 0, 0, 0, 0 ], "window": false, "title": { "title": "auto", "position": "center" }, "width": 0, "height": 0, "config": "default", "theme": "dracula", "wrap": 0, "border": { "radius": 0, "width": 0, "color": "#515151" }, "shadow": { "blur": 0, "x": 0, "y": 0 }, "font": { "family": "JetBrains Mono", "file": "", "size": 14, "ligatures": true }, "line_height": 1.2, "show_line_numbers": false } ```
AlejandroSuero commented 5 months ago

Additionally if you want the conversion to be faster, consider downloading librsvg, this makes it drop from 31.4s to 1.3s.

On MacOS you can use brew install librsvg.

image