[英]How can I start Thunderbird and minimize the window on startup in Ubuntu
我試圖讓 Thunderbird 在啟動時打開並隱藏或最小化其 window。 我已經能夠使用其他一些應用程序完成此操作,但 Thunderbird 似乎沒有任何方便的選項來打開托盤或最小化。
我寫了一個 bash 腳本並將其包含在啟動 gui 中。 該腳本主要基於我在這里閱讀的內容: Bash wait for process start 。 這是我的腳本:
#! /bin/bash
thunderbird &
while pids=$(pidof thunderbird)
do
sleep 1s
done
sleep 3s
xdotool search --onlyvisible --class thunderbird windowminimize
我也嘗試過在thunderbird &
中不使用“&”,我嘗試不使用while
循環,而是等待很長時間的sleep
。 如果我在終端中(不是在啟動時)運行包含以下幾行的腳本,它就可以正常工作:
thunderbird &
sleep 3s
xdotool search --onlyvisible --class thunderbird windowminimize
我在循環中做錯了什么嗎? 還是啟動過程中有什么東西使它不起作用? 我還啟動了其他應用程序,但我認為這些不會干擾它。 我是 Linux 的新手。
我只是復制粘貼這個問題 ubuntu 的答案:
我通過以下方式實現了所需的行為:
1)安裝alltray
,它提供了一種在啟動時打開 Thunderbird 的簡單方法:
sudo apt update
sudo apt install alltray
2)添加到啟動應用程序:
這將在啟動時打開 Thunderbird,但不會最小化。
----- 不再支持更新Minimize on Start and Close
-----
3)然后在 Thunderbird 中安裝Minimize on Start and Close
(Tools->Add-ons->Get Add-ons)
這需要配置(工具->附加組件->擴展->首選項)如下:
----------------------------------------------
3)然后Keep in Taskbar
並重啟 Thunderbird。
這是在 Ubuntu 16.04 中工作的來自不同位置的先前建議的組合。
我想我會分享這個,為其他人提供一種簡單、更新的方法。
我在這里找到了答案。 我剛剛復制並粘貼了答案的第二個 python 腳本。
安裝 xdotool sudo apt install xdotool
創建一個文件,我喜歡它在 PATH 中,例如sudo nano /usr/local/bin/startup-thunderbird
和(Ctrl-Shift-V 粘貼到終端):
#!/bin/bash
thunderbird &
while true; do
sleep 1
w=$(xdotool search --onlyvisible --name "Mozilla Thunderbird")
if [ ! -z $w ]; then
echo "minimizing $w"
xdotool windowminimize $w
break
fi
done
保存然后使其可執行sudo chmod +x /usr/local/bin/startup-thunderbird
將startup-thunderbird
添加到啟動應用程序中的命令。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.