[GH-ISSUE #44] Wont read hn-tui.toml #10

Closed
opened 2026-03-14 12:23:14 +03:00 by kerem · 2 comments
Owner

Originally created by @pfr-dev on GitHub (Nov 4, 2021).
Original GitHub issue: https://github.com/aome510/hackernews-TUI/issues/44

On both machines I have (Void-Linux & NetBSD) I cannot get it to load my theme configuration from the hn-tui.toml file.

This is my ~/.config/hn-tui.toml (which I shamelessly borrowed directly from another user - yes, it works for them).

# hn-tui.toml

allow_unicode = false
page_scrolling = true
scroll_offset = 3
url_open_command = "firefox"
article_parse_command = {command = "mercury-parser", options = ["--format", "markdown"]}

[story_pooling]
enable = true
delay = 2
allows = ["front_page"]

[client]
client_timeout = 32

[client.story_limit]
search = 10
front_page = 20
story = 20
ask_hn = 15
show_hn = 15
job = 15

[theme]
background = "#d9d5ba"
shadow = "#000000"
view = "#f6f6ef"
primary = "#4a4a48"
secondary = "#a5a5a5"
tertiary = "#d9dfba"
title_primary = "#000000"
title_secondary = "#ffff00"
highlight = "#6c6c6c"
highlight_inactive = "#0000ff"
highlight_text = "#c3bbbb"
link_text = "#4fbbfd"
link_id_bg = "#ffff00"
search_highlight_bg = "#ffff00"
status_bar_bg = "#ff6600"
code_block_bg = "#c8c8c8"

[keymap.global_keymap]
open_help_dialog = "?"
quit = "C-q"
close_dialog = "esc"
goto_previous_view = "C-p"
goto_front_page_view = "C-f"
goto_search_view = "C-s"
goto_all_stories_view = "C-z"
goto_ask_hn_view = "C-x"
goto_show_hn_view = "C-c"
goto_jobs_view = "C-v"

[keymap.story_view_keymap]
next_story = "j"
prev_story = "k"
goto_story = "g"
next_page = "n"
prev_page = "p"
toggle_sort_by = "d"
open_article_in_browser = "o"
open_article_in_article_view = "O"
open_story_in_browser = "s"
goto_story_comment_view = "enter"

[keymap.search_view_keymap]
to_navigation_mode = "esc"
to_search_mode = "i"

[keymap.comment_view_keymap]
next_comment = "j"
prev_comment = "k"
next_top_level_comment = "n"
prev_top_level_comment = "p"
next_leq_level_comment = "l"
prev_leq_level_comment = "h"
down = "down"
up = "up"
page_down = "page_down"
page_up = "page_up"
open_comment_in_browser = "c"
open_link_in_browser = "f"
open_link_in_article_view = "F"
reload_comment_view = "r"

[keymap.article_view_keymap]
down = "j"
up = "k"
page_down = "d"
page_up = "u"
top = "t"
bottom = "b"
open_article_in_browser = "o"
open_link_in_browser = "f"
open_link_in_article_view = "F"
open_link_dialog = "l"
link_dialog_focus_next = "j"
link_dialog_focus_prev = "k"
toggle_raw_markdown_mode = "T"

Even when running:

$ hackernews_tui -c ~/.config/hn-tui.toml

It still loads the default config. Any reason why it wouldn't be reading this file and just loading the default config?

Originally created by @pfr-dev on GitHub (Nov 4, 2021). Original GitHub issue: https://github.com/aome510/hackernews-TUI/issues/44 On both machines I have (Void-Linux & NetBSD) I cannot get it to load my theme configuration from the `hn-tui.toml` file. This is my `~/.config/hn-tui.toml` (which I shamelessly borrowed directly from another user - yes, it works for them). ``` # hn-tui.toml allow_unicode = false page_scrolling = true scroll_offset = 3 url_open_command = "firefox" article_parse_command = {command = "mercury-parser", options = ["--format", "markdown"]} [story_pooling] enable = true delay = 2 allows = ["front_page"] [client] client_timeout = 32 [client.story_limit] search = 10 front_page = 20 story = 20 ask_hn = 15 show_hn = 15 job = 15 [theme] background = "#d9d5ba" shadow = "#000000" view = "#f6f6ef" primary = "#4a4a48" secondary = "#a5a5a5" tertiary = "#d9dfba" title_primary = "#000000" title_secondary = "#ffff00" highlight = "#6c6c6c" highlight_inactive = "#0000ff" highlight_text = "#c3bbbb" link_text = "#4fbbfd" link_id_bg = "#ffff00" search_highlight_bg = "#ffff00" status_bar_bg = "#ff6600" code_block_bg = "#c8c8c8" [keymap.global_keymap] open_help_dialog = "?" quit = "C-q" close_dialog = "esc" goto_previous_view = "C-p" goto_front_page_view = "C-f" goto_search_view = "C-s" goto_all_stories_view = "C-z" goto_ask_hn_view = "C-x" goto_show_hn_view = "C-c" goto_jobs_view = "C-v" [keymap.story_view_keymap] next_story = "j" prev_story = "k" goto_story = "g" next_page = "n" prev_page = "p" toggle_sort_by = "d" open_article_in_browser = "o" open_article_in_article_view = "O" open_story_in_browser = "s" goto_story_comment_view = "enter" [keymap.search_view_keymap] to_navigation_mode = "esc" to_search_mode = "i" [keymap.comment_view_keymap] next_comment = "j" prev_comment = "k" next_top_level_comment = "n" prev_top_level_comment = "p" next_leq_level_comment = "l" prev_leq_level_comment = "h" down = "down" up = "up" page_down = "page_down" page_up = "page_up" open_comment_in_browser = "c" open_link_in_browser = "f" open_link_in_article_view = "F" reload_comment_view = "r" [keymap.article_view_keymap] down = "j" up = "k" page_down = "d" page_up = "u" top = "t" bottom = "b" open_article_in_browser = "o" open_link_in_browser = "f" open_link_in_article_view = "F" open_link_dialog = "l" link_dialog_focus_next = "j" link_dialog_focus_prev = "k" toggle_raw_markdown_mode = "T" ``` Even when running: ``` $ hackernews_tui -c ~/.config/hn-tui.toml ``` It still loads the default config. Any reason why it wouldn't be reading this file and just loading the default config?
kerem closed this issue 2026-03-14 12:23:19 +03:00
Author
Owner

@aome510 commented on GitHub (Nov 4, 2021):

@pfr-dev looking into your config file's theme, I guess you want to change the application's background right?

background does not really represent background of the application. If you want to change the app's background, you change the value view instead. According to cursive::theme documentation:

Background: used to color the application background (around views). Defaults to blue.
View: used to color the background for views. Defaults to white.

That means background is used to color a remaining part of the application in case the main views do not cover all the terminal. hackernews-tui doesn't really have background if it's defined that way lol. Sorry for the confusion.

With that said, you don't need to define all the configuration options, the application will use a default value for any options that are not specified.

Please let's me know if this is not clear.

<!-- gh-comment-id:961402074 --> @aome510 commented on GitHub (Nov 4, 2021): @pfr-dev looking into your config file's theme, I guess you want to change the application's background right? `background` does not really represent background of the application. If you want to change the app's background, you change the value `view` instead. According to [`cursive::theme` documentation](https://docs.rs/cursive/0.16.3/cursive/theme/index.html#palette): > Background: used to color the application background (around views). Defaults to blue. > View: used to color the background for views. Defaults to white. That means `background` is used to color a remaining part of the application in case the main views do not cover all the terminal. `hackernews-tui` doesn't really have background if it's defined that way lol. Sorry for the confusion. With that said, you don't need to define all the configuration options, the application will use a default value for any options that are not specified. Please let's me know if this is not clear.
Author
Owner

@pfr-dev commented on GitHub (Nov 4, 2021):

Thanks. got it working ;)

<!-- gh-comment-id:961498641 --> @pfr-dev commented on GitHub (Nov 4, 2021): Thanks. got it working ;)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hackernews-TUI#10
No description provided.