aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-07-08 20:02:20 -0400
committerGitHub <noreply@github.com>2020-07-08 20:02:20 -0400
commitf76a6ff1e320646098620a6109919ddb8dbcf747 (patch)
treee3dd6be643a4f87dd36e10a62c6baada2ad4a4b4 /ext/fg/js
parent6f49f426b518bdbca11c7994246eb088903e6619 (diff)
Refactor hotkey definitions to be more generic (#655)
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/float.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/ext/fg/js/float.js b/ext/fg/js/float.js
index 17af03d3..2debdeff 100644
--- a/ext/fg/js/float.js
+++ b/ext/fg/js/float.js
@@ -40,14 +40,11 @@ class DisplayFloat extends Display {
['setContentScale', {handler: this._onMessageSetContentScale.bind(this)}]
]);
- this.setOnKeyDownHandlers([
- ['C', (e) => {
- if (e.ctrlKey && !window.getSelection().toString()) {
- this._copySelection();
- return true;
- }
- return false;
- }]
+ this.registerActions([
+ ['copy-host-selection', () => this._copySelection()]
+ ]);
+ this.registerHotkeys([
+ {key: 'C', modifiers: ['ctrl'], action: 'copy-host-selection'}
]);
}
@@ -168,7 +165,9 @@ class DisplayFloat extends Display {
// Private
_copySelection() {
+ if (window.getSelection().toString()) { return false; }
this._invoke('copySelection');
+ return true;
}
_clearAutoPlayTimer() {