Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Graphical dialog/YAD bash script help
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Graphical dialog/YAD bash script help

twaintwain Member
edited April 2013 in General

Anyone good with yad?

So basically this BASH script works fine, Debian boots into a minimal Matchbox WM environment and this script is autorun which displays a nice graphical prompt allowing entry of AD username and pass, and then the vars get passed to pyhoca-cli which logs the computer into a remote x2go-server linux terminal server.. it works without issue.

However what I want to do is add an additional drop-down selection to the YAD graphical prompt (after the first two fields), where the user can select the session (eg kde, xfce4, lxde & fluxbox), and then pass that selection to the pyhoca-cli command to replace startkde with something like start$frmdata (from the dropdown selection)...

Not sure exactly how to do this...

root@lxtrms-thinclient-colodesk:~# cat /home/colodesk/ #!/bin/bash while true; do frmdata=$(yad --center --undecorated --image=/usr/share/wallpaper/header-mod.jpg --image-on-top --button="gtk-ok:0" --title "Login to Linux Terminal Server" --form --field="AD username" --field="Password:H") frmusername=$(echo $frmdata | awk 'BEGIN {FS="|" } { print $1 }') frmpassword=$(echo $frmdata | awk 'BEGIN {FS="|" } { print $2 }') pyhoca-cli --server some.private.ip.addr -u $frmusername --password $frmpassword -c startkde --sound none --kbd-layout us --kbd-type pc105/us -g fullscreen --add-to-known-hosts done


  • Pastebin it, formatting is broken.

  • twaintwain Member

    OK I made some progress here. Now my only problem is that it's not passing the variables to user,pass,session/cmd (seems to be passing null values, I added the 3 echo lines, just to confirm). Any ideas on why that is not happening?

    Can never get the code entry right on LET, so no code block, sorry:


    while true; do

    data=$(yad --center --undecorated --image=/usr/share/wallpaper/header-mod.jpg --image-on-top --button="gtk-ok:0" --title "Login to Linux Terminal Server" --form --field="AD username" --field="Password:H" --field="Session:CB" "" "" "kde!gnome!cinnamon!xfce!lxde!fluxbox") eval $(echo $data | awk 'BEGIN {FS="|" } { printf "user=%s\npass=%s\nsession=%s", $1, $2, $3 }')

    case $session in
    kde) cmd="startkde" ;;
    gnome) cmd="gnome-session" ;;
    cinnamon) cmd="gnome-session-cinnamon2d" ;;
    xfce) cmd="startxfce4" ;;
    lxde) cmd="startlxde" ;;
    fluxbox) cmd="startfluxbox" ;;

    echo $user
    echo $pass
    echo $cmd

    pyhoca-cli --server a.b.c.d -u $user --password $pass -c $cmd --sound none --kbd-layout us --kbd-type pc105/us -g fullscreen --add-to-known-hosts


Sign In or Register to comment.