The Sound preferences read clearly at 72 columns, and their dialogs ask a real question

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jean-Pierre MartineauandClaude Opus 5.5 committed 2026-11-21 00:54:11 -05:00
1 parent 95f12c0a22
commit 037585dd15
5 files changed
+40 -23

No files matched your search

+3 -2
View File
@@ -23,8 +23,9 @@ can change how things behave. It does not only add new things.
- **MeshTerm plays sounds for the messages that you want to know about.** A DM, a mention
of your node, a channel message, a room post, and a low battery each have their own
sound, from Android's set (the Android Open Source Project, under the same licence as
MeshTerm). Each channel, DM, and room has a *Sound* row: off, mentions, all messages, or
the default for its kind (all messages for a DM, mentions for a channel or a room).
MeshTerm). Each channel, DM, and room has a *Sound* row: never, mentions only, every message,
or the default for its kind (every message for a DM, mentions only for a channel or a
room).
Ctrl+S mutes or unmutes the sounds from any screen, and the header shows 🔊 or 🔇. The
new *Sound* group of preferences has the theme (Android, terminal bell, or no sound), a
volume slider of ten steps that plays each step, a short tick for each packet heard (off
+5 -5
View File
@@ -85,17 +85,17 @@ MeshTerm plays a sound when something arrives that you want to know about now:
| --- | --- |
| Direct message | A DM arrives |
| Mention | A message in any conversation mentions your node (`@[Your name]`) |
| Channel message | A message arrives on a channel that you set to **All** |
| Room post | A post arrives in a room that you set to **All** |
| Channel message | A message arrives on a channel whose sound is **every message** |
| Room post | A post arrives in a room whose sound is **every message** |
| Battery low | The battery goes below 25% (the **Battery low** preference). It plays one time, and again only after the battery is 5 points higher or charges |
| Packet tick | A very short tick for each packet heard that plays no other sound. It is off until you turn on **Packet tick**, and it plays at most four times each second |
The conversation that is open on the screen makes no sound, because you already see it.
Each channel, DM, and room has a **Sound** row: on the channel page, on the node page of
the contact, and on the room page. Select **Off**, **Mentions**, **All messages**, or
**Default**. Default follows the preference for that kind of conversation: all messages
for a DM, and mentions for a channel or a room. The mute of a channel (🔕) is a different
the contact, and on the room page. Select **never**, **mentions only**, **every message**, or
**Default**. Default follows the preference for that kind of conversation: every message
for a DM, and mentions only for a channel or a room. The mute of a channel (🔕) is a different
setting. It removes the channel from the unread count, but a mention in it still plays a
sound.
+26 -10
View File
@@ -110,6 +110,9 @@ class PrefSpec:
relaunch: Whether the new value applies only at the next start. It is part of
the description, instead of a mark of its own, because it is a caveat about
one preference. It is not a status that the user looks for in a column.
question: The question of the dialog that edits the value, when the short help of
the row does not read as one ("When a DM plays a sound"). ``""`` (the default)
asks with the help.
platforms: The :class:`~meshterm.platforms.Platform` names on which the page
offers the preference, or ``None`` (the default) for all of them. Some
preferences are about hardware that only one flavour has (the console font
@@ -133,6 +136,7 @@ class PrefSpec:
unit: str = ""
relaunch: bool = False
platforms: frozenset[str] | None = None
question: str = ""
@property
def description(self) -> str:
@@ -178,7 +182,11 @@ _FLASH_CHOICES: dict[str, str] = {"off": "off", "on": "on", "silent": "when sile
#: When a conversation plays its sound. A mention of our node always plays the mention
#: sound, unless the conversation is ``off``.
SOUND_WHEN_CHOICES: dict[str, str] = {"off": "off", "mentions": "mentions", "all": "all messages"}
SOUND_WHEN_CHOICES: dict[str, str] = {
"off": "never",
"mentions": "mentions only",
"all": "every message",
}
#: The sources of the place of a node (refer to :mod:`meshterm.services.places`). With
#: ``tiles_nominatim``, the map tiles give the first answer at once, and Nominatim corrects it
@@ -505,7 +513,7 @@ PREFERENCES: tuple[PrefSpec, ...] = (
PrefSpec(
key="sound_theme",
label="Sound theme",
help="The set of sounds that notifications play",
help="Which sounds play",
group="Sound",
value_type="enum",
# Android, and not muted (JP, 2026-11-20). "No sound" is a theme, not a mute: the
@@ -517,7 +525,8 @@ PREFERENCES: tuple[PrefSpec, ...] = (
PrefSpec(
key="sound_muted",
label="Mute",
help="Mute the sounds for now. ^S mutes or unmutes on any screen",
help="^S mutes on any screen",
question="Mute the sounds? ^S also mutes or unmutes them on any screen",
group="Sound",
value_type="bool",
# A mute is for now, and the theme is for always. ^S changes this preference from
@@ -528,7 +537,8 @@ PREFERENCES: tuple[PrefSpec, ...] = (
PrefSpec(
key="sound_volume",
label="Volume",
help="How loud the sounds play: 1 is 10%, 10 is 100%",
help="1 is 10%, 10 is 100%",
question="How loud the sounds play: 1 is 10%, 10 is 100%",
group="Sound",
value_type="int",
# A slider of ten steps (JP, 2026-11-20). MeshTerm scales the samples itself,
@@ -542,7 +552,8 @@ PREFERENCES: tuple[PrefSpec, ...] = (
PrefSpec(
key="notify_flash",
label="Flash",
help="Flash the title bar for a notification",
help="Flash the title instead",
question="When the title flashes for a notification",
group="Sound",
value_type="enum",
# When silent: the flash replaces a sound that does not play, and it does not add to
@@ -553,7 +564,8 @@ PREFERENCES: tuple[PrefSpec, ...] = (
PrefSpec(
key="dm_sound",
label="DM sound",
help="When a DM plays a sound, if its own Sound is Default",
help="Unless set per DM",
question="When a DM plays a sound, unless the DM has its own setting",
group="Sound",
value_type="enum",
default="all",
@@ -563,7 +575,8 @@ PREFERENCES: tuple[PrefSpec, ...] = (
PrefSpec(
key="channel_sound",
label="Channel sound",
help="When a channel plays a sound, if its own Sound is Default",
help="Unless set per channel",
question="When a channel plays a sound, unless the channel has its own setting",
group="Sound",
value_type="enum",
# Mentions: a public channel can carry many messages each hour.
@@ -574,7 +587,8 @@ PREFERENCES: tuple[PrefSpec, ...] = (
PrefSpec(
key="room_sound",
label="Room sound",
help="When a room plays a sound, if its own Sound is Default",
help="Unless set per room",
question="When a room plays a sound, unless the room has its own setting",
group="Sound",
value_type="enum",
default="mentions",
@@ -584,7 +598,8 @@ PREFERENCES: tuple[PrefSpec, ...] = (
PrefSpec(
key="packet_tick",
label="Packet tick",
help="A short tick for each packet heard that plays no other sound",
help="A tick for other packets",
question="A short tick for each packet heard that plays no other sound",
group="Sound",
value_type="bool",
# Off: a busy mesh can send many packets each minute. The service plays at most one
@@ -595,7 +610,8 @@ PREFERENCES: tuple[PrefSpec, ...] = (
PrefSpec(
key="battery_low_pct",
label="Battery low",
help="Play the battery sound when the battery goes below this level",
help="Plays the battery sound",
question="Play the battery sound when the battery goes below this level",
group="Sound",
value_type="int",
# 25: the level where the gauge of the header changes to its low band (batt.low).
+4 -4
View File
@@ -471,7 +471,7 @@ async def _prompt_value(ctx: AppContext, spec: PrefSpec, current: Any) -> Any:
# A choice between two states is clearest as a pair of buttons. The current state
# is highlighted, so that Enter does not change anything by accident.
return await ctx.ui.dialog(
spec.description,
(spec.question or spec.description),
[("Off", False), ("On", True)],
title=spec.label,
default=1 if current else 0,
@@ -487,7 +487,7 @@ async def _prompt_value(ctx: AppContext, spec: PrefSpec, current: Any) -> Any:
for value, label in spec.choices.items()
]
return await ctx.ui.select(
spec.label, items, prompt=f"{spec.description}:", default=current
spec.label, items, prompt=f"{(spec.question or spec.description)}:", default=current
)
if spec.key == "sound_volume":
@@ -496,7 +496,7 @@ async def _prompt_value(ctx: AppContext, spec: PrefSpec, current: Any) -> Any:
result = await ctx.ui.session.run_screen(
SliderScreen(
spec.label,
spec.help,
spec.question or spec.help,
int(current),
int(spec.minimum or 1),
int(spec.maximum or 10),
@@ -516,7 +516,7 @@ async def _prompt_value(ctx: AppContext, spec: PrefSpec, current: Any) -> Any:
raw = await ctx.ui.text(
spec.label,
prompt=f"{spec.description}:",
prompt=f"{(spec.question or spec.description)}:",
default="" if current is None else str(current),
validate=validate,
help_text=range_hint(spec),
+2 -2
View File
@@ -39,8 +39,8 @@ def _ctx(tmp_path: Path, answer: object = None, **prefs: object) -> SimpleNamesp
def test_the_description_names_the_default_or_the_own_setting(tmp_path: Path) -> None:
"""With no setting, the row names the default of the kind. With one, it names it."""
ctx = _ctx(tmp_path)
assert conversation_sound.describe(ctx, "chan:a", "channel") == "Default: mentions"
assert conversation_sound.describe(ctx, "dm:b", "dm") == "Default: all messages"
assert conversation_sound.describe(ctx, "chan:a", "channel") == "Default: mentions only"
assert conversation_sound.describe(ctx, "dm:b", "dm") == "Default: every message"
ctx.sound_store.set("chan:a", "off")
assert conversation_sound.describe(ctx, "chan:a", "channel") == "No sound"