Print documentation in default config#89
Conversation
Comments themselves are dummy
The descriptions need work, but the code is there.
|
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: Detailsdiff --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
+
|
|
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. |
| "Font family for labels" | ||
| ), | ||
| MB_FIELD( | ||
| // TODO[glowingscrewdriver]: What does this actually do? |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
| ), | ||
| MS_FIELD( | ||
| // TODO[glowingscrewdriver] why is this not named | ||
| // `unselectable_bg_color`? |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
@moverest descriptions are mostly ready, and I've moved the comments before the section like you suggested. |
| "Font family for labels" | ||
| ), | ||
| MB_FIELD( | ||
| // TODO[glowingscrewdriver]: What does this actually do? |
There was a problem hiding this comment.
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.
| ), | ||
| MS_FIELD( | ||
| // TODO[glowingscrewdriver] why is this not named | ||
| // `unselectable_bg_color`? |
There was a problem hiding this comment.
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.
| home_row_keys, "", parse_home_row_keys, free_home_row_keys, | ||
| "Home row keys" |
There was a problem hiding this comment.
It would make sense to explain this one with more details. See #6.
| ), | ||
| G_FIELD( | ||
| modes, "tile,bisect", parse_str, free_str, | ||
| "Modes to use; will be chained" |
There was a problem hiding this comment.
| "Modes to use; will be chained" | |
| "Modes (tile, bisect, split or float) to use; will be chained." |
This change causes
wl-kbptr --help-configto print comments containing descriptions for all fields and sections in the default config. Since--help-configprints an exhaustive list of all config fields and sections, what is printed is effectively full documentation on configuration.May fix #50