3

我正在尝试制作我的第一个 bash 脚本并尝试使用 kdialog 。

我如何使进度条具有一定的宽度这是我的尝试

dbusRef=`kdialog --title "Sweet As Buckup Demon" --progressbar "Initializing" 8`
qdbus $dbusRef Set "" value 1
qdbus $dbusRef setLabelText "Getting web site folder and creating mysqldump and grabbing configuration files from the apache Server"
cp -rf /usr/local/websites/sweetassurfwear /home/brett/sweetback/
sleep 4
qdbus $dbusRef Set "" value 2
cd /home/brett/sweetback/

等等..如果您需要整个脚本,我会发布它

基本上在过程的每个部分,它都会在进度条上显示文本,但对话框的宽度会不断变化。

我如何制定尺寸标准

4

3 回答 3

3

使用--geometry参数,例如

kdialog --geometry 300x300+300+300 --title "Sweet As Buckup Demon" --progressbar "Initializing"

您可以通过键入以下内容查看此选项的文档:

kdialog --help-all|grep geometry
于 2013-11-16T08:16:24.460 回答
1

我试图使用该--geometry选项来扩大输入框对话框,但它不起作用。最终我发现在输入框标签的末尾添加空格会强制对话框变宽,例如,如果您使用

kdialog --title "Input dialog" --inputbox "Input"

你可能会得到这样的东西:

narrow input box dialog

但是如果在输入框标签的 处添加额外的空格:

# The expression $(printf "%0.s " {1..70}) adds 70 space characters to the label
kdialog --title "Input dialog" --inputbox "Input $(printf "%0.s " {1..70})"

你会得到这样的东西:

enter image description here

于 2019-07-11T14:21:56.020 回答
0

Unfortunately kdialog --geometry doesn't work. For a working example of how to fix up the geometry for a kdialog, see https://github.com/rparkins999/kde-slow-start-wrapper.

Note this example sets the position: the width or height can be set by replacing the first or second -1 in the

wmctrl -r $mytitle -e

command.

于 2020-08-21T16:12:54.790 回答