0

I am starting Qt-Linguist in a bash script via

sudo linguist-qt4 $PathToParentDir/translate_$lang.ts

I could also use gksu instead of sudo but this would add more dependencies since most people don't have gksu installed. On the left picture you see how ugly it looks, it should look like on the right hand side when started normally. How can I start a program in a bash-script so that it looks like in the right picture?

Left: ugly; Right: correct version

1 Answers1

0

The program interface looks ugly because you start the program with sudo, but sudo is used to execute a command in text mode.

So, you need a command to start the program in graphical mode as root. This can be gksudo. See What is the difference between "gksudo nautilus" and "sudo nautilus"?. But (gksu) is no longer installed by default starting with Ubuntu 13.04. Its alternative is pkexec. So, you can use the following if:

if [ -x /usr/bin/gksu]; then     #if `gksu` exists and is executable
    gksu linguist-qt4 $PathToParentDir/translate_$lang.ts
else
    pkexec linguist-qt4 $PathToParentDir/translate_$lang.ts
fi

Or, you can try simple:

sudo -i linguist-qt4 $PathToParentDir/translate_$lang.ts

So, sudo -i command. But I'm not sure about it - check yourself.

Radu Rădeanu
  • 174,089
  • 51
  • 332
  • 407