mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-03 14:20:50 +08:00
✨ feat: 添加mac状态栏播放按键控制功能开关
This commit is contained in:
@@ -66,7 +66,9 @@ export default {
|
||||
noMusicSources: 'No sources selected',
|
||||
gdmusicInfo: 'GD Music Station intelligently resolves music from multiple platforms automatically',
|
||||
autoPlay: 'Auto Play',
|
||||
autoPlayDesc: 'Auto resume playback when reopening the app'
|
||||
autoPlayDesc: 'Auto resume playback when reopening the app',
|
||||
showStatusBar: "Show Status Bar",
|
||||
showStatusBarContent: "You can display the music control function in your mac status bar (effective after a restart)"
|
||||
},
|
||||
application: {
|
||||
closeAction: 'Close Action',
|
||||
|
||||
@@ -66,7 +66,9 @@ export default {
|
||||
noMusicSources: '未选择音源',
|
||||
gdmusicInfo: 'GD音乐台可自动解析多个平台音源,自动选择最佳结果',
|
||||
autoPlay: '自动播放',
|
||||
autoPlayDesc: '重新打开应用时是否自动继续播放'
|
||||
autoPlayDesc: '重新打开应用时是否自动继续播放',
|
||||
showStatusBar: '是否显示状态栏控制功能',
|
||||
showStatusBarContent: '可以在您的mac状态栏显示音乐控制功能(重启后生效)',
|
||||
},
|
||||
application: {
|
||||
closeAction: '关闭行为',
|
||||
|
||||
@@ -24,6 +24,7 @@ type SetConfig = {
|
||||
fontFamily: string;
|
||||
fontScope: 'global' | 'lyric';
|
||||
language: string;
|
||||
showTopAction: boolean;
|
||||
};
|
||||
interface StoreType {
|
||||
set: SetConfig;
|
||||
|
||||
@@ -11,6 +11,7 @@ import { join } from 'path';
|
||||
|
||||
import type { Language } from '../../i18n/main';
|
||||
import i18n from '../../i18n/main';
|
||||
import { getStore } from './config';
|
||||
|
||||
// 歌曲信息接口定义
|
||||
interface SongInfo {
|
||||
@@ -327,7 +328,8 @@ export function updateTrayMenu(mainWindow: BrowserWindow) {
|
||||
|
||||
// 初始化状态栏Tray
|
||||
function initializeStatusBarTray(mainWindow: BrowserWindow) {
|
||||
if (process.platform !== 'darwin') return;
|
||||
const store = getStore()
|
||||
if (process.platform !== 'darwin' || !store.get('set.showTopAction')) return;
|
||||
|
||||
const iconSize = getProperIconSize();
|
||||
|
||||
|
||||
@@ -23,5 +23,6 @@
|
||||
"alwaysShowDownloadButton": false,
|
||||
"unlimitedDownload": false,
|
||||
"enableMusicUnblock": true,
|
||||
"enabledMusicSources": ["migu", "kugou", "pyncmd", "bilibili", "kuwo"]
|
||||
"enabledMusicSources": ["migu", "kugou", "pyncmd", "bilibili", "kuwo"],
|
||||
"showTopAction": false
|
||||
}
|
||||
|
||||
@@ -183,6 +183,17 @@
|
||||
</n-button>
|
||||
</div>
|
||||
|
||||
<div class="set-item" v-if="platform === 'darwin'">
|
||||
<div>
|
||||
<div class="set-item-title">{{ t('settings.playback.showStatusBar') }}</div>
|
||||
<div class="set-item-content">{{ t('settings.playback.showStatusBarContent') }}</div>
|
||||
</div>
|
||||
<n-switch v-model:value="setData.showTopAction">
|
||||
<template #checked>{{ t('common.on') }}</template>
|
||||
<template #unchecked>{{ t('common.off') }}</template>
|
||||
</n-switch>
|
||||
</div>
|
||||
|
||||
<div class="set-item">
|
||||
<div>
|
||||
<div class="set-item-title">{{ t('settings.playback.autoPlay') }}</div>
|
||||
@@ -488,6 +499,8 @@ import config from '../../../../package.json';
|
||||
// 所有平台默认值
|
||||
const ALL_PLATFORMS: Platform[] = ['migu', 'kugou', 'pyncmd', 'bilibili', 'kuwo'];
|
||||
|
||||
const platform = window.electron.ipcRenderer.sendSync('get-platform');
|
||||
|
||||
const settingsStore = useSettingsStore();
|
||||
const userStore = useUserStore();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user