mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
Add shortcuts to provider
This commit is contained in:
@ -1,18 +1,40 @@
|
||||
// This is used for to control the songs
|
||||
const pressKey = (window, key) => {
|
||||
const pressKey = (window, key, modifiers = []) => {
|
||||
window.webContents.sendInputEvent({
|
||||
type: "keydown",
|
||||
modifiers,
|
||||
keyCode: key,
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = (win) => {
|
||||
return {
|
||||
// Playback
|
||||
previous: () => pressKey(win, "k"),
|
||||
next: () => pressKey(win, "j"),
|
||||
playPause: () => pressKey(win, "space"),
|
||||
like: () => pressKey(win, "_"),
|
||||
dislike: () => pressKey(win, "+"),
|
||||
go10sBack: () => pressKey(win, "h"),
|
||||
go10sForward: () => pressKey(win, "l"),
|
||||
go1sBack: () => pressKey(win, "h", ["shift"]),
|
||||
go1sForward: () => pressKey(win, "l", ["shift"]),
|
||||
shuffle: () => pressKey(win, "s"),
|
||||
switchRepeat: () => pressKey(win, "r"),
|
||||
// General
|
||||
volumeMinus10: () => pressKey(win, "-"),
|
||||
volumePlus10: () => pressKey(win, "="),
|
||||
dislikeAndNext: () => pressKey(win, "-", ["shift"]),
|
||||
like: () => pressKey(win, "=", ["shift"]),
|
||||
fullscreen: () => pressKey(win, "f"),
|
||||
muteUnmute: () => pressKey(win, "m"),
|
||||
maximizeMinimisePlayer: () => pressKey(win, "q"),
|
||||
// Navigation
|
||||
goToHome: () => pressKey(win, "h", ["g"]),
|
||||
goToLibrary: () => pressKey(win, "l", ["g"]),
|
||||
goToHotlist: () => pressKey(win, "t", ["g"]),
|
||||
goToSettings: () => pressKey(win, ",", ["g"]),
|
||||
search: () => pressKey(win, "/"),
|
||||
showShortcuts: () => pressKey(win, "/", ["shift"]),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user