給 macOS Finder 工具列加一顆「回上一層目錄」按鈕。
Finder 內建其實有 ⌘↑ 快速鍵可以回上一層,但沒有對應的工具列按鈕。 OneUp 就是那顆按鈕:一個迷你 AppleScript app,點一下就把最前面的 Finder 視窗導航到上一層資料夾。
git clone https://github.com/GarfieldHuang/OneUp.git
cd OneUp
./build.sh
cp -R OneUp.app /Applications/然後:
- 開啟 Finder,前往「應用程式」資料夾
- 按住 ⌘,把
OneUp.app拖到 Finder 視窗上方的工具列,出現綠色 ➕ 時放開 - 點按鈕即可回上一層。第一次點擊時 macOS 會詢問「OneUp 想要控制 Finder」,按允許
核心只有幾行 AppleScript(oneup.applescript):
tell application "Finder"
set target of front Finder window to (container of currentTarget)
end tell已在最上層(例如磁碟根目錄)時按下不會報錯,靜默忽略。
把工具列上的按鈕 ⌘拖出即可移除;app 本體刪掉 /Applications/OneUp.app。