YAD - Tips
Menu Context Command --html "open"
What is the command that is used to get the URL window to open in the Yad --html Dialog ?
For example, Right Click --> in --html Dialog --> Context Menu = "Open"
For example, Right Click --> in --html Dialog --> Context Menu = "Open"
Yad 0.42.0 was released last week https://github.com/v1cont/yad/releases. New features and bug fixes.
It's the last version with gtk2 support.
It's the last version with gtk2 support.
yad's author wrote: upcoming release (0.42.0) will be the last release with gtk2 support. next releases will depends on gtk 3.22 (with porting to gtk4 in mind) and with versioning in format X.Y where X - a current version, starting from 1, and Y - current patchset.
dialog set will be hardly modified, for example, entry will be dropped, and both progress dialogs will be merged into a single one and some gtk3 specific dialogs like appchooser will be implemented. predefined (aka stock) items will have prefix yad-, and must be translated with yad, so any help with this will be highly appreciated.
support of tray icon will be a compile-time option, and may be dropped too in a future.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]
Not exactly what you're looking for but close. I found this short video that demonstrates a navigation system. You'd have to contact the site's author for more info. My guess is that it's implemented as paned top/bottom dialog. The top section looks like an --icons box. The bottom section looks like a multi-button --form. Top and bottom can communicate via a FIFO. Top section listens on the FIFO like this (untested):stemsee wrote:How can it be known which tab is selected in a multi-tabbed yad gui. So that the Yad frame which swallows the tabs, and has several buttons can assign the buttons to work in the selected tab, maybe differently than when in another tab? Is it possible without closing and reopening?
yad --icons --listen --plug=1234 &
Any button of the bottom form would then write (to the FIFO): Ctrl-J followed by the list of new icons/commands (see yad help for Iconbox for details). This effectively would switch the contents of the top section.
Caveat: I'm guessing the whole thing.
You could replace --icons in the top section with any other yad widget that accepts --listen and can be reset by sending Ctrl-J to it. For instance, --list satisfies both conditions. You couldn't put a --notebook in the top section.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]
Not exactly what you're looking for but close. I found this short video that demonstrates a navigation system. You'd have to contact the site's author for more info. My guess is that it's implemented as paned top/bottom dialog. The top section looks like an --icons box. The bottom section looks like a multi-button --form. Top and bottom can communicate via a FIFO. Top section listens on the FIFO like this (untested):stemsee wrote:How can it be known which tab is selected in a multi-tabbed yad gui. So that the Yad frame which swallows the tabs, and has several buttons can assign the buttons to work in the selected tab, maybe differently than when in another tab? Is it possible without closing and reopening?
yad --icons --listen --plug=1234 &
Any button of the bottom form would then write (to the FIFO): Ctrl-J followed by the list of new icons/commands (see yad help for Iconbox for details). This effectively would switch the contents of the top section.
Caveat: I'm guessing the whole thing.
You could replace --icons in the top section with any other yad widget that accepts --listen and can be reset by sending Ctrl-J to it. For instance, --list satisfies both conditions. You couldn't put a --notebook in the top section.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]
Hi step
That's a good solution for paned which is limited to two panes and the frame. I am thinking of 4 or more tabs. When a tab is selected yad internally sends signals so it is known which is the last tab selected, I really want to know how to get at that signal/info programmatically, internally without using xdotool. Maybe I will need to post a feature request with Victor.
stemsee
That's a good solution for paned which is limited to two panes and the frame. I am thinking of 4 or more tabs. When a tab is selected yad internally sends signals so it is known which is the last tab selected, I really want to know how to get at that signal/info programmatically, internally without using xdotool. Maybe I will need to post a feature request with Victor.
stemsee
If you do request a feature make sure to tell Victor it's for GTK2 because he's announced future versions won't support GTK2 anymore.stemsee wrote:Hi step
That's a good solution for paned which is limited to two panes and the frame. I am thinking of 4 or more tabs. When a tab is selected yad internally sends signals so it is known which is the last tab selected, I really want to know how to get at that signal/info programmatically, internally without using xdotool. Maybe I will need to post a feature request with Victor.
stemsee
Fatdog64-800 still requires GTK2. Don't know about which Puppies and Dogs do too.
[url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Fatdog64-810[/url]|[url=http://goo.gl/hqZtiB]+Packages[/url]|[url=http://goo.gl/6dbEzT]Kodi[/url]|[url=http://goo.gl/JQC4Vz]gtkmenuplus[/url]
misko_2083 wrote:Thanks fredx181, don't know why I thought that DIR field in the form dialog doesn't quote the path.
lika Added pv command to display the progress. One more dependancy to install but I see no other way for now.
X window button is managed by the window manager so intercepting it is impossible. It's only possible to get the exit status 252 when the window is closed via X.That's why I added undecoratzed to pprevent the paned dialog from closing and --no-escape to prevent closing the same dialog if Escape was pressed. That is the simplest solution. Anything else would be too complex.
To use the checkboxes in the function install_app you would need to check if $2 and $3 are true or false.
The script now displays extra dialogs and prevents them from opening multiple times e.g.if the cancel and abort buttons are clicked several times. This is working for me:Code: Select all
#!/bin/bash if ! hash pv; then yad --text "install pv first" exit 1 fi export faextraxt='bash -c "install_app %1 %2 %3 %4"' # We need this to store the main proces ID export main_proc_id=$(mktemp -u --tmpdir fpid.XXXXXXXX) export progress_pipe=$(mktemp -u --tmpdir ftd.XXXXXXXX) mkfifo "$progress_pipe" export percentage_pipe=$(mktemp -u --tmpdir ftd2.XXXXXXXX) mkfifo "$percentage_pipe" export form_pipe=$(mktemp -u --tmpdir ftd3.XXXXXXXX) mkfifo "$form_pipe" trap "rm -f $progress_pipe $percentage_pipe $form_pipe $main_proc_id" EXIT fakey=$(($RANDOM * $$)) function install_app { # Form fields are read in a cycle 1-4, each cycle sets new values # Disables all the form fields when the install starts echo "@disabled@" > "$form_pipe" echo "@disabled@" > "$form_pipe" echo "@disabled@" > "$form_pipe" echo "@disabled@" > "$form_pipe" echo "#Selected extraction path: $1" >> "$progress_pipe" echo "#" >> "$progress_pipe" echo "#Add a shortcut in the applications menu : $2" >> "$progress_pipe" echo "#Add a desktop shortcut : $3" >> "$progress_pipe" echo "#" >> "$progress_pipe" echo "#Preparing to extract..." >> "$progress_pipe" >"$main_proc_id" while read -r line; do # If line is a integer number if [[ "$line" == +([0-9]) ]];then echo "$line" >> "$progress_pipe" else echo "#$line" >> "$progress_pipe" fi done < "$percentage_pipe" & LOOP_PID="$!" # main process example for a demonstration purpose # for i in {1..100}; do echo "$i %" 2>&1 >> $percentage_pipe; sleep .1; done & echo $! > "$main_proc_id" pv -n archive.tar.xz 2>$percentage_pipe | xzcat | tar xp -C "$1" -v 2>&1 >> $percentage_pipe & echo $! > "$main_proc_id" # Wait here # Wait returns exit status ${?} # It's stderr is redirected to /dev/null to prevent kill command to print messages wait $(<$main_proc_id) 2>/dev/null if [[ "$?" = 0 ]] then echo "100%" >> "$progress_pipe" echo "#Install completed." >> "$progress_pipe" kill "$LOOP_PID" >$main_proc_id yad --text="Install successfull" --button="gtk-ok:0" & elif [[ ! -s "$main_proc_id" ]]; then echo "#Install canceled." >> "$progress_pipe" kill "$LOOP_PID" >$main_proc_id else echo "#Install error." >> "$progress_pipe" kill "$LOOP_PID" >$main_proc_id fi # Resets the field values when the install ends echo "$1" > $form_pipe echo "$2" > $form_pipe echo "$3" > $form_pipe echo "$faextraxt &" > $form_pipe } export -f install_app function get_pid_and_kill () { Sure_Command='yad --text=Are you sure you want to cancel the installation? --button=gtk-yes:0 --button=gtk-no:1' Sure_Command_PID="$(ps -eo pid,cmd | grep -F "$Sure_Command" | grep -v "grep" | awk '{ print $1 }')" if [[ -s "$main_proc_id" ]] && [[ "$Sure_Command_PID" == "" ]] && yad --text="Are you sure you want to cancel the installation?" --button="gtk-yes:0" --button="gtk-no:1"; then if [[ -s "$main_proc_id" ]]; then BCKUPID="$(<$main_proc_id)" >"$main_proc_id" kill $BCKUPID 2>/dev/null sleep 1 fi # The special yad variable $YAD_PID stores the main window PID # killing that PID closes the window [[ "$1" == "CLOSE" ]] && kill -s SIGUSR1 $YAD_PID elif [[ ! -s "$main_proc_id" ]] ; then [[ "$1" == "CLOSE" ]] && kill -s SIGUSR1 $YAD_PID fi } export -f get_pid_and_kill exec 3<> $progress_pipe exec 4<> $percentage_pipe exec 5<> $form_pipe yad --plug="$fakey" --tabnum=1 --form \ --field="Choose a folder:DIR" \ --field="Add a shortcut in the applications menu:CHK" \ --field="Add a desktop shortcut:CHK" \ --field="Install!system-software-install:fbtn" --cycle-read <&5 & # This is the initial cycle that sets the form field values echo "${HOME}" > $form_pipe # set default folder in this line echo "TRUE" > $form_pipe # default first checkbox value echo "FALSE" > $form_pipe # default second checkbox value echo "$faextraxt &" > $form_pipe yad --plug="$fakey" --tabnum=2 --window-icon="$ICON" --progress \ --enable-log="Show log" --log-height=100 --tail --borders=5 <&3 & yad --paned --key="$fakey" --buttons-layout=edge \ --button="gtk-close":'bash -c "get_pid_and_kill CLOSE" 2>/dev/null' \ --button="Abort!gtk-stop":'bash -c "get_pid_and_kill" 2>/dev/null' \ --text="" --title="TEST" --window-icon="$ICON" --center \ --no-escape --undecorated & MAIN_PID=$! # Redirecting kill output from get_pid_and_kill function to /dev/null wait $MAIN_PID 2>/dev/null exec 3>&- exec 4>&- exec 5>&-
I tried this script, but the dialog opens every time if I click Cancel or Abort buttons.The script now displays extra dialogs and prevents them from opening multiple times e.g.if the cancel and abort buttons are clicked several times.
Now I try to make a display progress and log output with 7z only (without tar), but it turns out only a log. Can you help how to do this?
This line:
Code: Select all
pv -n | "$percentage_pipe" | 7za x archive.7z -bb3 -o"$1" 2>&1 >> "$percentage_pipe" & echo "$!" > "$main_proc_id"
Is there a way to make an Abort button inactive while unpacking? Even better to make one "Abort and Quit" button (fbtn) below the Install button and progress bar + log at the bottom of the window?
- Argolance
- Posts: 3767
- Joined: Sun 06 Jan 2008, 22:57
- Location: PORT-BRILLET (Mayenne - France)
- Contact:
Bonsoir,
May be is there an answer among the 40 pages of this thread. If yes, just a link would be appreciated, if no:
For example, this works fine:
How could it work clicking a notification icon to display the text?
I tried this and many other combinations but without success:
Thank you for your attention.
[EDIT] : when I couldn't believe it, I finally found a solution (for those who would be interested):
Cordialement.
May be is there an answer among the 40 pages of this thread. If yes, just a link would be appreciated, if no:
For example, this works fine:
Code: Select all
yad --text-info --back=red --fore=white < /root/\.history --fontname=Monospace
I tried this and many other combinations but without success:
Code: Select all
yad --notification --text "TEXT TEST" --command="yad --text-info --back=red --fore=white < /root/\.history --fontname=Monospace" &
[EDIT] : when I couldn't believe it, I finally found a solution (for those who would be interested):
Code: Select all
text () {
yad --text-info --back=red --fore=white < /root/\.history --fontname=Monospace
}
export -f text
yad --notification --icon-size=24 --auto-kill --text "TEXT TEST" --command="bash -c text" &
Hi Argolance, I see you found solution, but just for info, it can work without function by using --filename= , e.g.:
Fred
Code: Select all
yad --notification --text "TEXT TEST" --command="yad --text-info --back=red --fore=white --fontname=Monospace --filename=/root/\.history" &
- Argolance
- Posts: 3767
- Joined: Sun 06 Jan 2008, 22:57
- Location: PORT-BRILLET (Mayenne - France)
- Contact:
Bonjour,
Thanks fredx181!
It is why I said "a" solution but not "the" solution...
The more I use yad, the more I appreciate and discover the extent of what can be done with it. Not to mention the work of smokey01 and a few others: huge and so useful!
Cheers.
Thanks fredx181!
It is why I said "a" solution but not "the" solution...
The more I use yad, the more I appreciate and discover the extent of what can be done with it. Not to mention the work of smokey01 and a few others: huge and so useful!
Cheers.
Last edited by Argolance on Sun 07 Apr 2019, 21:32, edited 1 time in total.
@Argolance Ah, catched your avatar, now I know, you are fooling us all
- Attachments
-
- Argolance-is-fooling-us.png
- (2.56 KiB) Downloaded 432 times
Replying to question from here:
http://murga-linux.com/puppy/viewtopic. ... 66#1024466
Hi achim, it looks like that the problem is that the commands are all on one line, separating them makes it work for me ( I've put an empty line between the command lines to make the separation more clear) :
The resulting quality is not the best IMO (from what I tested), but that's another story.
Fred
http://murga-linux.com/puppy/viewtopic. ... 66#1024466
Hi achim, it looks like that the problem is that the commands are all on one line, separating them makes it work for me ( I've put an empty line between the command lines to make the separation more clear) :
Code: Select all
#!/bin/bash
INPUT=$(yad --width=600 --height=400 --file-selection --file-filter='*.mp3 *.mp4 *.avi')
eval $(yad --width=400 --form --field=start --field=end --field=output:SFL "00:00:00" "00:00:00" "${INPUT/%.*}-out.${INPUT##*.}" | awk -F'|' '{printf "START=%s\nEND=%s\nOUTPUT=\"%s\"\n", $1, $2, $3}')
[[ -z $START || -z $END || -z $OUTPUT ]] && exit 1
DIFF=$(($(date +%s --date="$END")-$(date +%s --date="$START")))
OFFSET=""$(($DIFF / 3600)):$(($DIFF / 60 % 60)):$(($DIFF % 60))
ffmpeg -ss "$START" -t "$OFFSET" -i "$INPUT" "$OUTPUT"
Fred
Specially I found the video quality not good, is ok for me when using copy, then final ffmpeg line:achim wrote:Hello Fred,
Thanks for your help, that's how it works for me.
I put the quality over the command "ffmpeg -ss", where you probably mean the audio result. Do you have a better suggestion for that?
achim
Code: Select all
ffmpeg -i "$INPUT" -acodec copy -vcodec copy -ss "$START" -t "$OFFSET" "$OUTPUT"
Hello Fred,
that worked great. Thanks again for the support. Now I would like to adjust the selection of exact filter and possibly subsequently to the filter result via fi or esac different parameters for ffmpeg. So far, I've created the code like this:
achim
that worked great. Thanks again for the support. Now I would like to adjust the selection of exact filter and possibly subsequently to the filter result via fi or esac different parameters for ffmpeg. So far, I've created the code like this:
I do not know how to connect it to the code above. Do you have a suggestion?OUTFILETYPE=$(yad --list --title="Select File Type" --text="file type selection" \
--column="Select" --column="File Type" --radiolist false avi true mp4 false mp3)
achim
Hi achim, I'm not sure at which point in the script you'd like to add this selection dialog, anyway, maybe something like this ? (added --print-column=2) :
EDIT:
Or maybe just this (no selection dialog, if condition based on the extension of $OUTPUT, e.g. avi ):
Fred
Code: Select all
OUTFILETYPE=$(yad --list --title="Select File Type" --text="file type selection" \
--column="Select" --column="File Type" --radiolist --print-column=2 false avi true mp4 false mp3)
[ $? -ne 0 ] && exit
if [ "$OUTFILETYPE" = "avi|" ]; then
ffmpeg ... ...
fi
if [ "$OUTFILETYPE" = "mp4|" ]; then
ffmpeg ... ...
fi
if [ "$OUTFILETYPE" = "mp3|" ]; then
ffmpeg ... ...
fi
Or maybe just this (no selection dialog, if condition based on the extension of $OUTPUT, e.g. avi ):
Code: Select all
if [ "${OUTPUT##*.}" = "avi" ]; then
ffmpeg ... ...
fi
if [ "${OUTPUT##*.}" = "mp4" ]; then
ffmpeg ... ...
fi
if [ "${OUTPUT##*.}" = "mp3" ]; then
ffmpeg ... ...
fi
Hello Fred,
I have now decided once for this variant:
achim
I have now decided once for this variant:
Gladly I would have your suggestion with the parameter choice for FFMPEG taken over, however, then each time with the new video file the first 4-5 seconds without picture, but with sound. Of course, the code is not finished yet, I can think of a lot more. If you have any other suggestions, feel free to sign up again. I was very happy about your help and hope that I can return the favor.#!/bin/bash
INPUT=$(yad --width=1000 --height=600 --file-selection --file-filter='*.avi' --file-filter='*.mp3' --file-filter='*.mp4')
eval $(yad --width=400 --form --field=start --field=end --field=output:SFL "00:00:00" "00:00:00" "${INPUT/%.*}-out.${INPUT##*.}" | awk -F'|' '{printf "START=%s\nEND=%s\nOUTPUT=\"%s\"\n", $1, $2, $3}')
[[ -z $START || -z $END || -z $OUTPUT ]] && exit 1
DIFF=$(($(date +%s --date="$END")-$(date +%s --date="$START")))
OFFSET=""$(($DIFF / 3600)):$(($DIFF / 60 % 60)):$(($DIFF % 60))
if [ "${OUTPUT##*.}" = "avi" ]; then
ffmpeg ... ...
fi
if [ "${OUTPUT##*.}" = "mp4" ]; then
ffmpeg -ss "$START" -t "$OFFSET" -i "$INPUT" "$OUTPUT"
fi
if [ "${OUTPUT##*.}" = "mp3" ]; then
ffmpeg ... ...
fi
exit 1
achim
Hi Fred,
if you're interested, I changed the parameter order for the FFMPEG command as follows:
So everything works to my satisfaction.
Best regards
achim
if you're interested, I changed the parameter order for the FFMPEG command as follows:
Code: Select all
ffmpeg -ss "$START" -t "$OFFSET" -i "$INPUT" -acodec copy -vcodec copy "$OUTPUT"
Best regards
achim