Skip to content

Commit ea39c05

Browse files
committed
switch to using tags for the settings universally
1 parent 9b1a9d3 commit ea39c05

File tree

5 files changed

+27
-25
lines changed

5 files changed

+27
-25
lines changed

docs/http.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ may not check if they exist.
2828
Each setting has a title which is meant to be shown in the UI and an optional
2929
hint meant to be shown under a hover hint or `?` button.
3030

31-
Each setting may include a family, which has a number of tags that work like classes.
31+
Each setting may include a set of tags, that work like classes.
3232
For example, a keyboard mapping setting may have the tags
3333
`[razer_lycosa_123, razer_kbd, keyboard, advanced]`, which would allow the UI
3434
to customize the presentation based on the specific device make, manufacturer,

readme.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ Currently, there is a bug with the Nobara kernels that adds 2 extra random
218218
Steam Controllers.
219219
These controllers appear in the system as X-BOX/Xpad controllers.
220220
This is unrelated to HHD.
221+
You can verify by running ``
221222

222223
### Steam reports a Legion Controller and a Shortcuts controller instead of a DS5
223224
The Legion controllers have multiple modes (namely x-input, d-input, dual d-input,
@@ -270,10 +271,10 @@ if you are missing the xpad rule.
270271
### I can see the original controller and that is causing issues in X
271272
Hiding the original controller is a complex process, so it was skipped for the
272273
v0.1.* versions of HHD.
273-
However, it is implemented properly in v0.2 which will be released soon.
274-
Some emulators select the original controller as controller 1, which might
275-
cause issues.
276-
If this is the case, wait for version 2.
274+
However, it is implemented properly in v0.2.
275+
Some emulators select the original controller as controller 1, which caused
276+
issues.
277+
This is not the case anymore.
277278

278279
### Yuzu does not work with the DS5 controller
279280
See above.
@@ -324,7 +325,8 @@ The gyro will freeze and will be unusable after that.
324325
HHD remaps the touchpad of the legion go to the DS5 touchpad.
325326
The playstation driver does not support right clicking.
326327
Switch to d-input to enable the touchpad when you're in the desktop.
327-
You can also disable touchpad emulation in the config.
328+
You can also disable touchpad emulation in the config or use evdev emulation
329+
which does not use the touchpad.
328330

329331
### HandyGCCS
330332
HHD replicates all functionality of HandyGCCS for the Legion Go, so it is not

src/hhd/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ def main():
199199
for plugs in plugins.values():
200200
sorted_plugins.extend(plugs)
201201
sorted_plugins.sort(key=lambda x: x.priority)
202-
validator: Validator = lambda family, config, value: any(
203-
p.validate(family, config, value) for p in sorted_plugins
202+
validator: Validator = lambda tags, config, value: any(
203+
p.validate(tags, config, value) for p in sorted_plugins
204204
)
205205

206206
if not sorted_plugins:

src/hhd/plugins/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def open(
7575
def settings(self) -> HHDSettings:
7676
return {}
7777

78-
def validate(self, family: Sequence[str], config: Any, value: Any):
78+
def validate(self, tags: Sequence[str], config: Any, value: Any):
7979
return False
8080

8181
def prepare(self, conf: Config):

src/hhd/plugins/settings.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ButtonSetting(TypedDict):
2424
"""Just a button, emits an event. Used for resets, etc."""
2525

2626
type: Literal["event"]
27-
family: Sequence[str]
27+
tags: Sequence[str]
2828
title: str
2929
hint: str | None
3030

@@ -35,7 +35,7 @@ class BooleanSetting(TypedDict):
3535
"""Checkbox container."""
3636

3737
type: Literal["bool"]
38-
family: Sequence[str]
38+
tags: Sequence[str]
3939
title: str
4040
hint: str | None
4141

@@ -46,7 +46,7 @@ class MultipleSetting(TypedDict):
4646
"""Select one container."""
4747

4848
type: Literal["multiple"]
49-
family: Sequence[str]
49+
tags: Sequence[str]
5050
title: str
5151
hint: str | None
5252

@@ -58,7 +58,7 @@ class DiscreteSetting(TypedDict):
5858
"""Ordered and fixed numerical options (etc. tdp)."""
5959

6060
type: Literal["discrete"]
61-
family: Sequence[str]
61+
tags: Sequence[str]
6262
title: str
6363
hint: str | None
6464

@@ -70,7 +70,7 @@ class NumericalSetting(TypedDict):
7070
"""Floating numerical option."""
7171

7272
type: Literal["float"]
73-
family: Sequence[str]
73+
tags: Sequence[str]
7474
title: str
7575
hint: str | None
7676

@@ -83,7 +83,7 @@ class IntegerSetting(TypedDict):
8383
"""Floating numerical option."""
8484

8585
type: Literal["int"]
86-
family: Sequence[str]
86+
tags: Sequence[str]
8787
title: str
8888
hint: str | None
8989

@@ -102,7 +102,7 @@ class ColorSetting(TypedDict):
102102
"""RGB color setting."""
103103

104104
type: Literal["color"]
105-
family: Sequence[str]
105+
tags: Sequence[str]
106106
title: str
107107
hint: str | None
108108

@@ -115,15 +115,15 @@ class CustomSetting(TypedDict):
115115
Can be used for any required custom setting that is not covered by the
116116
default ones (e.g., fan curves, deadzones).
117117
118-
The setting type is defined by family.
118+
The setting type is defined by tags.
119119
Then, the config variable can be used to supply option specific information
120120
(e.g., for fan curves how many temperature points are available).
121121
122122
To validate this setting, each loaded plugin's validate function is called,
123-
with the family, config data, and the supplied value."""
123+
with the tags, config data, and the supplied value."""
124124

125125
type: Literal["custom"]
126-
family: Sequence[str]
126+
tags: Sequence[str]
127127
title: str
128128
hint: str | None
129129

@@ -151,7 +151,7 @@ class Container(TypedDict):
151151
"""Holds a variety of settings."""
152152

153153
type: Literal["container"]
154-
family: Sequence[str]
154+
tags: Sequence[str]
155155
title: str
156156
hint: str | None
157157

@@ -162,7 +162,7 @@ class Mode(TypedDict):
162162
"""Holds a number of containers, only one of whih can be active at a time."""
163163

164164
type: Literal["mode"]
165-
family: Sequence[str]
165+
tags: Sequence[str]
166166
title: str
167167
hint: str | None
168168

@@ -221,7 +221,7 @@ class Mode(TypedDict):
221221
)
222222

223223

224-
Section = MutableMapping[str, Container]
224+
Section = Mapping[str, Container]
225225

226226
HHDSettings = Mapping[str, Section]
227227

@@ -251,7 +251,7 @@ def parse_defaults(sets: HHDSettings):
251251

252252
def fill_in_defaults(s: Setting | Container | Mode):
253253
s = copy(s)
254-
s["family"] = s.get("family", [])
254+
s["tags"] = s.get("tags", [])
255255
s["title"] = s.get("title", "")
256256
s["hint"] = s.get("hint", None)
257257
if s["type"] != "container":
@@ -658,7 +658,7 @@ def unravel_options(settings: HHDSettings):
658658

659659

660660
class Validator(Protocol):
661-
def __call__(self, family: Sequence[str], config: Any, value: Any) -> bool:
661+
def __call__(self, tags: Sequence[str], config: Any, value: Any) -> bool:
662662
return False
663663

664664

@@ -723,7 +723,7 @@ def validate_config(
723723
else:
724724
del conf[k]
725725
case "custom":
726-
if not validator(d["family"], d["config"], v):
726+
if not validator(d["tags"], d["config"], v):
727727
if use_defaults:
728728
conf[k] = default
729729
else:

0 commit comments

Comments
 (0)