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:
@@ -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]">
|
||||
|
||||
Reference in New Issue
Block a user