Cmd click open finder (#3807)

Co-authored-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Michael Neale <michael.neale@gmail.com>
This commit is contained in:
Douwe Osinga
2025-08-06 10:46:27 +02:00
committed by GitHub
parent c5fd3b708a
commit 46e883db6e
3 changed files with 26 additions and 1 deletions
@@ -13,13 +13,26 @@ export const DirSwitcher: React.FC<DirSwitcherProps> = ({ className = '' }) => {
window.electron.directoryChooser(true);
};
const handleDirectoryClick = async (event: React.MouseEvent) => {
const isCmdOrCtrlClick = event.metaKey || event.ctrlKey;
if (isCmdOrCtrlClick) {
event.preventDefault();
event.stopPropagation();
const workingDir = window.appConfig.get('GOOSE_WORKING_DIR') as string;
await window.electron.openDirectoryInExplorer(workingDir);
} else {
await handleDirectoryChange();
}
};
return (
<TooltipProvider>
<Tooltip open={isTooltipOpen} onOpenChange={setIsTooltipOpen}>
<TooltipTrigger asChild>
<button
className={`z-[100] hover:cursor-pointer text-text-default/70 hover:text-text-default text-xs flex items-center transition-colors pl-1 [&>svg]:size-4 ${className}`}
onClick={handleDirectoryChange}
onClick={handleDirectoryClick}
>
<FolderDot className="mr-1" size={16} />
<div className="max-w-[200px] truncate [direction:rtl]">