From a93ccd680fd4f3fba900e1f242122c00ff373eae Mon Sep 17 00:00:00 2001 From: Markus Cisler Date: Sun, 13 Jun 2021 01:08:40 +0200 Subject: [PATCH 1/2] Toggle recent mentions popup with alt-m This adds a keybind to toggle the recent mentions popup using alt+m (or opt+m on macOS). Relates to #4175 --- client/components/App.vue | 5 +++++ client/components/Windows/Help.vue | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/client/components/App.vue b/client/components/App.vue index b136874f..ddd537a1 100644 --- a/client/components/App.vue +++ b/client/components/App.vue @@ -51,6 +51,7 @@ export default { Mousetrap.bind("esc", this.escapeKey); Mousetrap.bind("alt+u", this.toggleUserList); Mousetrap.bind("alt+s", this.toggleSidebar); + Mousetrap.bind("alt+m", this.toggleMentions); // Make a single throttled resize listener available to all components this.debouncedResize = throttle(() => { @@ -72,6 +73,7 @@ export default { Mousetrap.unbind("esc", this.escapeKey); Mousetrap.unbind("alt+u", this.toggleUserList); Mousetrap.unbind("alt+s", this.toggleSidebar); + Mousetrap.unbind("alt+m", this.toggleMentions); window.removeEventListener("resize", this.debouncedResize); clearTimeout(this.dayChangeTimeout); @@ -98,6 +100,9 @@ export default { return false; }, + toggleMentions() { + eventbus.emit("mentions:toggle"); + }, msUntilNextDay() { // Compute how many milliseconds are remaining until the next day starts const today = new Date(); diff --git a/client/components/Windows/Help.vue b/client/components/Windows/Help.vue index 8015bbf8..95067dff 100644 --- a/client/components/Windows/Help.vue +++ b/client/components/Windows/Help.vue @@ -189,6 +189,16 @@ +
+
+ Alt M + M +
+
+

Toggle recent mentions popup.

+
+
+
Esc From 243f514243245a833234c9a7afd847217854e911 Mon Sep 17 00:00:00 2001 From: Markus Cisler Date: Sun, 13 Jun 2021 01:49:23 +0200 Subject: [PATCH 2/2] Only toggle mentions popup if connected to network The top bar is only shown if the user is connected to at least one network. Only then it is possible to open the recent mentions popup. Only toggle the recent mentions popup if the user is connected to at least one network so the popup will not open over the connect view. --- client/components/App.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/components/App.vue b/client/components/App.vue index ddd537a1..d821ca3c 100644 --- a/client/components/App.vue +++ b/client/components/App.vue @@ -101,7 +101,9 @@ export default { return false; }, toggleMentions() { - eventbus.emit("mentions:toggle"); + if (this.$store.state.networks.length !== 0) { + eventbus.emit("mentions:toggle"); + } }, msUntilNextDay() { // Compute how many milliseconds are remaining until the next day starts