Window title working again

This commit is contained in:
Gregory Schier
2024-05-30 00:11:55 -07:00
parent b942c22b20
commit e4022cf532
8 changed files with 378 additions and 81 deletions

View File

@@ -32,7 +32,7 @@ export const SettingsDialog = ({ fullscreen }: Props) => {
{fullscreen && (
<div
data-tauri-drag-region
className="h-[38px] bg-background-highlight-secondary flex items-center justify-center border-b border-background-highlight"
className="h-[27px] bg-background-highlight-secondary flex items-center justify-center border-b border-background-highlight"
>
Settings
</div>

View File

@@ -14,7 +14,6 @@ import { Icon } from './core/Icon';
import { IconButton } from './core/IconButton';
import { useDialog } from './DialogContext';
import { KeyboardShortcutsDialog } from './KeyboardShortcutsDialog';
import { SettingsDialog } from './Settings/SettingsDialog';
export function SettingsDropdown() {
const importData = useImportData();
@@ -26,13 +25,12 @@ export function SettingsDropdown() {
const routes = useAppRoutes();
const workspaceId = useActiveWorkspaceId();
const showSettings = () => {
dialog.show({
id: 'settings',
size: 'dynamic',
noScroll: true,
noPadding: true,
render: () => <SettingsDialog />,
const showSettings = async () => {
if (!workspaceId) return;
await invoke('cmd_new_nested_window', {
url: routes.paths.workspaceSettings({ workspaceId }),
label: 'settings',
title: 'Yaak Settings',
});
};
@@ -63,20 +61,6 @@ export function SettingsDropdown() {
});
},
},
{
key: 'foo',
label: 'Foo',
hotKeyAction: 'hotkeys.showHelp',
leftSlot: <Icon icon="keyboard" />,
onSelect: async () => {
if (!workspaceId) return;
await invoke('cmd_new_nested_window', {
url: routes.paths.workspaceSettings({ workspaceId }),
label: 'settings',
title: 'Yaak Settings',
});
},
},
{
key: 'import-data',
label: 'Import Data',

View File

@@ -40,7 +40,7 @@ export const WorkspaceHeader = memo(function WorkspaceHeader({ className }: Prop
<div className="pointer-events-none">
<RecentRequestsDropdown />
</div>
<div className="flex-1 flex gap-1 items-center h-full justify-end pointer-events-none">
<div className="flex-1 flex gap-1 items-center h-full justify-end pointer-events-none pr-0.5">
<ImportCurlButton />
<SettingsDropdown />
{(osInfo?.osType === 'linux' || osInfo?.osType === 'windows') && (

View File

@@ -5,6 +5,7 @@ import { useActiveEnvironment } from './useActiveEnvironment';
import { useActiveRequest } from './useActiveRequest';
import { useActiveWorkspace } from './useActiveWorkspace';
import { useOsInfo } from './useOsInfo';
import { emit } from '@tauri-apps/api/event';
export function useSyncWindowTitle() {
const activeRequest = useActiveRequest();
@@ -26,13 +27,12 @@ export function useSyncWindowTitle() {
newTitle += ` ${fallbackRequestName(activeRequest)}`;
}
// TODO: This resets the stoplight position so we can't use it on macOS yet. Perhaps
// we can
// TODO: This resets the stoplight position so we can't use it on macOS yet. So we send
// a custom command instead
if (osInfo?.osType !== 'macos') {
console.log('DO IT', osInfo?.osType);
getCurrent().setTitle(newTitle).catch(console.error);
} else {
// emit('yaak_title_changed', newTitle).catch(console.error);
emit('yaak_title_changed', newTitle).catch(console.error);
}
}, [activeEnvironment, activeRequest, activeWorkspace, osInfo?.osType]);
}