mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-01 00:07:46 +02:00
feat: add setting for static window title (#2183)
This commit is contained in:
@@ -1175,6 +1175,8 @@
|
||||
"webAudio": "Use web audio",
|
||||
"windowBarStyle_description": "Select the style of the window bar",
|
||||
"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": "Zoom percentage",
|
||||
"queryBuilder": "Query builder",
|
||||
|
||||
@@ -63,6 +63,30 @@ export const WindowSettings = memo(() => {
|
||||
isHidden: !isElectron(),
|
||||
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: (
|
||||
<Switch
|
||||
|
||||
@@ -14,7 +14,13 @@ import macMin from './assets/min-mac.png';
|
||||
import styles from './window-bar.module.css';
|
||||
|
||||
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 { Platform, PlayerStatus } from '/@/shared/types/types';
|
||||
|
||||
@@ -130,6 +136,8 @@ const MacOsControls = ({ controls, title }: WindowBarControlsProps) => {
|
||||
export const WindowBar = () => {
|
||||
const { t } = useTranslation();
|
||||
const { windowBarStyle } = useWindowSettings();
|
||||
const windowBarTrackinfo = useWindowBarTrackinfo();
|
||||
|
||||
const playerStatus = usePlayerStatus();
|
||||
const privateMode = useAppStore((state) => state.privateMode);
|
||||
const handleMinimize = () => minimize();
|
||||
@@ -153,6 +161,10 @@ export const WindowBar = () => {
|
||||
const title = useMemo(() => {
|
||||
const privateModeString = privateMode ? t('page.windowBar.privateMode') : '';
|
||||
|
||||
if (!windowBarTrackinfo) {
|
||||
return `Feishin${privateMode ? ` ${privateModeString}` : ''}`;
|
||||
}
|
||||
|
||||
// Show radio information if radio is active
|
||||
if (isRadioActive) {
|
||||
const radioStatusString = !isRadioPlaying ? t('page.windowBar.paused') : '';
|
||||
@@ -194,6 +206,7 @@ export const WindowBar = () => {
|
||||
queueLength,
|
||||
stationName,
|
||||
t,
|
||||
windowBarTrackinfo,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -678,6 +678,7 @@ const WindowSettingsSchema = z.object({
|
||||
startMinimized: z.boolean(),
|
||||
tray: z.boolean(),
|
||||
windowBarStyle: z.nativeEnum(Platform),
|
||||
windowBarTrackinfo: z.boolean(),
|
||||
});
|
||||
|
||||
const QueryValueInputTypeSchema = z.enum([
|
||||
@@ -2014,6 +2015,7 @@ const initialState: SettingsState = {
|
||||
startMinimized: false,
|
||||
tray: true,
|
||||
windowBarStyle: platformDefaultWindowBarStyle,
|
||||
windowBarTrackinfo: true,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -2560,6 +2562,9 @@ export const useWindowSettings = () => useSettingsStore((state) => state.window,
|
||||
export const useWindowBarStyle = () =>
|
||||
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 useHotkeyBindings = () => useSettingsStore((state) => state.hotkeys.bindings, shallow);
|
||||
|
||||
Reference in New Issue
Block a user