Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default config file contents #3203

Closed
qwerasd205 opened this issue Dec 27, 2024 · 4 comments · Fixed by #3460
Closed

Default config file contents #3203

qwerasd205 opened this issue Dec 27, 2024 · 4 comments · Fixed by #3460
Milestone

Comments

@qwerasd205
Copy link
Collaborator

Config files created automatically by the open_config action should have an explanation for users, because an empty file just staring you in the face doesn't leave you much of a path forward without turning around and looking at the documentation. While the user should be reading documentation, it's also preferable for them to not need to proactively do so in most cases.

The default config file then should be a header which explains the config and references the documentation. Important elements of this explanation:

  • Where is this file located? So that the user knows how to edit it in their preferred editor if they don't like the one that was opened when they used the action. This should prevent issues where a user creates a config on macOS in the Application Support location and then a second one in the XDG location which conflicts.
  • What is this file format? So that the user knows how to specify config options.
  • What config options are available? A link to the docs should be included as well as a reference to +show-config.

Here is my suggestion:

# </path/to/ghostty/config>
#
# Docs: https://ghostty.org/docs/config
#
# This is the configuration file for Ghostty. This file is created automatically
# if the `open_config` action is invoked and Ghostty can't find any config files
# on your system. It has been placed at the path listed at the top of the file.
#
# This file is not initialized with any default options set because the majority
# of users should only need to set a few things. While it is recommended to read
# the docs, a brief explanation of the syntax for this file can be found below.
#
# Syntax
# ---
# # Any line beginning with a # is a comment. It's not possible to put
# # a comment after a config option, it will be interpreted as a part
# # of the value. For example, this will have a value of "#123abc":
# background = #123abc
#
# # Spacing around the equals sign does not matter.
# # All of these are identical:
# key=value
# key= value
# key =value
# key = value
#
# # Empty values are used to reset config keys to default
# key =
#
# # Some config options have unique syntax for their value,
# # which is explained in the docs for that config option.
# ---
#
# Tip: You can run `ghostty +show-config --default --docs` to view a
#      list of all available config options and their default values.
#
# See also: `man ghostty`
#
# Please consider reading the full docs.
@jamie
Copy link

jamie commented Dec 27, 2024

Came here searching for a listing of default keybinds, that tip at the bottom is gold all on its own.

@NOTtheMessiah
Copy link

I think the web documentation should include default settings, so users can have an expectation what settings change things. It's easy to miss instructions of running the command ghostty +show-config --default --docs.

@definfo
Copy link

definfo commented Dec 28, 2024

Creating an empty config file by default may break "Open Configuration" action (at least for me).
I've tried to investigate it and end up with some clues:

  1. This is caused by an internal mechanism of xdg-open: empty files are recognized with empty filetype, which refers to application/x-zerosize mimetype.
  2. xdg-open seems to behave very differently when invoked from a GUI application or a terminal. I've tested nautilus/yazi/ranger with following results.
  • nautilus (GTK file manager) deals correctly with empty file through xdg-open
  • yazi (CLI file manager) opens through $EDITOR
  • ranger(CLI file manager) fails with xdg-open "there is no application installed for 'config'"
  • Execute xdg-open ~/.config/ghostty/configin ghostty fails (same as ranger)

IMO providing a non-empty config (even only with a few comments) is also helpful to avoid frustration with xdg. Hope to see any improvement :)

@jkaye2012
Copy link

I think the web documentation should include default settings, so users can have an expectation what settings change things. It's easy to miss instructions of running the command ghostty +show-config --default --docs.

Do you know if there's a discussion ongoing for this? I think it's a great point and feels like a significant hole in the web documentation to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants