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

With MultimediaKeyboard Key Codes such as play/pause , next,pre. 适用于 具有多媒体键盘功能的用户,可以直接使用 播放/暂停, 下一首 ,上一首的多功能按键。 #2275

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
2 changes: 1 addition & 1 deletion .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
id: sync
uses: aormsby/[email protected]
with:
upstream_sync_repo: qier222/YesPlayMusic
upstream_sync_repo: chenjingxiong/YesPlayMusic
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
upstream_sync_repo: chenjingxiong/YesPlayMusic
upstream_sync_repo: qier222/YesPlayMusic

這個不太應該提交進去 🥺

upstream_sync_branch: master
target_sync_branch: master
target_repo_token: ${{ secrets.GITHUB_TOKEN }} # automatically generated, no need to set
Expand Down
36 changes: 36 additions & 0 deletions src/electron/globalShortcut.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,40 @@ export function registerGlobalShortcut(win, store) {
win.isVisible() ? win.hide() : win.show();
}
);

/*
增加 多媒体键盘 特殊按键 :
多媒体键码值(keyCode)
音量大,音量小,静音,上一首,暂停/播放,下一首,停止
175, 174, 173,177, 179, 176, 178
*/

globalShortcut.register(
179,
() => {
win.webContents.send('play');
}
);
globalShortcut.register(
176,
() => {
win.webContents.send('next');
}
);
globalShortcut.register(
177,
() => {
win.webContents.send('previous');
}
);

//音量增大和减少采用 多媒体键盘全局设置即可。无需单独注册。
/*
注意:
在 macOS 10.14 Mojave 下面,如果 app 没有被授权为可信任使用的客户端,那么下列快捷键会注册失败:
"Media Play/Pause"
"Media Next Track"
"Media Previous Track"
"Media Stop"
*/
}