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

Add YouTube style keyboard shortcuts #1443

Closed
wants to merge 2 commits into from
Closed

Add YouTube style keyboard shortcuts #1443

wants to merge 2 commits into from

Conversation

hicom150
Copy link
Contributor

@hicom150 hicom150 commented Jul 30, 2018

refs: #1395

Left/Right arrows - seek back/forward 5 seconds
Up/Down arrows - volume up/down 5%
j or l - seek back/forward 10 seconds
k - play/pause
Shift + > - Increase speed
Shift + < - Decrease speed

@hicom150 hicom150 reopened this Jul 30, 2018
@sunshinecool
Copy link

Hi! Is this going to get merged anytime soon?

Copy link
Member

@Borewit Borewit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The YouTube keyboards are looking good to me.

Great idea to add Linux integration tests, but please be so kind to move those in a different PR.

I did test it under Linux and it all does what it supposed to do, however due to small nasty differences lay-out delta's the unit tests are not passing.

@sunshinecool
Copy link

@Borewit sure, I will try to add a few tests for this change.

@Borewit
Copy link
Member

Borewit commented Oct 8, 2018

So please get rid of c246850 & fd93741 in this PR.

@hicom150
Copy link
Contributor Author

hicom150 commented Oct 8, 2018

@Borewit I think I have successfully removed the requested commits. Sorry I'm still a newbie 😅

@Borewit
Copy link
Member

Borewit commented Oct 10, 2018

Thanks @sunshinecool, you doing just fine.

Copy link
Member

@Borewit Borewit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to go through the changes one more time, no changes rqeuired on PR.

@mathiasvr
Copy link
Contributor

As I mentioned in the issue, I don't really like to have multiple shortcuts for the same actions.
I'm also not a fan of using two different key handlers (electron menu accelerators, and addEventListener).
I find it confusing that Cmd+Alt+Right skips 10s and a single Right skips 5s, and would they ever overlap?

I think we should just update the accelerators for seeking and volume control, and keep the rest.

Thoughts?

@Borewit
Copy link
Member

Borewit commented Oct 11, 2018

I agree with @mathiasvr for consistency in the code it would be better to have one way to assign keys.

I have in principle no problem with multiple assignents mapped to the same action, as long there is a justification for the existence of each of them. To be compliant with YouTube layout is in my opinion a good justification, but it is indeed a fair question, do we still need the other one?

If you move your shortcuts to the accelerators, please mark them with comment so it is clear they are part of the YouTube like layout key-layout.

Happy with that consession @mathiasvr?

To have all the shortcuts documented somehere would be awesome.

Just a small advice on your next PR, for mostly your own benefit, don't commit changes to your master branch. Keep that one reserver for incoming changes from the original master. Some more info on this kind of conventions can be found here.

Will you create another PR with the work you did on the Linux integration tests?

@mathiasvr
Copy link
Contributor

@Borewit The problem is that the menu accelerators don't support multiple shortcuts, so if we want to support different shortcuts (at the same time), we probably have to do it this way.

I don't know how we are going to decide this though?

@Borewit
Copy link
Member

Borewit commented Oct 11, 2018

By being pragmatic.

I believe to support the YouTube shortcuts is desired according to @feross the way I read it in the underlying issue. This issue has been marked as a good first contribution, someone took the challenge, I think we should approve or give guidence how he can succeed on his objective.

If it doesn’t fit in the menu accelerators, it makes sense to have the mechanism defined elsewhere. It should not conflict indeed, if so that needs to be addressed.

@@ -150,6 +150,8 @@ function onState (err, _state) {
// ...same thing if you paste a torrent
document.addEventListener('paste', onPaste)

document.addEventListener('keyup', onKeyup)
Copy link
Member

@Borewit Borewit Oct 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why keyup and not keydown?

@mathiasvr
Copy link
Contributor

I guess I will let @hicom150 decide then.

You can update the menu accelerators for seeking and volume control, I think that's the best solution.

Or if you think we should go with the current solution, I would request the following changes:

  • use keydown instead of keyup, i think instant feedback and repeated events is an improvement.
  • use window.addEventListener instead of document.addEventListener.
  • use e.key instead e.code, currently this PR only works with qwerty keyboard layouts.

@Borewit
Copy link
Member

Borewit commented May 6, 2019

Superseded by #1395 due the fact the underlying repo holding the PR branch is missing.

@Borewit Borewit closed this May 6, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants