Zenity/Yad and scripts

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#46 Post by 8-bit »

If you think the zenity project is dead, check this out.
It shows the last update as April 5, 2011.

It is version 3.0.

But there is a catch. It actually requires gtk+-3.0 for compiling

It requirements as listed are:

scrollkeeper
· intltool
· gtk+-2.0
· libglade-2.0
· libgnomecanvas-2.0

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

yad international

#47 Post by L18L »

On my wary513 (German language pack) everything is fine. See
ymount
rodin.s has reported same (OK) for Russian and Ukrainian.

Is it just Dutch that does not localize or any other language except German and Russian :?:

We can reduce the problem to one simple test:

If you have a LANG other than English please report fault or success by simply testing:

Code: Select all

yad
Cancel button should show in your language if you have installed the language pack.

Thanks for your attention.
L

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#48 Post by technosaurus »

added a newer version (0.13.0+) in initial post with some fixes from svn

package size is significantly smaller
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

yad-0.13.0+

#49 Post by L18L »

technosaurus wrote:added a newer version (0.13.0+) in initial post with some fixes from svn

package size is significantly smaller
Relative links no more possible.

I have used them in ymount

example
# ymount
/bin/ymount: line 40: ../usr/local/ymount/functions: No such file or directory

Changing from
. ../usr/local/ymount/functions # enables start from anywhere
to
. /usr/local/ymount/functions

Was that intended?
If so, no problem I will update ymount using the changes

L

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#50 Post by technosaurus »

probably not intended, I will try a recompile at 0.13.0 when I return tuesday
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

recompile

#51 Post by L18L »

Localization again
De ru and uk had no problems

The text of the gtk buttons is in gtk20.mo.

I have made a new test on a fresh wary5141,
Dutch locale
Dutch language pack per sfs_load on the fly
yad 0.13.0
yad-NLS installed.

There must be something weird in the sources,
LINGUAS containing de ru uk and sk.
that seems to restrict translations to just these languages, just my thought.

The trick using LANGUAGE is showing that translation to another language, here nl, is possible.

But it really ought to work without tricks.
:)

Edited:
The problem is not new to version 0.13
Attachments
yad_localization_problem.png
(17.56 KiB) Downloaded 4618 times

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: recompile

#52 Post by L18L »

L18L wrote: But it really ought to work without tricks.
Found another trick:

Copied
/usr/share/locale/ru/LC_MESSAGES/yad.mo
to
/usr/share/locale/nl/LC_MESSAGES

and

Code: Select all

yad
works Dutch :!: :!: :!:

This cannot be the solution but a pretty simple work around :)

------------------------

The above mentioned

. ../usr/local/ymount/functions # enables start from anywhere

works in wary5141 :roll:

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

yad

#53 Post by L18L »

Running yad-0.13.0 in wary5141 I have discovered something new for me (and maybe for you too): Buttons no more restricted to be placed at bottom line. See picture.

To get nearer to the solution of localization to languages other than de, sk, ru and uk I have set up this wary using Dutch locale again (without utf8), installed lang-pack-nl and copied just the German yad.mo to /usr/share/locale/nl/LC_MESSAGES and it works!

# locale -a
C
en_US
nl_NL
POSIX
# echo $LANG
nl_NL
# echo $LC_MESSAGES

# ls -l /usr/share/locale/nl/LC_MESSAGES/yad.mo
-rw-r--r-- 1 root root 8581 2011-07-04 23:47 /usr/share/locale/nl/LC_MESSAGES/yad.mo
# # is a copy of de/LC_MESSAGES/yad.mo !!!
#
# # it works: showing 'Cancel' translated to Dutch 'Annuleren'
# yad --version
0.13.0
#
technosaurus wrote:probably not intended, I will try a recompile at 0.13.0 when I return tuesday
yad 0.14.2 is out.
I don't know why yad-NLS should be needed.
Developers are able to understand English
And for international users there is needed just one dummy yad.mo in user's LC_MESSAGES which enables the translations of gtk button texts.
Attachments
form_field_type_BTN.png
(20.97 KiB) Downloaded 4206 times

stu90

#54 Post by stu90 »

Hi L181,
Looks like there has been some nice updates in Yad recently - another new feature is form columns. :)

Image

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

yad

#55 Post by L18L »

stu90 wrote:Hi L181,
Looks like there has been some nice updates in Yad recently - another new feature is form columns. :)
Hi stu90,
thanks, looks like we can make more complex apps now :)

stu90

#56 Post by stu90 »

Not sure how long this has been supported but works on yad 0.16.3 on my Bodhi install.

Button launcher with out the gui automatically closing and needing to be restarted.

Code: Select all

yad --text=" Button launchers with gui still open " --button="Terminal:urxvt" --button="Text:geany" --button="gtk-quit"

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#57 Post by RSH »

stu90 wrote:Not sure how long this has been supported but works on yad 0.16.3 on my Bodhi install.

Button launcher with out the gui automatically closing and needing to be restarted.

Code:
yad --text=" Button launchers with gui still open " --button="Terminal:urxvt" --button="Text:geany" --button="gtk-quit"
I have tested this script in my LazY Puppy. I have installed the yad 0.16.2, compiled in my LazY Puppy earlier. It works also!

JFYI: i have installed two versions of yad (0.12.4 and 0.16.2). I have renamed the files and set links to the yad files. Yad or yad1 calls yad-0.12.4 and yad2 calls yad-0.16.2. I just wanted to use the compiled 0.16.2 version without removing/overwriting the original lucid built in.

RSH
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

Yad new Features

#58 Post by seaside »

As L18L and stu90 have mentioned, the latest yad has some interesting possibilites. So I loaded yad version 16.2 and put together this adaptation of 01micko's tray cpu percentage meter. It uses yad's new notification functions to provide icons "on-the-fly", allowing dynamic information updating in the tray (inside the icon itself).

A pipe is set up in the /tmp directory to receive messages from an updating input source (in this case from CPU usage code by Paul Colby (http://colby.id.au).

The output percentage ($DIFF_USAGE), is then compared to a range and a background color selected ($BG).

Those variables are then picked up in a template as suggested by technosaurus' use of svg for icons, and dynamically echo'd to the file /tmp/cpuicon in a loop.

When the command "echo icon:/tmp/cpuicon.svg >$PIPE" is issued, the tray icon is then refreshed.

As a bonus, if that icon starts heating up, you can left click the "cpu %" icon, and bring up pprocess. Further, you can also dynamically build right-click menus as well.

Middle clicking the icon kills the program.

Technosaurus: Svg definitely more powerful than xpm...thanks.

Cheers,
s

Code: Select all

 #!/bin/bash
# seaside January 11, 2012
# yad version 16.2 required

PIPE=/tmp/cpupipe
mkfifo $PIPE
exec 3<> $PIPE
trap on_exit EXIT


function on_exit () {
    echo "quit" >&3
    rm -f $PIPE
}

yad --notification --kill-parent --listen \
    --image=gtk-stop --text="Average CPU Percent" \
    --command="pprocess" <&3 &
    
# following CPU usage code
# by Paul Colby (http://colby.id.au), no rights reserved ;)

PREV_TOTAL=0
PREV_IDLE=0

while true; do
  CPU=(`cat /proc/stat | grep '^cpu '`) # Get the total CPU statistics.
  unset CPU[0]                          # Discard the "cpu" prefix.
  IDLE=${CPU[4]}                        # Get the idle CPU time.

  # Calculate the total CPU time.
  TOTAL=0
  for VALUE in "${CPU[@]}"; do
    let "TOTAL=$TOTAL+$VALUE"
  done

  # Calculate the CPU usage since we last checked.
  let "DIFF_IDLE=$IDLE-$PREV_IDLE"
  let "DIFF_TOTAL=$TOTAL-$PREV_TOTAL"
  let "DIFF_USAGE=(1000*($DIFF_TOTAL-$DIFF_IDLE)/$DIFF_TOTAL+5)/10"

  # Remember the total and idle CPU times for the next check.
  PREV_TOTAL="$TOTAL"
  PREV_IDLE="$IDLE"
  
  # cpu tray meter and color coding from  01micko follows:

  BG=#FF69B4 #hotpink (default)

  [ "$DIFF_USAGE" -le "65" ] && BG=#ADD8E6  #lightblue
  [[ "$DIFF_USAGE" -gt "65" && "$DIFF_USAGE" -le "80" ]] && BG=#FFB6C1 #lightpink

  # technosaurus' use of svg for icons
	echo '<svg>
	   <rect width="48" height="48" x="0" y="0" id="rect1" 
	     style="fill:'"$BG"';fill-opacity:1"/>
	   <text x="6.7142859" y="27.428572" id="text1" 
	     style="font-size:36px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;font-family:Bitstream Vera Sans"
	     >'"$DIFF_USAGE"'</text>
	   <text x="3.1428573" y="43.57" id="text2"
	     style="font-size:18px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;font-family:Bitstream Vera Sans"
	     >cpu %</text>
	 </svg> ' >/tmp/cpuicon.svg
	 
	echo icon:/tmp/cpuicon.svg >$PIPE # send notice to change icon
		
  # Wait before checking again.
  sleep 1
done 
Attachments
CPU-average.png
Yad-tray-CPU-average.png
(29.09 KiB) Downloaded 3819 times

Burunduk
Posts: 80
Joined: Sun 21 Aug 2011, 21:44

gtk+-2.0 support

#59 Post by Burunduk »

YAD author wrote:i prepare to remove support of gtk+-2.0 in a next releases. what do
you think about it?
Maybe someone here feels an interest in this question.

https://groups.google.com/d/topic/yad-c ... discussion

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

#60 Post by vovchik »

Dear guys and gals,

I don't know when most apps will be ported to gtk3 - and there are tons of scripts that make use of gtkdialog (gtk 2.0). The transition isn't instant or easy. Peter van Eerten (gtk-server and BaCon) is maintaining gtk 2.0 Bacon HUG along with a new gtk3 version. And Bacon runs under Linux, BSD, OSX, peculiarities of each OS must be borne in mind. It also runs under cygwin. Gtk-server still compiles under gtk1. I hope ananasik - Yad's creator - will continue to maintain a gtk2 version for some time still. I remember when KDE made the leap to KDE4. The result for me was that I didn't install it, unlike KDE3.

With kind regards,
vovchik

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#61 Post by Geoffrey »

Yad still seems to be going ahead, the latest version is 0.23.1, the issue of text placement is fixed in " yad --text " it now can be centered, the window resizing is resolved and buttons can also be centered.

It's been very quite here in regard to Yad.

Code: Select all

#!/bin/bash

process=`ps -u $USER | yad --list --title="Kill Process" --window-icon="process-stop" --buttons-layout=center --column "Please select a process to kill:" --text="List all $USER processes:" --width 350 --height 450`

ans=`echo $?`

	if test "$ans" -eq "0" ;
	then

		select=`echo $process | cut -d" " -f1`

		kill $select
			ans1=`echo $?`
			if [ "$ans1" == "0" ] ;
			then 
			select1=`echo $process | cut -d":" -f3  | cut -d" " -f2`
 			echo | yad --fixed --timeout="5" --title="Kill Process" --window-icon="process-stop" --buttons-layout=center --button="gtk-ok:0" --text-align="center" --borders="30" \
 			--text="<big><big><b>${select1%|*}</b></big></big><big><b> was killed!</b></big>" 
			else
 			echo | yad --fixed --timeout="5" --title="Kill Process" --window-icon="process-stop" --buttons-layout=center --button="gtk-ok:0" --text-align="center" --borders="30" \
 			--text="<big><big><b>Process</b></big></big><big><b> not found!</b></big>" 
			fi
	exit 0
 	fi 
 
	if test "$ans" -eq "1" ;
	then
	exit 0
	fi
Attachments
yad-0.23.1.tar.gz
Yad version 0.23.1 compiled in Carolina
(57.3 KiB) Downloaded 499 times
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#62 Post by Geoffrey »

Latest Yad compiled in Carolina.
Victor Ananjevsky
Dec 6 (15 hours ago)

hi, list

new version (0.25.1) of yad is available for download
this is a bugfix release.

changes are:
- fix bug with popup menu of notification icon (http://code.google.com/p/yad/issues/detail?id=196)
- use normal hints for windows, so now window managers doesn't treats yad windows as a dialogs
Attachments
yad-0.25.1-i486.pet
(97.68 KiB) Downloaded 521 times
yad_DOC-0.25.1-i486.pet
(9.51 KiB) Downloaded 483 times
yad_NLS-0.25.1-i486.pet
(55.68 KiB) Downloaded 460 times
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#63 Post by mikeb »

It's been very quite here in regard to Yad.
It gets quietly used here :D.
Did a redo of pburn using it recently just to try out various options.

Thanks for the update and supporting it and not being trapped in the box :)

mike
Last edited by mikeb on Sat 07 Dec 2013, 08:20, edited 1 time in total.

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

#64 Post by L18L »

Did work on a "redo of pmount" ymount http://www.murga-linux.com/puppy/viewto ... &start=101 long time ago

Thanks for the update.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#65 Post by mikeb »

Ah ymount...neat. ..playing with it now.

Did not know about yad when I rewrote pmount ... ended up around 3k and auto refreshing and faster but remained gtkdialog3...recently used that desktop widget thingy to make pseudo icons with it along with a revitalised mut for the backend .. was not sure if I could do it with yad but perhaps I could revisit it.

mike

Post Reply