diff --git a/internal/config/config.go b/internal/config/config.go index a5bdecc..1c8d463 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -21,7 +21,6 @@ type ( } Identify struct { - Status discord.Status `toml:"status"` } Notifications struct { @@ -39,6 +38,8 @@ type ( Mouse bool `toml:"mouse"` Editor string `toml:"editor"` + Status discord.Status `toml:"status"` + Markdown bool `toml:"markdown"` HideBlockedUsers bool `toml:"hide_blocked_users"` ShowAttachmentLinks bool `toml:"show_attachment_links"` @@ -87,21 +88,25 @@ func Load(path string) (*Config, error) { "err", err, ) - return &cfg, nil - } - - if err != nil { - return nil, fmt.Errorf("failed to open config file: %w", err) - } - defer file.Close() - - if _, err := toml.NewDecoder(file).Decode(&cfg); err != nil { - return nil, fmt.Errorf("failed to decode config: %w", err) + } else { + if err != nil { + return nil, fmt.Errorf("failed to open config file: %w", err) + } + defer file.Close() + + if _, err := toml.NewDecoder(file).Decode(&cfg); err != nil { + return nil, fmt.Errorf("failed to decode config: %w", err) + } } + // set defaults if cfg.Editor == "default" { cfg.Editor = os.Getenv("EDITOR") } + if cfg.Status == "default" { + cfg.Status = "" + } + return &cfg, nil } diff --git a/internal/config/config.toml b/internal/config/config.toml index 0fb1358..f89d935 100644 --- a/internal/config/config.toml +++ b/internal/config/config.toml @@ -3,6 +3,9 @@ mouse = true # The program to open when the `keys.message_input.editor` keymap is pressed. Set the value to `"default"` to use `$EDITOR`. editor = "default" +# "default" (unknown), "online", "dnd", "idle", "invisible", "offline" +status = "default" + # Whether to parse and render markdown in messages or not. markdown = true hide_blocked_users = true @@ -28,15 +31,6 @@ duration = 0 enabled = true only_on_ping = true -# How Discord sees us. -# status: "online", "idle", "dnd" (Do Not Disturb), "" (invisible), -# note: does not seem to work -[identify] -status = "online" -browser = "default" -browser_version = "default" -user_agent = "default" - # Global shortcuts # Esc: Reset message selection or close the channel selection popup. [keys] diff --git a/internal/config/keys.go b/internal/config/keys.go index fe4c520..cc48098 100644 --- a/internal/config/keys.go +++ b/internal/config/keys.go @@ -28,6 +28,8 @@ type ( SelectCurrent string `toml:"select_current"` YankID string `toml:"yank_id"` + CollapseAll string `toml:"collapse_all"` + ExpandAll string `toml:"expand_all"` CollapseParentNode string `toml:"collapse_parent_node"` MoveToParentNode string `toml:"move_to_parent_node"` }