#!/bin/bash## The Enter key doesn't work with any of these dialog boxesmessage="$(for i in {1..20}; do echo "line $i"; done)"echo -e "${message}" | yad --center --on-top --tail --no-markup --height=300 --text-info --title "Enter Test with pipe"yad --center --on-top --tail --no-markup --height=300 --text-info --title "Enter Test with here" <<< "${message}"yad --form --scroll --field="$(for i in {1..20}; do echo "line $i"; done):lbl" --height=300 --title "Enter Test with subshell"
#!/bin/bash
message="$(for i in {1..20}; do echo "line $i"; done)"
echo -e "${message}" | yad --class="YAD_APP" --text="OK=Enter (Return or Enter on the numpad)\nCancel=End" --center --on-top --tail --no-markup --height=300 --text-info --title "Enter Test with pipe" &
pid=$! # get the process id
until xdotool search --class "YAD_APP" &>/dev/null; do # sleep until the window opens
sleep 0.1
done
xinput test-xi2 --root | perl -lne '
BEGIN{$"=",";
open X, "-|", "xmodmap -pke";
while (<X>) {$k{$1}=$2 if /^keycode\s+(\d+) = (\w+)/}
open X, "-|", "xmodmap -pm"; <X>;<X>;
while (<X>) {if (/^(\w+)\s+(\w*)/){($k=$2)=~s/_[LR]$//;$m[$i++]=$k||$1}}
close X;
}
if (/detail: (\d+)/) {$d=$1;
if ($k{$d} eq "Return" && (`xdotool getwindowfocus 2> /dev/null` eq `xdotool search --class YAD_APP | tail -1 2> /dev/null`) ){
system ("xdotool windowactivate --sync `xdotool search --class YAD_APP | tail -1` key --clearmodifiers ctrl+Return > /dev/null 2>&1");
}
elsif ($k{$d} eq "KP_Enter" && (`xdotool getwindowfocus 2> /dev/null` eq `xdotool search --class YAD_APP | tail -1 2> /dev/null`) ){
system ("xdotool windowactivate --sync `xdotool search --class YAD_APP | tail -1` key --clearmodifiers ctrl+Return > /dev/null 2>&1");
}
elsif ($k{$d} eq "End" && (`xdotool getwindowfocus 2> /dev/null` eq `xdotool search --class YAD_APP | tail -1 2> /dev/null`) ){
system ("xdotool windowactivate --sync `xdotool search --class YAD_APP | tail -1` key --clearmodifiers alt+F4 > /dev/null 2>&1");
}
}' & xinpid=$!
wait $pid # Wait for the window close, wait also returns the status
echo $? # return status
# Kills the monitor
kill $xinpid
...
yad --class="YAD_APP" --text="OK=Enter (Return or Enter on the numpad)\nCancel=End" --width=500 --height=500 --text-align=fill --no-buttons &
pid=$! # get the process id
...
--
You received this message because you are subscribed to a topic in the Google Groups "yad-common" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/yad-common/b2UKOJVLerU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to yad-common+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.