Try   HackMD

美化 Windows Terminal

STEP1. 安裝PowerShell

  1. 打開Microsoft Store

  2. 搜尋"PowerShell"

  3. 找到PowerShell,點選"取得"

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

:warning: 注意
這個PowerShell不是Windows內建的"Windows PowerShell"

STEP2. 將PowerShell設為預設設定檔(選)

  1. 打開Windows Terminal

  2. 開啟設定

  3. 將"預設設定檔"欄位改成"PowerShell"
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →


  4. 點選"開啟JSON檔案",找到"profiles"欄位

  5. 將PowerShell移到最上面

  6. 將Windows PowerShell的"hidden"屬性改成"true",如圖
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →


  7. 重啟Windows Terminal

  8. 可以看到一打開就是PowerShell,並且點選工作欄上的小箭頭之後,PowerShell在第一個
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

STEP3. 安裝Oh My Posh

  1. 搜尋"oh my posh",進入官網

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  2. 點選"Get Started",右方欄位找到"Installation",這裡以Windows為例,所以點選"Windows"

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  3. 往下找到這行指令直接複製貼上到Windows Terminal裡

    ​​​​winget install JanDeDobbeleer.OhMyPosh -s winget
    
  4. 安裝好之後大概會像這樣,中途如果有停下來直接打"Y"同意就好

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  5. 重啟Windows Terminal

  6. 輸入oh-my-posh.exe測試安裝有沒有成功,如果出現警告可以重新開機再輸入看看,通常會跑出一堆東西,如圖:

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

STEP4. 安裝建議的字體

:information_source: 這步是必要的,否則Windows Terminal可能會無法正常顯示

  1. 搜尋"nerd font"或是點選這裡

  2. 點選"Downloads"進入下載介面
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →


  3. 找到喜歡的字體並下載,會得到一個壓縮檔

  4. 打開Windows的設定,搜尋"字型設定"

  5. 將解壓縮後的檔案全選並拖拉至字型設定中安裝
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →


  6. 打開Windows Terminal設定介面

  7. 點選"預設值"
    "外觀"
    "字體",將字體更改為剛剛安裝好的字體
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

STEP5. 更改PROFILE檔案

  1. 官網右方欄位找到"Prompt",接下來照著官方教學,輸入code $PROFILE,這樣就會以vscode開啟這個檔案,如果沒有檔案就新建一個。沒有安裝vscode的話也可以先輸入echo $PROFILE之後到指定的路徑新增設定檔

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →


    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  2. 官網右方欄位找到"Customize",複製以下指令到設定檔並存檔,接著輸入. $PROFILE重新載入設定檔

    ​​​​oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/jandedobbeleer.omp.json" | Invoke-Expression
    
  3. 如果成功的話重啟後會看到這樣的畫面:

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

STEP6. 更換喜歡的主題

  1. 官網右方欄位找到"Themes",開始物色喜歡的主題
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →


  2. 將反白的這個部分換成想要的主題的名字
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →


  3. 輸入. $PROFILE重新載入設定檔之後,可以發現變成自己設定的主題了
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

STEP7. 更換Windows Terminal的背景 設定透明度...

  1. 這部份很簡單,甚至不用操作JSON檔,所以就不詳細寫了,只要在Windows Terminal設定介面依照自己的喜好進行設定就可以了
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

ℹ️延伸閱讀: 提升 PowerShell 的使用體驗