Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotkeys get triggered incorrectly #696

Closed
2 tasks done
nshcat opened this issue Dec 23, 2019 · 3 comments
Closed
2 tasks done

hotkeys get triggered incorrectly #696

nshcat opened this issue Dec 23, 2019 · 3 comments
Labels

Comments

@nshcat
Copy link

nshcat commented Dec 23, 2019

Feature request

  • I understand the difference between Streamlink and Streamlink Twitch GUI.
  • This is a feature request and I have read the contribution guidelines.

Description

On some window managers used on Linux, application windows are closed using key combinations other than the typical Alt-F4. For example, with the tiling window manager "awesome WM", the combination is Super + Shift + C.
This causes problems with Streamlink Twitch Gui, since this always opens a new browser window with the chat open, if a stream is currently playing and you are trying to kill the application. Of course, a workaround is to use the mouse and click on the close button, but if you're used to managing your whole workstation using only the keyboard, this definitely is a bit annoying.
It would therefore be nice to have a feature to disable all hotkeys in the application to avoid this.

@nshcat nshcat changed the title Include configuration option to disable certain hotkeys Include configuration option to disable certain or all hotkeys Dec 23, 2019
@bastimeyer
Copy link
Member

option to disable certain or all hotkeys

duplicate of #502

On some window managers used on Linux, application windows are closed using key combinations other than the typical Alt-F4.

I'm aware of this, as I'm using plasma with the super+q hotkey myself.

if you're used to managing your whole workstation using only the keyboard

As said in #562, Streamlink Twitch GUI currently does not support proper keyboard navigation.

This causes problems with Streamlink Twitch Gui, since this always opens a new browser window with the chat open

That's a bug then and it shouldn't pick up the hotkey in this scenario. There's also a similar issue where the GUI doesn't lose focus after opening a stream. I'll keep this thread open for tracking this bug / these bugs.

@bastimeyer bastimeyer changed the title Include configuration option to disable certain or all hotkeys hotkeys get triggered incorrectly Dec 23, 2019
@bastimeyer bastimeyer added the bug label Dec 23, 2019
@bastimeyer
Copy link
Member

btw, if you want to disable all hotkeys in the meantime, you can apply the following patch and rebuild the application:

diff --git a/src/app/services/hotkey/service.js b/src/app/services/hotkey/service.js
index 74808d0d..e5311127 100644
--- a/src/app/services/hotkey/service.js
+++ b/src/app/services/hotkey/service.js
@@ -74,8 +74,6 @@ export default Service.extend({
 			return;
 		}
 
-		/** @type {Component} */
-		let context;
 		/** @type {Hotkey} */
 		let hotkey;
 
@@ -90,7 +88,6 @@ export default Service.extend({
 			);
 
 			if ( hotkey ) {
-				context = registry.context;
 				break;
 			}
 		}
@@ -106,16 +103,8 @@ export default Service.extend({
 		}
 
 		// execute action
-		const { action } = hotkey;
 		let result;
 
-		if ( typeof action === "string" ) {
-			context.send( action );
-
-		} else if ( action instanceof Function ) {
-			result = action.call( context );
-		}
-
 		// bubble event
 		if ( result === true ) {
 			this.trigger( event, start + 1 );
diff --git a/src/test/tests/services/hotkey.js b/src/test/tests/services/hotkey.js
index 3f8143b2..78cced43 100644
--- a/src/test/tests/services/hotkey.js
+++ b/src/test/tests/services/hotkey.js
@@ -1,4 +1,4 @@
-import { module, test } from "qunit";
+import { module, skip as test } from "qunit";
 import { setupRenderingTest } from "ember-qunit";
 import { buildResolver } from "test-utils";
 import { FakeI18nService } from "i18n-utils";

bastimeyer added a commit that referenced this issue Dec 24, 2019
See #696

- Add `ctrlKey` modifier to all alphanumeric hotkeys
- Remove subscribe channel hotkey (previously `s`)
- Change share channel hotkey from `u` to `ctrlKey+s`
@bastimeyer
Copy link
Member

Hotkeys should now only trigger if all of the modifiers match (altKey, ctrlKey, metaKey, shiftKey). This wasn't the case previously and only the defined modifiers of the hotkey needed to match.

I've also changed all alphanumerical hotkeys and added the ctrlKey modifier there (eg. opening the chat changed from c to ctrl+c). See the comment message of 88e0323.

There's also a similar issue where the GUI doesn't lose focus after opening a stream.

What I meant here was that the modal dialog of a stream sometimes gets closed if I press q. I thought this had something to do with the focus of the app's window, but it was actually caused by my MPV bindings and MPV reacting to the keydown and the Twitch GUI to keyup event, so a single press caused two consecutive actions. But as mentioned above, all alphanumeric hotkeys have been changed to ctrlKey+key, so it's ctrl+q (and ctrl+x) now.


Regarding customizable hotkeys, as said, #502 already exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants