Skip to content

Build your personal knowledge base with Trilium Notes

feat(options): show a prominent conflicts badge in the shortcuts header

Elian Doran97eff8564c4f
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 2bb8582ce2..b011f1b6a1 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -1745,7 +1745,10 @@
"filter_all": "All shortcuts",
"filter_conflicts": "Conflicts ({{count}})",
"filter_global": "Global shortcuts ({{count}})",
- "filter_modified": "Changed from default ({{count}})"
+ "filter_modified": "Changed from default ({{count}})",
+ "conflicts_badge_one": "{{count}} conflict",
+ "conflicts_badge_other": "{{count}} conflicts",
+ "conflicts_badge_tooltip": "Some shortcuts are assigned to more than one action. Click to show only the conflicting shortcuts."
},
"spellcheck": {
"title": "Spell Check",
diff --git a/apps/client/src/widgets/type_widgets/options/shortcuts.css b/apps/client/src/widgets/type_widgets/options/shortcuts.css
index 406bd65798..27e0015050 100644
--- a/apps/client/src/widgets/type_widgets/options/shortcuts.css
+++ b/apps/client/src/widgets/type_widgets/options/shortcuts.css
@@ -24,6 +24,30 @@
.icon-action.active {
color: var(--link-color);
}
+
+ /* Prominent pill flagging that conflicts exist; click to filter to them. */
+ .shortcut-conflicts-badge {
+ flex: 0 0 auto;
+ display: inline-flex;
+ align-items: center;
+ gap: 0.35em;
+ border: 1px solid var(--icon-button-danger-color, #d9534f);
+ border-radius: 999px;
+ padding: 0.2em 0.7em;
+ font-size: 0.85em;
+ font-weight: 600;
+ white-space: nowrap;
+ color: var(--icon-button-danger-color, #d9534f);
+ background: transparent;
+ cursor: pointer;
+ transition: background-color 0.15s, color 0.15s;
+ }
+
+ .shortcut-conflicts-badge:hover,
+ .shortcut-conflicts-badge.active {
+ color: var(--main-background-color);
+ background: var(--icon-button-danger-color, #d9534f);
+ }
}
> footer {
diff --git a/apps/client/src/widgets/type_widgets/options/shortcuts.tsx b/apps/client/src/widgets/type_widgets/options/shortcuts.tsx
index 865d299287..e6eae5939e 100644
--- a/apps/client/src/widgets/type_widgets/options/shortcuts.tsx
+++ b/apps/client/src/widgets/type_widgets/options/shortcuts.tsx
@@ -113,6 +113,16 @@ export default function ShortcutSettings() {
placeholder={t("shortcuts.type_text_to_filter")}
currentValue={filter} onChange={(value) => setFilter(value)}
/>
+ {conflicts.size > 0 &&
+ <button
+ type="button"
+ class={`shortcut-conflicts-badge ${activeFilter === "conflicts" ? "active" : ""}`}
+ title={t("shortcuts.conflicts_badge_tooltip")}
+ onClick={() => setActiveFilter(activeFilter === "conflicts" ? null : "conflicts")}
+ >
+ <span class="bx bx-error-circle" />
+ {t("shortcuts.conflicts_badge", { count: conflicts.size })}
+ </button>}
<Dropdown
buttonClassName={`bx bx-filter-alt ${activeFilter ? "active" : ""}`}
hideToggleArrow