xfce / bash:shell 腳本中的 gui 元素

xfce / bash:shell 腳本中的 gui 元素

我有一個最小安裝,xfce 作為預設視窗管理器。是否可以用簡單的 gui 元素編寫 shell 腳本?或者我是否要安裝其他東西(我不願意這樣做,我想將安裝的軟體包數量(大小)保持在最低限度)。

答案1

嘗試禪宗:

" Zenity allows you to display GTK+ dialogs from shell scripts".

它非常簡單,以下是依賴項,其中許多應該已經存在於 xfce 系統上:

Depends: libc6 (>= 2.4), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.24.0), libgtk-3-0 (>= 3.0.0), libnotify4 (>= 0.7.0), libpango1.0-0 (>= 1.14.0), libwebkitgtk-3.0-0 (>= 1.3.10), libx11-6, zenity-common (= 3.2.0-0ubuntu1)

答案2

另一個選擇是yad

 YAD  is a program that will display GTK+ dialogs, and return (either in
       the return code or on standard output) the users input. This allows you
       to present information, and ask for information from the user, from all
       manner of shell scripts.

       YAD is the fork of Zenity program.

YAD(Yet Another Dialog)是 Zenity 的一個分支,具有許多改進,例如自訂按鈕、附加對話方塊、通知圖示中的彈出式功能表等等。基本上,您在 Zenity 中想要做的大部分事情都可以在 YAD 中實現:您可以擁有任意數量的按鈕,每個按鈕都有您想要的文本,還有一個非常漂亮的圖標對話框。

YAD 沒有所有相同的對話框,例如--error、--info、--question 或--warning - 相反,它有一個--form 對話框,您可以在其中添加所需的任何訊息、按鈕和圖標。它還包括 --notification 對話框,以便在通知區域中顯示圖示。有關使用 YAD 的協助,請參閱 [Wiki] 中的範例部分(https://code.google.com/archive/p/yad/wikis/Examples.wiki

yad可以在所有目前支援的 Ubuntu 版本的儲存庫中找到,儘管像許多這些有用的軟體包一樣,您必須啟用Universe儲存庫如果在嘗試安裝之前尚未啟用。

資料來源:

man yad

http://www.webupd8.org/2010/12/yad-zenity-on-steroids-display.html

https://code.google.com/archive/p/yad/wikis/Examples.wiki

https://www.mankier.com/1/yad

相關內容