Code: Select all
yad --form --field="test1:FBTN" "yad --text='test1'" \
--field="test2:FBTN" "yad --text='test2'" \
--field="test3:FBTN" "yad --text='test3'"
Anyone?
Code: Select all
yad --form --field="test1:FBTN" "yad --text='test1'" \
--field="test2:FBTN" "yad --text='test2'" \
--field="test3:FBTN" "yad --text='test3'"
yad --text='test1' is the sample function of yad --form --field="test1:FBTN", it displays a yad window with the text "test1" for the buttons field that's all, it can be any function you likeslavvo67 wrote:Works in terminal but not as a script written via Geany and saved as an executable file. Anyone? Very strange to me...
More strange, it works now but this way:
yad --form --field="test1:FBTN" "yad --text='test1'" --field="test2:FBTN" "yad --text='test2'" --field="test3:FBTN" "yad --text='test3'"
Why does yad have to be typed over and over? I don't get it...
For some strange reason, when it's all one line; it works. When lines are separated with the \ and continued on the next line.... she doesn't work for me....
Code: Select all
#! /bin/bash
yad --form --field="test1:FBTN" "yad --text='test1'" \
--field="test2:FBTN" "yad --text='test2'" \
--field="test3:FBTN" "yad --text='test3'"
Which "ok box"? You should place the "next part" before the yad statement as a function:slavvo67 wrote:Is there any way to pass the drag and drop to the next part of the script without requiring the ok box to be clicked?
Code: Select all
function myfunction {
Xdialog --msgbox "You dropped\n$0" x
}
export -f myfunction
yad --width=200 --height=200 --dnd --command="bash -c 'myfunction'"
Code: Select all
#!/bin/bash
#switch.sh
PARAM="$@"
case $PARAM in
test)
if [[ -f "/home/user/Desktop/yad_iconbox/icon-on.desktop" ]]; then
sed -i 's/gtk\-yes/gtk\-no/g' /home/user/Desktop/yad_iconbox/icon-on.desktop
mv /home/user/Desktop/yad_iconbox/icons-on.desktop /home/user/Desktop/yad_iconbox/icon-off.desktop
#more commands here
else
sed -i 's/gtk\-no/gtk\-yes/g' /home/misko/Desktop/yad_iconbox/audacious-off.desktop
mv /home/user/Desktop/yad_iconbox/icon-off.desktop /home/user/Desktop/yad_iconbox/icon-on.desktop
#commands...
fi
;;
*) exit
;;
esac
Code: Select all
[Desktop Entry]
Version=1.0
Type=Application
Name=Icon
GenericName=Icon
Comment=Test
Icon=gtk-no
Categories=GTK;
Exec=/home/user/Desktop/yad_iconbox/switch.sh test
TryExec=/home/user/Desktop/yad_iconbox/switch.sh test
Terminal=false
Code: Select all
#!/bin/bash
yad --icons --single-click --monitor --height=300 \
--width=500 --read-dir="/home/user/Desktop/yad_iconbox"
Code: Select all
(echo -e "Name\nTooltip\ngtk-ok\necho \"\"\nFALSE"; sleep 1; echo "Reset the icons") | yad --icons --single-click --listen --monitor --height=300 --width=500
Really? First I needed to fix the switch.sh script:misko_2083 wrote:If I click on this icon, it will change.
I don't think that this is possible. AFAIK you can only add icons this way but not change existing ones:Is there a way to force the dialog to reset the icons with something being sent to the pipe?
Code: Select all
#!/bin/bash
export PIPE_03=/tmp/yadpipe03
mkfifo $PIPE_03
exec 3<> $PIPE_03
yad --icons --single-click --height=300 --width=500 --listen < $PIPE_03 &
echo -e "Name\nTooltip\ngtk-ok\nbeep\nFALSE" > $PIPE_03
sleep 1
echo -e "Yes\nTooltip\ngtk-yes\nbeep\nFALSE" > $PIPE_03
sleep 1
echo -e "No\nTooltip\ngtk-no\nbeep\nFALSE" > $PIPE_03
You are not supposed you get any result at all with this code. Lots of spaces where there shouldn't be any, starting with the shebang '#! / bin / bash', followed by spaces around = and lastly by the space after $ in '$ (birthday -f /home/hachims/Dokumente/b2.txt)'achim wrote:Since the result of more than one word, I get with the attached code, the result only with each displayed (word for word)
Code: Select all
#! /bin/bash
XTERM="xterm"
# create history file
mkdir -p ${XDG_CACHE_HOME:-$HOME/.cache}/
HISTFILE=${XDG_CACHE_HOME:-$HOME/.cache}/ix-run.history
touch $HISTFILE
# create and run dialog
TITLE="Befehl ausführen"
TEXT="\nBefehl eingeben und Enter drücken:\n"
rcmd=$(yad --width=500 --center --window-icon="gtk-execute" --name="${0##/}" --title="$TITLE" --text="$TEXT" --image="gtk-execute" --editable --entry --rest $HISTFILE)
echo "tooltip:Beispielmenü"
[-z "$rcmd" ] && exit 0
# run command
case $rcmd in
http://*|https://*|ftp://*)
xdg-open $rcmd &
;;
mailto://*)
xdg-email $rcmd &
;;
man://*)
eval $XTERM -e "man ${rcmd#man://}" &
;;
telnet*|ssh*)
eval $XTERM -e "$rcmd" &
;;
*)
eval $rcmd &
;;
esac
# add command to history
head $HISTFILE | grep -qF "$rcmd" || echo -e "$rcmd\n$(<$HISTFILE)" > $HISTFILE
exit 0
Code: Select all
Some time back I used this script also, I modified it to give a error message if the command didn't exist and the option to clear the history, this uses exo-open not xdg-open hope this is of help.achim wrote:Hello,
I use the following script under Ubuntu as an alternative to the command known under Windows "Run". It works so far, but there is no message if the string is not found. This situation should be caught with a "not found" message and restart the script. Does somebody has any idea?
Code: Select all
#! /bin/bash
HISTFILE=${XDG_CACHE_HOME:-$HOME/.cache}/ix-run.history
# delete history file
Clear_History(){
rm $HISTFILE
yad --fixed --title="History" --window-icon="applications-system" --text="\n History Cleared \n" --timeout="2" --no-buttons
`basename "$0"`
}
export -f Clear_History
XTERM="xterm"
# create history file
if [ ! -f $HISTFILE ]; then
mkdir -p ${XDG_CACHE_HOME:-$HOME/.cache}/
echo 'Clear_History' > $HISTFILE
fi
# create and run dialog
TITLE="Run command"
TEXT="\nEnter command to execute:\n"
CMD='yad --fixed --width=400 --center --window-icon="applications-system" --buttons-layout=center --title="$TITLE" --text="$TEXT" --button="gtk-ok:0" --image="applications-system" --entry --editable'
ARGS=$(perl -pe 's/(^.*$)/"\1"/;s/\n/ /' $HISTFILE)
rcmd=$(eval $CMD $ARGS)
# run command
case $rcmd in
www.*|http://*|https://*|ftp://*|mailto:*)
exo-open $rcmd &
;;
man://*)
eval $XTERM -e "man ${rcmd#man://}" &
;;
telnet*|ssh*)
eval $XTERM -e "$rcmd" &
;;
*)
eval $rcmd 2> /tmp/run-command-error &
;;
esac
sleep .1
if grep -c 'command not found' /tmp/run-command-error; then
yad --fixed --title="Error" --window-icon="applications-system" --text="\n Command not found \n" --timeout="2" --no-buttons
sed 's/ $CMD// $HISTFILE'
rm /tmp/run-command-error
`basename "$0"`
else
# add command to history
grep -qF "$rcmd" $HISTFILE || echo $rcmd >> $HISTFILE
fi
exit 0
Code: Select all
#! /bin/bash
XTERM="xterm"
# create history file
mkdir -p ${XDG_CACHE_HOME:-$HOME/.cache}/
HISTFILE=${XDG_CACHE_HOME:-$HOME/.cache}/ix-run.history
touch $HISTFILE
# create and run dialog
TITLE="Befehl ausführen"
TEXT="\nBefehl eingeben und Enter drücken:\n"
rcmd=$(yad --width=500 --center --window-icon="gtk-execute" --name="${0##/}" --title="$TITLE" --text="$TEXT" --image="gtk-execute" --editable --entry --rest $HISTFILE)
echo "tooltip:Beispielmenü"
# run command
case $rcmd in
http://*|https://*|ftp://*)
xdg-open $rcmd &
;;
mailto://*)
xdg-email $rcmd &
;;
man://*)
eval $XTERM -e "man ${rcmd#man://}" &
;;
telnet*|ssh*)
eval $XTERM -e "$rcmd" &
;; *)
eval $rcmd 2> /tmp/run-command-error &
;;
esac
sleep .1
if grep -c 'command not found' /tmp/run-command-error; then
yad --fixed --title="Error" --window-icon="applications-system" --text="\n Command $rcmd not found \n" --timeout="3" --no-buttons
rm /tmp/run-command-error
`basename "$0"`
else
# add command to history
head $HISTFILE | grep -qF "$rcmd" || echo -e "$rcmd\n$(<$HISTFILE)" > $HISTFILE
fi
exit 0