4

Im trying to make my first bash script and im trying to use kdialog .

How do i make the progress bar a certain width here is my attempt

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/

And so on.. if you need the entire script i will post it

Basically at each part of the process it out puts text on the progress bar but the dialog keeps changing width.

How do i make the size standard

4 Answers 4

3

Use the --geometry argument, e.g.

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

You can see the documentation for this option by typing:

kdialog --help-all|grep geometry
1
  • 2
    --geometry option works for a limited set of dialogs only. --textbox and --textinputbox are among of them. In case of --progressbar it is silently ignored.
    – whtyger
    Apr 22, 2022 at 12:27
2

I was trying to use the --geometry option to widen an input box dialog and it wouldn't work. Eventually I found out that adding spaces to the end of the input box label forces the dialog to be wider, e.g. if you use

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

You may get something like this:

narrow input box dialog

But if you add extra spaces at the of the input box label:

# 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})"

You'll get something like this:

enter image description here

1

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.

0

I discovered a quirk in kdialog.

Try to start kdialog with the option

--progressbar "$(echo -e "\t\t\tYour window title here\t\t\t")"

Change the number of tabs (\t) in the window title to adjust the window width.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.