Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I have this script. I put it in ~/Desktop. I view the script on my desktop in a "Folder View" widget. When I click on the script, I get list of users, then I get an authorization dialog box ( for a password ), then I get a "konsole" which I would like to appear in the same virtual desktop.

Unfortunately it appears in a random virtual desktop. Because I do not know how much of the "protocol" of VDs is X and how much is KDE's, I do not know where the problem lays. What causes this behavior? How can I fix this behavior, so it appears in the active VD?

I tried asking this question on the freenode IRC channel #linux where a person nicked Psi_Jack gaver me a lot of grief over the script, ,ostly because I called ruby from bash. Here are the facts, I wanted to only access "real" users eg "mom","pop","sis","mouse" and not "saned","mysqld","fethmail" etc. So I had to test user ids. While not very hard in bash it is messier then I like. In those cases I use ruby, because -- well part of ruby's raison d'etre is to cleanup some of the mess of perl, and part of perls raison d'etre is to clean up the mess of the various scripting shells.

The thing is I know the ruby is correct, and AFAICS there is no real problem with the script except in the line "/usr/lib/kde4/libexec/kdesu -u $KA_USER konsole". So please lay off the script.

#!/usr/bin/env sh

#  kstart --desktop [#] [command]
# Assign to dlg the specified user.
dlg=$(ruby <<EOF

command = "zenity  --list --column=User root""/etc/passwd").readlines.each{|l|
if ( fields[2].to_i > 1000 and fields[2].to_i<60000) then 
 command = command+" #{fields[0]}"
puts command

# Execute zenity dialog, assign choice to KA_USER
if [ -n "$KA_USER" ] 
    t=$(mktemp --suffix=log /tmp/sukon-XXXX)
    /usr/lib/kde4/libexec/kdesu -u $KA_USER konsole 
share|improve this question
why don't u start konsole using /usr/lib/kde4/libexec/kdesu -u "$KA_USER" kstart --currentdesktop konsole? (I'd put the KA_USER var into double quotes) –  mreithub Feb 11 '13 at 1:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.