mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-05 18:19:56 +02:00
feat: add setting for static window title (#2183)
This commit is contained in:
@@ -1175,6 +1175,8 @@
|
|||||||
"webAudio": "Use web audio",
|
"webAudio": "Use web audio",
|
||||||
"windowBarStyle_description": "Select the style of the window bar",
|
"windowBarStyle_description": "Select the style of the window bar",
|
||||||
"windowBarStyle": "Window bar style",
|
"windowBarStyle": "Window bar style",
|
||||||
|
"windowBarTrackinfo": "Track info in Window Title",
|
||||||
|
"windowBarTrackinfo_description": "Show current track's title and artist, queue position, and Playing/Paused state in the Window's Title.",
|
||||||
"zoom_description": "Sets the zoom percentage for the application",
|
"zoom_description": "Sets the zoom percentage for the application",
|
||||||
"zoom": "Zoom percentage",
|
"zoom": "Zoom percentage",
|
||||||
"queryBuilder": "Query builder",
|
"queryBuilder": "Query builder",
|
||||||
|
|||||||
@@ -63,6 +63,30 @@ export const WindowSettings = memo(() => {
|
|||||||
isHidden: !isElectron(),
|
isHidden: !isElectron(),
|
||||||
title: t('setting.windowBarStyle'),
|
title: t('setting.windowBarStyle'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
control: (
|
||||||
|
<Switch
|
||||||
|
aria-label="Toggle track info in Window Bar"
|
||||||
|
defaultChecked={settings.windowBarTrackinfo}
|
||||||
|
onChange={(e) => {
|
||||||
|
if (!e) return;
|
||||||
|
setSettings({
|
||||||
|
window: {
|
||||||
|
windowBarTrackinfo: e.currentTarget.checked,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
description: t('setting.windowBarTrackinfo', {
|
||||||
|
context: 'description',
|
||||||
|
}),
|
||||||
|
// tab is hidden entirely right now
|
||||||
|
// but if it was shown we would want to show this option
|
||||||
|
// as it also controls the tab title in web
|
||||||
|
isHidden: false,
|
||||||
|
title: t('setting.windowBarTrackinfo'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
control: (
|
control: (
|
||||||
<Switch
|
<Switch
|
||||||
|
|||||||
@@ -14,7 +14,13 @@ import macMin from './assets/min-mac.png';
|
|||||||
import styles from './window-bar.module.css';
|
import styles from './window-bar.module.css';
|
||||||
|
|
||||||
import { useRadioPlayer } from '/@/renderer/features/radio/hooks/use-radio-player';
|
import { useRadioPlayer } from '/@/renderer/features/radio/hooks/use-radio-player';
|
||||||
import { useAppStore, usePlayerData, usePlayerStatus, useWindowSettings } from '/@/renderer/store';
|
import {
|
||||||
|
useAppStore,
|
||||||
|
usePlayerData,
|
||||||
|
usePlayerStatus,
|
||||||
|
useWindowBarTrackinfo,
|
||||||
|
useWindowSettings,
|
||||||
|
} from '/@/renderer/store';
|
||||||
import { Text } from '/@/shared/components/text/text';
|
import { Text } from '/@/shared/components/text/text';
|
||||||
import { Platform, PlayerStatus } from '/@/shared/types/types';
|
import { Platform, PlayerStatus } from '/@/shared/types/types';
|
||||||
|
|
||||||
@@ -130,6 +136,8 @@ const MacOsControls = ({ controls, title }: WindowBarControlsProps) => {
|
|||||||
export const WindowBar = () => {
|
export const WindowBar = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { windowBarStyle } = useWindowSettings();
|
const { windowBarStyle } = useWindowSettings();
|
||||||
|
const windowBarTrackinfo = useWindowBarTrackinfo();
|
||||||
|
|
||||||
const playerStatus = usePlayerStatus();
|
const playerStatus = usePlayerStatus();
|
||||||
const privateMode = useAppStore((state) => state.privateMode);
|
const privateMode = useAppStore((state) => state.privateMode);
|
||||||
const handleMinimize = () => minimize();
|
const handleMinimize = () => minimize();
|
||||||
@@ -153,6 +161,10 @@ export const WindowBar = () => {
|
|||||||
const title = useMemo(() => {
|
const title = useMemo(() => {
|
||||||
const privateModeString = privateMode ? t('page.windowBar.privateMode') : '';
|
const privateModeString = privateMode ? t('page.windowBar.privateMode') : '';
|
||||||
|
|
||||||
|
if (!windowBarTrackinfo) {
|
||||||
|
return `Feishin${privateMode ? ` ${privateModeString}` : ''}`;
|
||||||
|
}
|
||||||
|
|
||||||
// Show radio information if radio is active
|
// Show radio information if radio is active
|
||||||
if (isRadioActive) {
|
if (isRadioActive) {
|
||||||
const radioStatusString = !isRadioPlaying ? t('page.windowBar.paused') : '';
|
const radioStatusString = !isRadioPlaying ? t('page.windowBar.paused') : '';
|
||||||
@@ -194,6 +206,7 @@ export const WindowBar = () => {
|
|||||||
queueLength,
|
queueLength,
|
||||||
stationName,
|
stationName,
|
||||||
t,
|
t,
|
||||||
|
windowBarTrackinfo,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -678,6 +678,7 @@ const WindowSettingsSchema = z.object({
|
|||||||
startMinimized: z.boolean(),
|
startMinimized: z.boolean(),
|
||||||
tray: z.boolean(),
|
tray: z.boolean(),
|
||||||
windowBarStyle: z.nativeEnum(Platform),
|
windowBarStyle: z.nativeEnum(Platform),
|
||||||
|
windowBarTrackinfo: z.boolean(),
|
||||||
});
|
});
|
||||||
|
|
||||||
const QueryValueInputTypeSchema = z.enum([
|
const QueryValueInputTypeSchema = z.enum([
|
||||||
@@ -2014,6 +2015,7 @@ const initialState: SettingsState = {
|
|||||||
startMinimized: false,
|
startMinimized: false,
|
||||||
tray: true,
|
tray: true,
|
||||||
windowBarStyle: platformDefaultWindowBarStyle,
|
windowBarStyle: platformDefaultWindowBarStyle,
|
||||||
|
windowBarTrackinfo: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2560,6 +2562,9 @@ export const useWindowSettings = () => useSettingsStore((state) => state.window,
|
|||||||
export const useWindowBarStyle = () =>
|
export const useWindowBarStyle = () =>
|
||||||
useSettingsStore((state) => state.window.windowBarStyle, shallow);
|
useSettingsStore((state) => state.window.windowBarStyle, shallow);
|
||||||
|
|
||||||
|
export const useWindowBarTrackinfo = () =>
|
||||||
|
useSettingsStore((state) => state.window.windowBarTrackinfo, shallow);
|
||||||
|
|
||||||
export const useHotkeySettings = () => useSettingsStore((state) => state.hotkeys, shallow);
|
export const useHotkeySettings = () => useSettingsStore((state) => state.hotkeys, shallow);
|
||||||
|
|
||||||
export const useHotkeyBindings = () => useSettingsStore((state) => state.hotkeys.bindings, shallow);
|
export const useHotkeyBindings = () => useSettingsStore((state) => state.hotkeys.bindings, shallow);
|
||||||
|
|||||||
Reference in New Issue
Block a user