YAD - Tips

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#571 Post by MochiMoppel »

???
Please give a small example.
In principle it should work, but that depends very much on your code.

At least this should work:

Code: Select all

#!/bin/bash
echo 'apple pie
banana cake
peach ice' > /tmp/testo

res=$(yad --form --separator="\n" --field=1 --field=2 --field=3 --button="Save & Exit:0"  --button=Cancel:1 < /tmp/testo)
(($?)) && exit            #exit here if exit status of yad > 0 (Save&Exit button was not pressed)
echo "$res" > /tmp/testo  #write back to file

User avatar
lamplinux
Posts: 31
Joined: Mon 21 Jan 2019, 06:05
Contact:

Got my example code to work

#572 Post by lamplinux »

@MochiMoppel, Thank You but, I got the below script to work. Its mainly from code you guys provided. (without it, I'd never have anything working :) ) But, I'm loving it ! Things are working and I'm learning too.

Now, to do this yad --dialog-separator --form --icon-read --notepad all in one window...

Since the input should be a numerical only, do I use the NUM for fields in below script ?

I also would like to have all four numbers currently saved in file, to display RO in 4 other form boxes but, I'll get that sure enough (I know I can :) . Would I do that in a --pane window ?

Code: Select all

#!/bin/bash 
# backup IFS 
OIFS=$IFS 
configDir=/home/bobby/yadbash/sparkypad/config
# set IFS to newline char 
IFS=$'\n'

posFile=$configDir/docks/dock-size-position/dock-size-pos
sizPosDir=$configDir/docks/dock-size-position

wideDocks=$(sed -n 1p < $sizPosDir/dock-size-pos)
hiDocks=$(sed -n 2p < $sizPosDir/dock-size-pos)
posxDocks=$(sed -n 3p < $sizPosDir/dock-size-pos)
posyDocks=$(sed -n 4p < $sizPosDir/dock-size-pos)

yad --form --separator="\n" --field="Width" "$wideDocks" --field="Height" "$hiDocks" --field="From Left" "$posxDocks" --field="From Top" "$posyDocks" --window-icon="start-here" --center --title="Dock Window Sizing" --button="Cancel":0 --button="Save":0 > $posFile

# get exit status 
out=$? 

# Restore IFS 
IFS=$OIFS 

# 0K (0), canceled (1) or closed dialog (252) 

[ $out -ne 0 ] && exit 0

User avatar
lamplinux
Posts: 31
Joined: Mon 21 Jan 2019, 06:05
Contact:

Switching out directory of --icons --read-dir

#573 Post by lamplinux »

Is it possible using a While True or case event to swap out the icon directory in a yad window and have it automatically updated it because it uses --monitor ?

Code: Select all

yad --dialog-sep --image="my-image.png" --width="700" --height="400" --center --window-icon=$HOME/icons/window-icon.png  --icons --read-dir=$HOME/ions/dock/config --monitor --single-click --item-width=70 --sort-by-name  --title="Config Utility" --text="Please Make Your Selection\n" --button="Config" --button="Bookmarks" --button="Music" --button="Images" --button="Videos" --button="Exit":1
Update: I could use a default directory and copy icons to and from the default directory each time a button is clicked. (Non Programmer way) :)

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

Re: Got my example code to work

#574 Post by MochiMoppel »

lamplinux wrote:@MochiMoppel, Thank You but, I got the below script to work
It works? Your Cancel button does not work as it should (you assigned it the same 0 exit code as the Save button) and since you immediately redirect the yad output to $posFile without checking the exit code you will end up with an empty $posFile if you close the dialog with Alt+F4 or with the window's x button.

lamplinux, I can't see what you are asking for as you already answered some of your questions yourself.
In any case I'm a bit busy now but I'm sure some of our yad experts can help you much better than I can.

User avatar
lamplinux
Posts: 31
Joined: Mon 21 Jan 2019, 06:05
Contact:

Using images with --button=

#575 Post by lamplinux »

Just mentioning this because I happened upon it by accident hacking yad code

Code: Select all

export imageDir=/home/user/images

go_imagebutton() {
     cd  $HOME/bobby
     ls -l
}
export -f go_imagebutton

--button="!$imageDir/bobby.png!Bobby Button":"bash -c go_imagebutton"
Example output:

Image

User avatar
lamplinux
Posts: 31
Joined: Mon 21 Jan 2019, 06:05
Contact:

How would I use Yad as a Wrapper for a program

#576 Post by lamplinux »

I'm trying to wrap Yad around mpv to play videos: Here's my code that does not work.

No examples on web anywhere.

(update: I have looked at code in miskos wrapper for youtube-dl but, I don't understand and its so complicated)

Code: Select all

mpv /home/bobby/Videos/* | yad2 --dialog-sep --image="/home/bobby/yadbash/sparkypad/images/side-banners/niklback-revolution.png" --undecorated --geometry=1366x560+1+1  --title="Sparkpad Images" --border=0 --skip-taskbar

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#577 Post by vovchik »

Dear lamplinux,

I cobbled this together for my own purposes and use it regularly:

Code: Select all

#!/bin/bash

# ****************************************************************
# PROGRAM:      gmpv
# PURPOSE:      yad-based gui wrapper for mpv (URL or file)
# AUTHOR:       vovchik, November 2018
# DEPENDENCIES: bash, yad, mpv
# VERSION:      0.1c
# ****************************************************************


# ***********************
# INITIALIZATION
# ***********************

# create icon and copy to /tmp/mpv.svg
LOAD=""
TITLE="Wait..."
TXT="Loading video..."
TMP="/tmp/gmpv.txt"
SEARCH="VO:"
rm "$TMP"
# search for "VO:"
SVG="<svg width='48' height='48' viewBox='0 0 100 100'>
 <linearGradient id='l1' gradientUnits='objectBoundingBox' 
  x1='1' x2='1' y1='0' y2='1'>
  <stop stop-color='skyblue' offset='1'/>
  <stop stop-color='white' offset='0'/>
 </linearGradient>
 <path style='fill:#111111' d='M 10,3.1 10,97 90,97 90,3.1 z m 4,5.9 
  6,0 0,5 -6,0 z m 66,0 6,0 0,5 -6,0 z m -66,11 6,0 0,5 -6,0 z m 66,0 
  6,0 0,5 -6,0 z m -66,11 6,0 0,5 -6,0 z m 66,0 6,0 0,5 -6,0 z m -66,11 
  6,0 0,5 -6,0 z m 66,0 6,0 0,5 -6,0 z m -66,11 6,0 0,5 -6,0 z m 66,0 
  6,0 0,5 -6,0 z m -66,11 6,0 0,5 -6,0 z m 66,0 6,0 0,5 -6,0 z m -66,11 
  6,0 0,5 -6,0 z m 66,0 6,0 0,5 -6,0 z m -66,11 6,0 0,5 -6,0 z m 66,0 
  6,0 0,5 -6,0 z'/>
 <path style='fill:url(#l1)' d='m 23,5 54,0 0,26 -54,0 z m 0,29 54,0 
  0,28 -54,0 z m 0,31 54,0 0,30 -54,0 z'/>
</svg>"
IMAGE="/home/vovchik/my-documents/anim/c1.gif"
ICON="/tmp/mpv.svg"
if [ ! -e "$ICON" ]; then
	echo "$SVG" > /tmp/mpv.svg
fi
FONT="DejaVu Sans Mono Bold 14"
BUT="<span color='black'>Close</span>!!Close window"
NL="
"
results=""
get_url="$@"
LINE_COUNT=""
HELP="<b>Gmpv</b> needs an input argument.
Enter file/URL or '<b>?</b>' for help:" 
ABOUT=$(mpv --list-options)
ERROR="$NL""<b>WARNING!</b>""$NL -----
Install <b>mpv</b> before""$NL""running this program.""$NL"
export SVG ICON FONT BUT NL HELP ABOUT results get_url SEARCH TMP IMAGE TITLE TXT LOAD

# ***********************
# END INITIALIZATION
# ***********************


# ***********************
# FUNCTIONS
# ***********************

# -----------------------
function GET_URL()
# -----------------------
{
	get_url=$(yad \
		--entry \
		--title="Play URL" \
		--text="$HELP" \
		--entry-text "$get_url" \
		--window-icon="$ICON" \
		--image="$ICON" \
		--image-on-top \
		--center \
		--margins=5 \
		--width=400 \
		--fontname="$FONT" \
		--text-info \
		--title="Mpv Gui" \
		--buttons-layout=end \
		--button="Play!!Play this URL":0 \
		--button="Quit!!Click to quit this little program":1 \
		--editable)
}; export -f GET_URL

# -----------------------
function SHOW_RESULTS()
# -----------------------
{
	echo "Play: $get_url"

	if [[ -z $get_url ]];then
		echo "No URL. Bye-bye."
		exit 1
	elif [[ "$get_url" = "?" || "$get_url" = " " ]];then
		# about box
		results="$ABOUT"
		echo "$results"
		echo "About:    mpv$NL$NL$results" | \
		yad \
		--window-icon="$ICON" \
		--geometry=700x550+300+100 \
		--title="Mpv About" \
		--tail \
		--text-info \
		--fore="black" \
		--back="#FFF7F7" \
		--margins=5 \
		--button="$BUT" \
		--fontname="DejaVu Sans Mono 13" \
		--autoscroll - 
	else
		mpv "$get_url" >> "$TMP" &
		while  [ -z "$LOAD" ]; do
			LOAD=$(grep "$SEARCH" /tmp/gmpv.txt)
			echo running
			sleep 0.5
		done | yad \
		--progress \
		--title="$TITLE" \
		--picture \
		--size=orig \
		--filename="$IMAGE" \
		--width=280 \
		--height=190 \
		--pulsate \
		--center \
		--inc=2 \
		--no-buttons \
		--auto-close \
		--auto-kill \
		--undecorated \
		--text-align=center \
		--window-icon="$ICON" \
		--text="<b>Loading video...</b>"
	fi
}; export -f SHOW_RESULTS

# -----------------------
function SHOW_ERROR()
# -----------------------
{
	yad \
	--window-icon="$ICON" \
	--title="Mpv Gui" \
	--image-on-top \
	--center \
	--image="$ICON" \
	--text-align="center" \
	--text="$ERROR" \
	--button="$BUT"
}; export -f SHOW_ERROR

# ***********************
# END FUNCTIONS
# ***********************


# ***********************
# MAIN
# ***********************

if [ $(which mpv) ]; then
	while true; do
		GET_URL
		SHOW_RESULTS
	done
else
	echo "mpv was not found. Please install it."
	SHOW_ERROR
fi

# ***********************
# END MAIN
# ***********************
Change the image paths in the script and desktop, and it should work for you too.

With kind regards,
vovchik

UPDATED: Fixed the script above and in the archive to run mpv and not smplayer.
Attachments
gmpv.tar.gz
(10.76 KiB) Downloaded 112 times
Last edited by vovchik on Fri 22 Feb 2019, 10:41, edited 1 time in total.

User avatar
lamplinux
Posts: 31
Joined: Mon 21 Jan 2019, 06:05
Contact:

Yad Video Wrapper

#578 Post by lamplinux »

@vovchik - Thank You so much. I will use your script tonight and learn from your code.

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#579 Post by vovchik »

Dear lamplinux,

You will see places in the code where I commented out mpv and used smplayer instead. Originally, I did it for mpv, and everything worked that way just fine, so just commnet out the smplayer lines and use the commented-out mpv ones. :)

With kind regards,
vovchik

User avatar
lamplinux
Posts: 31
Joined: Mon 21 Jan 2019, 06:05
Contact:

#580 Post by lamplinux »

@vovchik, Yes, I noticed Committing out of mpv and switched it to mpv. Testing right now.

User avatar
lamplinux
Posts: 31
Joined: Mon 21 Jan 2019, 06:05
Contact:

Menu Context Command --html "open"

#581 Post by lamplinux »

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"

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#582 Post by step »

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.
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]

stemsee

#583 Post by stemsee »

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?

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#584 Post by step »

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?
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):

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]

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#585 Post by step »

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?
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):

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]

stemsee

#586 Post by stemsee »

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

step
Posts: 1349
Joined: Fri 04 May 2012, 11:20

#587 Post by step »

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
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.

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]

lika
Posts: 7
Joined: Tue 07 Aug 2018, 01:30

#588 Post by lika »

misko_2083 wrote:Thanks fredx181, don't know why I thought that DIR field in the form dialog doesn't quote the path. :roll:

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>&-
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.
I tried this script, but the dialog opens every time if I click Cancel or Abort buttons.
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"
-bb3 is output log level

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?

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#589 Post by Argolance »

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:

Code: Select all

yad --text-info --back=red --fore=white < /root/\.history --fontname=Monospace
How could it work clicking a notification icon to display the text?
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" &
Thank you for your attention.

[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" &
Cordialement.

User avatar
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#590 Post by fredx181 »

Hi Argolance, I see you found solution, but just for info, it can work without function by using --filename= , e.g.:

Code: Select all

yad --notification --text "TEXT TEST" --command="yad --text-info --back=red --fore=white --fontname=Monospace --filename=/root/\.history" &
Fred

Post Reply