Skip to content

Print documentation in default config#89

Open
GlowingScrewdriver wants to merge 7 commits into
moverest:mainfrom
GlowingScrewdriver:config-desc
Open

Print documentation in default config#89
GlowingScrewdriver wants to merge 7 commits into
moverest:mainfrom
GlowingScrewdriver:config-desc

Conversation

@GlowingScrewdriver
Copy link
Copy Markdown

This change causes wl-kbptr --help-config to print comments containing descriptions for all fields and sections in the default config. Since --help-config prints an exhaustive list of all config fields and sections, what is printed is effectively full documentation on configuration.

May fix #50

Comments themselves are dummy
The descriptions need work, but the code is there.
@GlowingScrewdriver
Copy link
Copy Markdown
Author

GlowingScrewdriver commented Apr 30, 2026

I've opened this PR as a draft, since the descriptions themselves aren't complete. Apart from that, the code changes are ready for review.

At present, the difference in the default config looks like this:

Details
diff --git a/config.old b/config.new
index 9d6dbac..7c1fc33 100644
--- a/config.old
+++ b/config.new
@@ -4,53 +4,139 @@
 # be loaded if it exits. Below is the default configuration.
 
 [general]
+## General configuration ##
+# Home row keys
 home_row_keys=
+
+# Modes to use
 modes=tile,bisect
+
+# Status code to exit with when cancelled
 cancellation_status_code=0
 
+
 [mode_tile]
+## Configuration for tile mode ##
+# Label color
 label_color=#fffd
+
+# Selected label color
 label_select_color=#fd0d
+
+# Background color for unselectable
 unselectable_bg_color=#2226
+
+# Background color for selectable
 selectable_bg_color=#0304
+
+# Border color for selectable
 selectable_border_color=#040c
+
+# Font family for label
 label_font_family=sans-serif
+
+# Font size for label
 label_font_size=8 50% 100
+
+# Symbols to use for labels
 label_symbols=abcdefghijklmnopqrstuvwxyz
 
+
 [mode_floating]
+## Configuration for floating mode ##
+# Source
 source=stdin
+
+# Color of labels
 label_color=#fffd
+
+# Selected label color
 label_select_color=#fd0d
+
+# Background color of unselectable
 unselectable_bg_color=#2226
+
+# Background color of selectable
 selectable_bg_color=#1718
+
+# Border color of selectable
 selectable_border_color=#040c
+
+# Font family for label
 label_font_family=sans-serif
+
+# Font size for label
 label_font_size=12 50% 100
+
+# Symbols to use for labels
 label_symbols=abcdefghijklmnopqrstuvwxyz
 
+
 [mode_bisect]
+## Configuration for bisect mode ##
+# Label color
 label_color=#fffd
+
+# Font size for labels
 label_font_size=20
+
+# Font family for labels
 label_font_family=sans-serif
+
+# Padding for labels
 label_padding=12
+
+# Pointer size
 pointer_size=20
+
+# Pointer color
 pointer_color=#e22d
+
+# Background color for unselectable
 unselectable_bg_color=#2226
+
+# Background color for even area
 even_area_bg_color=#0304
+
+# Border color for even area
 even_area_border_color=#0408
+
+# Background color for odd area
 odd_area_bg_color=#0034
+
+# Border color for odd area
 odd_area_border_color=#0048
+
+# Border color for history
 history_border_color=#3339
 
+
 [mode_split]
+## Configuration for split mode ##
+# Pointer size
 pointer_size=20
+
+# Pointer color
 pointer_color=#e22d
+
+# Background color
 bg_color=#2226
+
+# Background color for area
 area_bg_color=#11111188
+
+# Color for vertical marker
 vertical_color=#8888ffcc
+
+# Color for horizontal marker
 horizontal_color=#008800cc
+
+# Border color for history
 history_border_color=#3339
 
+
 [mode_click]
+## Configuration for click mode ##
+# Mouse button
 button=left
+

@moverest
Copy link
Copy Markdown
Owner

That looks great! If I was to nitpick, I'd have the description for the section before it like the rest but honestly it's fine.

Comment thread src/config.c
"Font family for labels"
),
MB_FIELD(
// TODO[glowingscrewdriver]: What does this actually do?
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't able to figure out exactly what label_padding is supposed to do. I just wanted to bring this up in case a) I'm missing something, or b) the behaviour is unintended.

I tried playing around with extreme values (0 and 50, for e.g.) and the only difference I noticed was after the selectable areas become very small.

After bisecting a number of times, the areas are so small that an area's label is drawn outside the area itself. In this scenario, the distance between a label and its area seems to correlate with label_padding.

When the areas are big enough to contain their labels, label_padding doesn't seem to have an effect.

recording.webm

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After bisecting a number of times, the areas are so small that an area's label is drawn outside the area itself. In this scenario, the distance between a label and its area seems to correlate with label_padding.

Yes, that's the spacing between the rectangle and the label. It only has an effect when the area is small enough that the label has to be displayed outside of it.

For context, in the early versions, the labels would only be displayed outside the area not inside as the bisect was followed by the bisect mode and that was not configurable, i.e. the default behaviour without any options. This means that the selection areas were always small.

Comment thread src/config.c
),
MS_FIELD(
// TODO[glowingscrewdriver] why is this not named
// `unselectable_bg_color`?
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason that this config field isn't named unselectable_bg_color? In all partitioning modes, when the user selects a region, the area outside that region becomes "unselectable", and is colored differently. In the other modes that color is unselectable_bg_color, but for split it is bg_color.

Just wanted to clarify this since I noticed it while writing the descriptions. It isn't a blocker to this PR.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of a reason other than I probably didn't notice the inconsistency. Let's keep it as bg_color as to not break compatibility with existing configurations.

@GlowingScrewdriver
Copy link
Copy Markdown
Author

@moverest descriptions are mostly ready, and I've moved the comments before the section like you suggested.

@GlowingScrewdriver GlowingScrewdriver marked this pull request as ready for review May 24, 2026 05:03
Comment thread src/config.c
"Font family for labels"
),
MB_FIELD(
// TODO[glowingscrewdriver]: What does this actually do?
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After bisecting a number of times, the areas are so small that an area's label is drawn outside the area itself. In this scenario, the distance between a label and its area seems to correlate with label_padding.

Yes, that's the spacing between the rectangle and the label. It only has an effect when the area is small enough that the label has to be displayed outside of it.

For context, in the early versions, the labels would only be displayed outside the area not inside as the bisect was followed by the bisect mode and that was not configurable, i.e. the default behaviour without any options. This means that the selection areas were always small.

Comment thread src/config.c
),
MS_FIELD(
// TODO[glowingscrewdriver] why is this not named
// `unselectable_bg_color`?
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of a reason other than I probably didn't notice the inconsistency. Let's keep it as bg_color as to not break compatibility with existing configurations.

Comment thread src/config.c
Comment on lines +366 to +367
home_row_keys, "", parse_home_row_keys, free_home_row_keys,
"Home row keys"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would make sense to explain this one with more details. See #6.

Comment thread src/config.c
),
G_FIELD(
modes, "tile,bisect", parse_str, free_str,
"Modes to use; will be chained"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Modes to use; will be chained"
"Modes (tile, bisect, split or float) to use; will be chained."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation

2 participants