12
167
Fork
You've already forked fnott
32

fix: sections above the main section get ignored #150

Manually merged
dnkl merged 4 commits from ldev105/fnott:fix_sec_above_main into master 2025年04月18日 10:24:02 +02:00
Contributor
Copy link

Changed parse_config_file to loop over the file and parse every section in order so that the main section doesn't override urgency sections.

(削除) Closes #145 (削除ここまで)
Closes #137

Changed parse_config_file to loop over the file and parse every section in order so that the main section doesn't override urgency sections. ~~Closes #145~~ Closes #137
dnkl left a comment
Copy link

In addition to the things mentioned below, I'd also like to see a changelog entry, with a reference to #137.

In addition to the things mentioned below, I'd also like to see a changelog entry, with a reference to #137.
config.c Outdated
@ -963,2 +962,2 @@
char *_line = NULL;
size_t count = 0;
bool
parse_config_file_section(FILE *f, struct config *conf, const char *path, enum section section) {
Owner
Copy link

I'd rather stay away from extensions, as far as possible; would you mind breaking this out to a non-nested function?

I'd rather stay away from extensions, as far as possible; would you mind breaking this out to a non-nested function?
Author
Contributor
Copy link

Fixed

Fixed
ldev105 marked this conversation as resolved
config.c Outdated
@ -1062,0 +966,4 @@
char *_line = NULL;
size_t count = 0;
/* If the section is main we can parse as if we already encountered [main] */
bool found=section == SECTION_MAIN;
Owner
Copy link

I think found is a rather bad name, given how it's used. Perhaps is_inside_active_section?

I think `found` is a rather bad name, given how it's used. Perhaps `is_inside_active_section`?
Author
Contributor
Copy link

I changed it to inside_target_sec and the parameter to target_sec to match

I changed it to inside_target_sec and the parameter to target_sec to match
ldev105 marked this conversation as resolved
ldev105 force-pushed fix_sec_above_main from cfb868fb72
Some checks reported errors
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job failed
builds.sr.ht/alpine-x64 Job failed
to b939f7b87e
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/alpine-x64 Job completed
builds.sr.ht/freebsd-x64 Job completed
ci/woodpecker/pull_request_closed/woodpecker Pipeline is pending approval
2025年04月17日 17:48:17 +02:00
Compare
dnkl manually merged commit 25f948ccde into master 2025年04月18日 10:24:02 +02:00
Owner
Copy link

Thanks!

Thanks!
Contributor
Copy link

Not sure if it was introduced by this PR, but some settings are flagged as invalid when used in sections other than main.
For example, setting anchor=top-right in [critical] or [low] results in invalid key: anchor.

Not sure if it was introduced by this PR, but some settings are flagged as invalid when used in sections other than main. For example, setting `anchor=top-right` in `[critical]` or `[low]` results in `invalid key: anchor`.
Author
Contributor
Copy link

Not all settings are valid for the urgency sections. Its not a bug

Not all settings are valid for the urgency sections. Its not a bug
Contributor
Copy link

In that case, per-application settings support (as in mako) would be a useful addition. This could help with certain use cases, such as using fnott as an OSD. I'll open an issue for it.

In that case, per-application settings support (as in mako) would be a useful addition. This could help with certain use cases, such as using fnott as an OSD. I'll open an issue for it.
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
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
dnkl/fnott!150
Reference in a new issue
dnkl/fnott
No description provided.
Delete branch "ldev105/fnott:fix_sec_above_main"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?