Bombabillo is a non-web client for the terminal, supporting Gopher, Gemini and much more. https://bombadillo.colorfield.space
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.7 KiB

  1. package main
  2. import (
  3. "os"
  4. "os/user"
  5. "path/filepath"
  6. )
  7. var defaultOptions = map[string]string{
  8. // The configuration options below control the default settings for
  9. // users of Bombadillo.
  10. //
  11. // Changes take effect when Bombadillo is built. Follow the standard
  12. // install instructions after making a change.
  13. //
  14. // Most options can be changed by a user in the Bombadillo client, and
  15. // changes made here will not overwrite an existing user's settings.
  16. // The exception to both cases is "configlocation" which controls where
  17. // .bombadillo.ini is stored. If you make changes to this setting,
  18. // consider moving bombadillo.ini to the new location as well, so you
  19. // (or your users) do not loose bookmarks or other preferences.
  20. //
  21. // Further explanation of each option is available in the man page.
  22. // Basic Usage
  23. //
  24. // Any option can be defined as a string, like this:
  25. // "option": "value"
  26. //
  27. // Options can also have values calculated on startup. There are two
  28. // functions below that do just this: homePath() and xdgConfigPath()
  29. // You can set any value to use these functions like this:
  30. // "option": homePath()
  31. // "option": xdgConfigPath()
  32. // See the comments for these functions for more information on what
  33. // they do.
  34. //
  35. // You can also use `filepath.Join()` if you want to build a file path.
  36. // For example, specify "~/bombadillo" like so:
  37. // "option": filepath.Join(homePath(), bombadillo)
  38. // Moving .bombadillo.ini out of your home directory
  39. //
  40. // To ensure .bombadillo.ini is saved as per XDG config spec, change
  41. // the "configlocation" as follows:
  42. // "configlocation": xdgConfigPath()
  43. "configlocation": xdgConfigPath(),
  44. "defaultscheme": "gopher", // "gopher", "gemini", "http", "https"
  45. "geminiblocks": "block", // "block", "alt", "neither", "both"
  46. "homeurl": "gopher://bombadillo.colorfield.space:70/1/user-guide.map",
  47. "savelocation": homePath(),
  48. "searchengine": "gopher://gopher.floodgap.com:70/7/v2/vs",
  49. "showimages": "true",
  50. "telnetcommand": "telnet",
  51. "theme": "normal", // "normal", "inverted", "color"
  52. "tlscertificate": "",
  53. "tlskey": "",
  54. "webmode": "none", // "none", "gui", "lynx", "w3m", "elinks"
  55. }
  56. // homePath will return the path to your home directory as a string
  57. // Usage:
  58. // "configlocation": homeConfigPath()
  59. func homePath() string {
  60. var userinfo, _ = user.Current()
  61. return userinfo.HomeDir
  62. }
  63. // xdgConfigPath returns the path to your XDG base directory for configuration
  64. // i.e the contents of environment variable XDG_CONFIG_HOME, or ~/.config/
  65. // Usage:
  66. // "configlocation": xdgConfigPath()
  67. func xdgConfigPath() string {
  68. configPath := os.Getenv("XDG_CONFIG_HOME")
  69. if configPath == "" {
  70. return filepath.Join(homePath(), ".config")
  71. }
  72. return configPath
  73. }