Skip to content

Commit

Permalink
(hotfix) fix configuration error when editing config with shell
Browse files Browse the repository at this point in the history
  • Loading branch information
xTrayambak committed Nov 23, 2024
1 parent 06674ac commit 376b72f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type
height*: uint = 200
headingSize*: float = 32f
descriptionSize*: float = 18f
font*: Option[string] = none(string)
font*: string = ""
anchors*: string = "top-right"

Config* = object
Expand Down Expand Up @@ -100,7 +100,7 @@ oldOof = true
moon = ""
sun = ""
font = ""
excludeFonts = ["RobloxEmoji.ttf"]
excludeFonts = ["RobloxEmoji.ttf", "TwemojiMozilla.ttf"]
[daemon]
port = 9898
Expand Down Expand Up @@ -141,4 +141,9 @@ proc parseConfig*(input: Input): Config {.inline.} =
ConfigLocation % [getHomeDir()] / "config.toml"
)

Toml.decode(config, Config)
try:
Toml.decode(config, Config)
except TomlFieldReadingError as exc:
warn "lucem: unable to read configuration: " & exc.msg
warn "lucem: falling back to internal default configuration: your changes will NOT be respected!"
Toml.decode(DefaultConfig, Config)
4 changes: 2 additions & 2 deletions src/lucem_overlay.nim
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ proc initOverlay*(input: Input) {.noReturn.} =
nifAntialias
})
var data =
if (*config.overlay.font and fileExists(&config.overlay.font)):
cast[seq[byte]](readFile(&config.overlay.font))
if (config.overlay.font.len > 0 and fileExists(config.overlay.font)):
cast[seq[byte]](readFile(config.overlay.font))
else:
cast[seq[byte]](IbmPlexSans)

Expand Down

0 comments on commit 376b72f

Please sign in to comment.