From f501bb646201357ca83991864377c1ce94b04285 Mon Sep 17 00:00:00 2001 From: chenjingxiong Date: Fri, 19 Jul 2024 22:45:17 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=9A=E5=AA=92?= =?UTF-8?q?=E4=BD=93=E6=8C=89=E9=94=AE=E7=9A=84=E6=8C=89=E9=94=AE=E7=A0=81?= =?UTF-8?q?=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sync.yml | 2 +- src/electron/globalShortcut.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index f8e0be8250..a8be4d58f5 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -29,7 +29,7 @@ jobs: id: sync uses: aormsby/Fork-Sync-With-Upstream-action@v3.4 with: - upstream_sync_repo: qier222/YesPlayMusic + upstream_sync_repo: chenjingxiong/YesPlayMusic upstream_sync_branch: master target_sync_branch: master target_repo_token: ${{ secrets.GITHUB_TOKEN }} # automatically generated, no need to set diff --git a/src/electron/globalShortcut.js b/src/electron/globalShortcut.js index c352eaf71d..75f3a2ab9d 100644 --- a/src/electron/globalShortcut.js +++ b/src/electron/globalShortcut.js @@ -55,4 +55,35 @@ 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'); + } + ); + + //音量增大和减少采用 多媒体键盘全局设置即可。无需单独注册。 + + + } From 5a5ce411fcaa37f149f0ab0f76cadbcb15a6b7cf Mon Sep 17 00:00:00 2001 From: chenjingxiong Date: Fri, 19 Jul 2024 22:49:27 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=9A=E5=AA=92?= =?UTF-8?q?=E4=BD=93=E5=BF=AB=E6=8D=B7=E6=8C=89=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/electron/globalShortcut.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/electron/globalShortcut.js b/src/electron/globalShortcut.js index 75f3a2ab9d..0feee5bc3e 100644 --- a/src/electron/globalShortcut.js +++ b/src/electron/globalShortcut.js @@ -84,6 +84,4 @@ export function registerGlobalShortcut(win, store) { //音量增大和减少采用 多媒体键盘全局设置即可。无需单独注册。 - - } From 653373584cf6b7b1e4aa2ae3d4a5af43c49afac1 Mon Sep 17 00:00:00 2001 From: chenjingxiong Date: Fri, 19 Jul 2024 23:12:16 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0iOS=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E7=9A=84=E8=AF=B4=E6=98=8E=EF=BC=8C=E6=9C=AC?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=9C=A8macOS=2010.14=20Mojave=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E6=8E=88=E6=9D=83=E4=B8=BA=E5=8F=AF=E4=BF=A1=E4=BB=BB?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/electron/globalShortcut.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/electron/globalShortcut.js b/src/electron/globalShortcut.js index 0feee5bc3e..5331dbf4c9 100644 --- a/src/electron/globalShortcut.js +++ b/src/electron/globalShortcut.js @@ -83,5 +83,12 @@ export function registerGlobalShortcut(win, store) { ); //音量增大和减少采用 多媒体键盘全局设置即可。无需单独注册。 - + /** + 注意: + 在 macOS 10.14 Mojave 下面,如果 app 没有被授权为可信任使用的客户端,那么下列快捷键会注册失败: + "Media Play/Pause" + "Media Next Track" + "Media Previous Track" + "Media Stop" + */ } From 7258eaba5d37d7dcc9a0e3072452a4f23d6360cf Mon Sep 17 00:00:00 2001 From: pan93412 Date: Wed, 7 Aug 2024 22:35:50 +0800 Subject: [PATCH 4/4] style: Match code style --- src/electron/globalShortcut.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/electron/globalShortcut.js b/src/electron/globalShortcut.js index 5331dbf4c9..05f5038cab 100644 --- a/src/electron/globalShortcut.js +++ b/src/electron/globalShortcut.js @@ -56,12 +56,12 @@ export function registerGlobalShortcut(win, store) { } ); -/* -增加 多媒体键盘 特殊按键 : -多媒体键码值(keyCode) -音量大,音量小,静音,上一首,暂停/播放,下一首,停止 -175, 174, 173,177, 179, 176, 178 -*/ + /* + 增加 多媒体键盘 特殊按键 : + 多媒体键码值(keyCode) + 音量大,音量小,静音,上一首,暂停/播放,下一首,停止 + 175, 174, 173,177, 179, 176, 178 + */ globalShortcut.register( 179, @@ -83,7 +83,7 @@ export function registerGlobalShortcut(win, store) { ); //音量增大和减少采用 多媒体键盘全局设置即可。无需单独注册。 - /** + /* 注意: 在 macOS 10.14 Mojave 下面,如果 app 没有被授权为可信任使用的客户端,那么下列快捷键会注册失败: "Media Play/Pause"