
我最近開始使用 Tilix。我缺少的主要功能是檢查當前目錄。更確切地說:
- 我有一個會話開放於
~/projects/a/b/c
- 從該會話開始,我將開始一個新的會話(例如,按
Ctrl+Shift+T
) - 我希望新會話會自動 cd 到目前目錄 (
~/projects/a/b/c
)。相反,每個新會話都以主目錄 (~
) 開始。
有辦法改變嗎?
答案1
這是 VTE(虛擬終端模擬器)、Tilix 和其他終端模擬器使用的 GTK+3 小部件的問題。 VTE需要/etc/profile.d/vte.sh
執行該腳本來進行一些配置。在某些發行版(例如 Ubuntu)中,預設不會在非登入 shell 會話中執行此腳本。
你有兩個選擇。 1) 在 Tilix 設定檔設定中啟用登入會話或 2) 更新.bashrc
以直接執行vte.sh
。
對於 2) 選項,您應該在.bashrc
.
if [ $TILIX_ID ] || [ $VTE_VERSION ]; then
source /etc/profile.d/vte.sh
fi
也許您需要建立一個符號連結。
ln -s /etc/profile.d/vte-2.91.sh /etc/profile.d/vte.sh
更多資訊在有關 VTE 配置的 Tilix 文檔。
答案2
您必須手動編輯描述會話的 json 檔案。
開啟儲存會話的 JSON 檔案並檢查該目錄是否已正確填入。
在裡面 ” child
” (UI 中的面板) 參數,描述您希望在何處輸入資料夾,只需填寫您啟動新會話時希望看到的目錄的絕對路徑即可。
在文件中,這部分對於執行您想要的操作很重要:
directory": "/home/shosta/Developpement/go/src/github.com/...",
- 成立了嗎?
它看起來就像我的 JSON 檔案中的那樣,並且它的工作方式就像一個魅力:
{
"child": {
"child1": {
IT'S HERE =>"directory": "/home/shosta/Developpement/go/src/github.com/...",
"height": 997,
"profile": "2b7c4080-0ddd-46c5-8f23-563fd3ba789d",
"readOnly": false,
"synchronizedInput": true,
"type": "Terminal",
"uuid": "ddf598aa-1a07-4157-9c1a-a2c1f16a8bac",
"width": 960
},
"child2": {
OR HERE =>"child1": {
"directory": "",
"height": 498,
"profile": "2b7c4080-0ddd-46c5-8f23-563fd3ba789d",
"readOnly": false,
"synchronizedInput": true,
"type": "Terminal",
"uuid": "7c53d235-4717-4166-a142-8d0cb90be723",
"width": 951
},
"child2": {
OR HERE =>"directory": "",
"height": 490,
"profile": "2b7c4080-0ddd-46c5-8f23-563fd3ba789d",
"readOnly": false,
"synchronizedInput": true,
"type": "Terminal",
"uuid": "e3d41dd7-d4e6-4343-b98f-6d9e31396d71",
"width": 951
},
"orientation": 1,
"position": 49,
"ratio": 0.49949849548645936,
"type": "Paned"
},
"orientation": 0,
"position": 50,
"ratio": 0.5,
"type": "Paned"
},
"height": 997,
"name": "${title}",
"synchronizedInput": false,
"type": "Session",
"uuid": "d8377bfe-b1f6-4cd5-8a83-af6de2db1a7d",
"version": "1.0",
"width": 1920
}
順便說一下,我沒有使用session而是使用autojump。
https://github.com/wting/autojump
從一個資料夾移動到另一個資料夾要快得多。它會從您正在使用的資料夾中學習,並且比任何有經驗的資料夾都要快。
如果您想快速移動開啟的 Tilix 會話,您應該嘗試一下這個 ULauncher :
https://ext.ulauncher.io/-/github-brpaz-ulauncher-tilix
我希望這有幫助。