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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove old hotkeys in favor of new YouTube style #1581

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions src/main/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ function getMenuTemplate () {
{
label: 'Full Screen',
type: 'checkbox',
accelerator: process.platform === 'darwin'
? 'Ctrl+Command+F'
: 'F11',
accelerator: 'F',
click: () => windows.main.toggleFullScreen()
},
{
Expand Down Expand Up @@ -224,13 +222,13 @@ function getMenuTemplate () {
},
{
label: 'Increase Volume',
accelerator: 'CmdOrCtrl+Up',
accelerator: 'Up',
click: () => windows.main.dispatch('changeVolume', 0.1),
enabled: false
},
{
label: 'Decrease Volume',
accelerator: 'CmdOrCtrl+Down',
accelerator: 'Down',
click: () => windows.main.dispatch('changeVolume', -0.1),
enabled: false
},
Expand All @@ -239,32 +237,28 @@ function getMenuTemplate () {
},
{
label: 'Step Forward',
accelerator: process.platform === 'darwin'
? 'CmdOrCtrl+Alt+Right'
: 'Alt+Right',
click: () => windows.main.dispatch('skip', 10),
accelerator: 'Right',
click: () => windows.main.dispatch('skip', 5),
enabled: false
},
{
label: 'Step Backward',
accelerator: process.platform === 'darwin'
? 'CmdOrCtrl+Alt+Left'
: 'Alt+Left',
click: () => windows.main.dispatch('skip', -10),
accelerator: 'Left',
click: () => windows.main.dispatch('skip', -5),
enabled: false
},
{
type: 'separator'
},
{
label: 'Increase Speed',
accelerator: 'CmdOrCtrl+=',
accelerator: '>',
click: () => windows.main.dispatch('changePlaybackRate', 1),
enabled: false
},
{
label: 'Decrease Speed',
accelerator: 'CmdOrCtrl+-',
accelerator: '<',
click: () => windows.main.dispatch('changePlaybackRate', -1),
enabled: false
},
Expand Down
31 changes: 0 additions & 31 deletions src/renderer/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,6 @@ function onState (err, _state) {
// ...same thing if you paste a torrent
document.addEventListener('paste', onPaste)

// Add YouTube style hotkey shortcuts
window.addEventListener('keydown', onKeydown)

const debouncedFullscreenToggle = debounce(function () {
dispatch('toggleFullScreen')
}, 1000, true)
Expand Down Expand Up @@ -510,34 +507,6 @@ function onPaste (e) {
update()
}

function onKeydown (e) {
const key = e.key

if (key === 'ArrowLeft') {
dispatch('skip', -5)
} else if (key === 'ArrowRight') {
dispatch('skip', 5)
} else if (key === 'ArrowUp') {
dispatch('changeVolume', 0.1)
} else if (key === 'ArrowDown') {
dispatch('changeVolume', -0.1)
} else if (key === 'j') {
dispatch('skip', -10)
} else if (key === 'l') {
dispatch('skip', 10)
} else if (key === 'k') {
dispatch('playPause')
} else if (key === '>') {
dispatch('changePlaybackRate', 1)
} else if (key === '<') {
dispatch('changePlaybackRate', -1)
} else if (key === 'f') {
dispatch('toggleFullScreen')
}

update()
}

function onFocus (e) {
state.window.isFocused = true
state.dock.badge = 0
Expand Down