From 69bfb89a656d269b40e19de036b36736c0b87992 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Tue, 2 Sep 2025 16:08:32 +0200 Subject: [PATCH] Add new shortcuts to shortcuts dialog (#26836) --- src/components/ha-automation-row.ts | 7 +++++-- src/dialogs/shortcuts/dialog-shortcuts.ts | 15 +++++++++++++++ src/translations/en.json | 3 +++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/components/ha-automation-row.ts b/src/components/ha-automation-row.ts index 6db5fc45f1..fe9d6d27a3 100644 --- a/src/components/ha-automation-row.ts +++ b/src/components/ha-automation-row.ts @@ -88,7 +88,10 @@ export class HaAutomationRow extends LitElement { (ev.ctrlKey || ev.metaKey) && !ev.shiftKey && !ev.altKey && - (ev.key === "c" || ev.key === "x" || ev.key === "Delete") + (ev.key === "c" || + ev.key === "x" || + ev.key === "Delete" || + ev.key === "Backspace") ) ) { return; @@ -119,7 +122,7 @@ export class HaAutomationRow extends LitElement { return; } - if (ev.key === "Delete") { + if (ev.key === "Delete" || ev.key === "Backspace") { fireEvent(this, "delete-row"); return; } diff --git a/src/dialogs/shortcuts/dialog-shortcuts.ts b/src/dialogs/shortcuts/dialog-shortcuts.ts index dbd85839ae..9af66e3002 100644 --- a/src/dialogs/shortcuts/dialog-shortcuts.ts +++ b/src/dialogs/shortcuts/dialog-shortcuts.ts @@ -71,6 +71,21 @@ const _SHORTCUTS: Section[] = [ { key: "ui.dialogs.shortcuts.automation_script.title", items: [ + { + type: "shortcut", + shortcut: [{ key: "ui.dialogs.shortcuts.shortcuts.ctrl_cmd" }, "C"], + key: "ui.dialogs.shortcuts.automation_script.copy", + }, + { + type: "shortcut", + shortcut: [{ key: "ui.dialogs.shortcuts.shortcuts.ctrl_cmd" }, "X"], + key: "ui.dialogs.shortcuts.automation_script.cut", + }, + { + type: "shortcut", + shortcut: [{ key: "ui.dialogs.shortcuts.shortcuts.ctrl_cmd" }, "del"], + key: "ui.dialogs.shortcuts.automation_script.delete", + }, { type: "shortcut", shortcut: [{ key: "ui.dialogs.shortcuts.shortcuts.ctrl_cmd" }, "V"], diff --git a/src/translations/en.json b/src/translations/en.json index 088d70a038..5507ff5b62 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2061,6 +2061,9 @@ }, "automation_script": { "title": "Automations / Scripts", + "copy": "to copy the selected automation/script action/condition/trigger", + "cut": "to cut the selected automation/script action/condition/trigger", + "delete": "to delete the selected automation/script action/condition/trigger", "paste": "to paste automation/script YAML from clipboard to editor", "save": "to save automation/script" },