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"
File.new("/etc/passwd").readlines.each{|l|
fields=l.split(":")
if ( fields[2].to_i > 1000 and fields[2].to_i<60000) then
command = command+" #{fields[0]}"
end
}
puts command
EOF
)
# Execute zenity dialog, assign choice to KA_USER
KA_USER=$($dlg)
if [ -n "$KA_USER" ]
then
t=$(mktemp --suffix=log /tmp/sukon-XXXX)
/usr/lib/kde4/libexec/kdesu -u $KA_USER konsole
fi
konsoleusing/usr/lib/kde4/libexec/kdesu -u "$KA_USER" kstart --currentdesktop konsole? (I'd put the KA_USER var into double quotes) – mreithub Feb 11 at 1:48