feat(config): make hint mode opt-in with hint.enable
- commit
- e757cabfeb97f118cc4bf436638e80fc305d0eaa
- author
- brice · · 2026-10-19 14:57 UTC
- parent
- 2908f8e
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +29 -0
M internal/adapters/config/config.go +8 -0
| @@ -164,6 +164,8 @@ func Defaults() ports.Config { | |||
| 164 | 164 | c.Terminal.Command = []string{"foot"} | |
| 165 | 165 | } | |
| 166 | 166 | c.Terminal.AutoOpen = "first" | |
| 167 | + | // Hint mode is experimental: off unless the config turns it on. | |
| 168 | + | c.Hint.Enable = false | |
| 167 | 169 | c.Hint.TextClick = ports.ModCtrl | ports.ModShift | |
| 168 | 170 | c.Xwayland = "xwayland-satellite" | |
| 169 | 171 | c.Background.Color = "#111111" | |
| @@ -849,6 +851,12 @@ func set(c *ports.Config, key, v string) error { | |||
| 849 | 851 | return err | |
| 850 | 852 | } | |
| 851 | 853 | c.Focus.Flash = b | |
| 854 | + | case "hint.enable": | |
| 855 | + | b, err := onOff(v) | |
| 856 | + | if err != nil { | |
| 857 | + | return err | |
| 858 | + | } | |
| 859 | + | c.Hint.Enable = b | |
| 852 | 860 | case "hint.size": | |
| 853 | 861 | if v == "auto" { | |
| 854 | 862 | c.Hint.Size = 0 | |
| @@ -164,6 +164,8 @@ func Defaults() ports.Config { | |||||
| 164 | c.Terminal.Command = []string{"foot"} | 164 | c.Terminal.Command = []string{"foot"} | ||
| 165 | } | 165 | } | ||
| 166 | c.Terminal.AutoOpen = "first" | 166 | c.Terminal.AutoOpen = "first" | ||
| 167 | + | // Hint mode is experimental: off unless the config turns it on. | |||
| 168 | + | c.Hint.Enable = false | |||
| 167 | c.Hint.TextClick = ports.ModCtrl | ports.ModShift | 169 | c.Hint.TextClick = ports.ModCtrl | ports.ModShift | ||
| 168 | c.Xwayland = "xwayland-satellite" | 170 | c.Xwayland = "xwayland-satellite" | ||
| 169 | c.Background.Color = "#111111" | 171 | c.Background.Color = "#111111" | ||
| @@ -849,6 +851,12 @@ func set(c *ports.Config, key, v string) error { | |||||
| 849 | return err | 851 | return err | ||
| 850 | } | 852 | } | ||
| 851 | c.Focus.Flash = b | 853 | c.Focus.Flash = b | ||
| 854 | + | case "hint.enable": | |||
| 855 | + | b, err := onOff(v) | |||
| 856 | + | if err != nil { | |||
| 857 | + | return err | |||
| 858 | + | } | |||
| 859 | + | c.Hint.Enable = b | |||
| 852 | case "hint.size": | 860 | case "hint.size": | ||
| 853 | if v == "auto" { | 861 | if v == "auto" { | ||
| 854 | c.Hint.Size = 0 | 862 | c.Hint.Size = 0 | ||
M internal/adapters/config/config_test.go +18 -0
| @@ -1018,3 +1018,21 @@ func TestHintTextClick(t *testing.T) { | |||
| 1018 | 1018 | } | |
| 1019 | 1019 | } | |
| 1020 | 1020 | } | |
| 1021 | + | ||
| 1022 | + | func TestHintEnable(t *testing.T) { | |
| 1023 | + | if Defaults().Hint.Enable { | |
| 1024 | + | t.Fatal("hint mode must be off by default") | |
| 1025 | + | } | |
| 1026 | + | c, w := parseString(t, "hint.enable = on\n") | |
| 1027 | + | if !c.Hint.Enable || len(w) != 0 { | |
| 1028 | + | t.Fatal(c.Hint, w) | |
| 1029 | + | } | |
| 1030 | + | c, w = parseString(t, "hint.enable = off\n") | |
| 1031 | + | if c.Hint.Enable || len(w) != 0 { | |
| 1032 | + | t.Fatal(c.Hint, w) | |
| 1033 | + | } | |
| 1034 | + | c, w = parseString(t, "hint.enable = maybe\n") | |
| 1035 | + | if c.Hint.Enable || len(w) != 1 { | |
| 1036 | + | t.Fatal(c.Hint, w) | |
| 1037 | + | } | |
| 1038 | + | } | |
| @@ -1018,3 +1018,21 @@ func TestHintTextClick(t *testing.T) { | |||||
| 1018 | } | 1018 | } | ||
| 1019 | } | 1019 | } | ||
| 1020 | } | 1020 | } | ||
| 1021 | + | ||||
| 1022 | + | func TestHintEnable(t *testing.T) { | |||
| 1023 | + | if Defaults().Hint.Enable { | |||
| 1024 | + | t.Fatal("hint mode must be off by default") | |||
| 1025 | + | } | |||
| 1026 | + | c, w := parseString(t, "hint.enable = on\n") | |||
| 1027 | + | if !c.Hint.Enable || len(w) != 0 { | |||
| 1028 | + | t.Fatal(c.Hint, w) | |||
| 1029 | + | } | |||
| 1030 | + | c, w = parseString(t, "hint.enable = off\n") | |||
| 1031 | + | if c.Hint.Enable || len(w) != 0 { | |||
| 1032 | + | t.Fatal(c.Hint, w) | |||
| 1033 | + | } | |||
| 1034 | + | c, w = parseString(t, "hint.enable = maybe\n") | |||
| 1035 | + | if c.Hint.Enable || len(w) != 1 { | |||
| 1036 | + | t.Fatal(c.Hint, w) | |||
| 1037 | + | } | |||
| 1038 | + | } | |||
M internal/ports/config.go +3 -0
| @@ -163,6 +163,9 @@ type Config struct { | |||
| 163 | 163 | } | |
| 164 | 164 | // Hint configures keyboard hint mode (action hint). | |
| 165 | 165 | Hint struct { | |
| 166 | + | // Enable turns the experimental hint mode on (hint.enable). It is | |
| 167 | + | // read at startup: a reload keeps the startup value. | |
| 168 | + | Enable bool | |
| 166 | 169 | // LinksOnly limits the targets to links and URLs; false also | |
| 167 | 170 | // includes buttons (hint.targets = clickable). | |
| 168 | 171 | LinksOnly bool | |
| @@ -163,6 +163,9 @@ type Config struct { | |||||
| 163 | } | 163 | } | ||
| 164 | // Hint configures keyboard hint mode (action hint). | 164 | // Hint configures keyboard hint mode (action hint). | ||
| 165 | Hint struct { | 165 | Hint struct { | ||
| 166 | + | // Enable turns the experimental hint mode on (hint.enable). It is | |||
| 167 | + | // read at startup: a reload keeps the startup value. | |||
| 168 | + | Enable bool | |||
| 166 | // LinksOnly limits the targets to links and URLs; false also | 169 | // LinksOnly limits the targets to links and URLs; false also | ||
| 167 | // includes buttons (hint.targets = clickable). | 170 | // includes buttons (hint.targets = clickable). | ||
| 168 | LinksOnly bool | 171 | LinksOnly bool | ||