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
fredx181
Posts: 4448
Joined: Wed 11 Dec 2013, 12:37
Location: holland

#796 Post by fredx181 »

A L A R M !! :lol: :lol:
Image

Hi, no need to be alarmed :wink: it's just about a new alarm script (attached) with changes and improvements.
Mostly focused on being able to cancel and stop the alarm even in case of multiple alarms.
Also tried putting together the ideas and suggestions into it, e.g.
- Repeat can be set to 0, which means infinite
- Tray icon will change from "waiting" icon to "running" icon when the alarm sound starts playing.
- The alarm can be shut off (once running) by right-click the icon > Stop alarm and exit tray
- The GUI a little changed
@Argolance, would be nice if you change to your liking and share (the big alarm clock icon you showed is nice), if you want of course.
Note in case you will translate, there's one function depending on "Set to" phrase: Alarm is running in the background... Set to $hr:$mn Changing "Set to" may make canceling fail. (don't know if is important, just mentioning)
@misko, thanks for "at" recommendation, maybe comes in handy for later.
@vovchik, I initially wanted to use your .svg icon setup with the "Argolance" icons, but found that on one of my systems, they show as empty (transparent) image, any idea why ?
EDIT: Few minutes later, re-attached, made small change on the GUI.

EDIT 2019-12-05: Canceling from tray needed a fix, should work now, re-attached.
See also here:
http://murga-linux.com/puppy/viewtopic. ... 88#1043688

Fred
Attachments
yalarm.tar.gz
yad alarm updated 2019-12-05 , extract and run yalarm
(2.73 KiB) Downloaded 175 times
2019-12-02-184318_680x179_scrot.png
yalarm
(31.5 KiB) Downloaded 835 times
Last edited by fredx181 on Thu 05 Dec 2019, 10:37, edited 1 time in total.

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

#797 Post by vovchik »

Dear Fred,

Good question why the argolance SVGs show up blank on that machine. Is in a compositing "feature" or alpha-channel problem with the Xorg? I've not experienced it before, but it could be that the gdk_pixbuf_loader (which normally handles icon loading within gtk progs) on that system only partially supports svgs, or the yad there was compiled without cairo? I am just speculating.... Weird.

With kind regards,
vovchik

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

#798 Post by fredx181 »

Hi vovchik, just for info, it's on the same computer, same yad version, but diiferent Debian version (Buster, on Stretch it works fine), it's not only with yad, btw, with viewnior (image viewer) its shows empty too.
All the other "pre-made" .svg's from you are showing correctly on Buster, btw. Weird indeed... Not a complaint or big problem, just like to understand why. I'll test some more later.

Fred

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

#799 Post by Argolance »

Hello,
Thank you fredx181!
Sorry I didn't answer earlier, but I wasn't home.

Code: Select all

(yad:12506): GLib-WARNING **: g_strcompress: trailing \
I saw somewhere on the web that this warning is a result of wrong command line which must be escaped in a bash fashion. :roll:
When I cancel tray and exit from the right click menu, the systray icon is closed but the process not... and the bells ring!
As for internationalization, this time I'll wait a little while for the script to be fully finalized. :wink:

[EDIT] Additional question:
Now, to understand how YAD works (for me it is still largely mysterious because the logic is very "special"...), how to move the Set command

Code: Select all

'bash -c "alrm %1 %2 %3 %4 %5 %6 %7 %8 %9"'
to a usual "OK" button placed down the window, close to a "Cancel" one?

Thanks.
Cordialement.

Cordialement.

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

#800 Post by fredx181 »

Hi Argolance,
(yad:12506): GLib-WARNING **: g_strcompress: trailing \
Yes, thats because of a small mistake I made in the yad code, part of the GUI code at the bottom should be this:

Code: Select all

yad --plug="$$" --tabnum=1 --form --cycle-read --columns=2 --field="\t\t\t\t\Current Time:\t\t: " --field="               \t\t\t\t\t\t:lbl" &
(without extra \ after \t\t\t\t\t\t)
But it's just a warning, as far as I know it doesn't affect how things work.
When I cancel tray and exit from the right click menu, the systray icon is closed but the process not... and the bells ring!
Strange... works ok for me, I guess you mean right-click on the "waiting" icon and "Cancel Alarm and Exit tray"
I tested just now in Xenialpup also and works well for me.
Could be that you edited things in script (e.g. for translation) ?
Now, to understand how YAD works (for me it is still largely mysterious because the logic is very "special"...), how to move the Set command
Code:
'bash -c "alrm %1 %2 %3 %4 %5 %6 %7 %8 %9"
to a usual "OK" button placed down the window, close to a "Cancel" one?
Yeah, sure,"special", it should be possible to move the Set button to a usual "OK" button placed down the window, but then it will close the dialog (which I prefer not to) and also requires a completely different setup AFAIK to get all the variables from the fields.

EDIT:
but then it will close the dialog
that may be wrong :?:

Fred
Last edited by fredx181 on Wed 04 Dec 2019, 19:10, edited 1 time in total.

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

#801 Post by fredx181 »

Hi all, another change to the alarm script, included now the earlier suggestion for setting "relative" time (thanks vovchik), attached yalarm2
(the config file is different: ~/.yalrm2, so not compatible with earlier versions).

EDIT 2019-12-05: Canceling from tray needed a fix, should work now, re-attached.
See also here:
http://murga-linux.com/puppy/viewtopic. ... 88#1043688

Fred
Attachments
yalarm2.tar.gz
yad alarm updated 2019-12-05, extract and run yalarm2
(3.01 KiB) Downloaded 174 times
2019-12-04-191247_686x218_scrot.png
yalarm2 with relative time option
(46.08 KiB) Downloaded 655 times
Last edited by fredx181 on Thu 05 Dec 2019, 10:40, edited 1 time in total.

dancytron
Posts: 1519
Joined: Wed 18 Jul 2012, 19:20

#802 Post by dancytron »

fredx181 wrote:A L A R M !! :lol: :lol:
Image

Hi, no need to be alarmed :wink: it's just about a new alarm script (attached) with changes and improvements.
/snip

Fred
Thank God. Finally a decent alarm clock that doesn't take 100 meg of dependencies.

I've literally been using a 7 hour long countdown video I downloaded off of youtube that plays music after 7 hours.

I will install immediately and report back.

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#803 Post by slavvo67 »

Well, you didn't report back so I guess you overslept and the alarm didn't work. LOL

dancytron
Posts: 1519
Joined: Wed 18 Jul 2012, 19:20

#804 Post by dancytron »

slavvo67 wrote:Well, you didn't report back so I guess you overslept and the alarm didn't work. LOL
The big test is tomorrow morning. :D

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

#805 Post by fredx181 »

Argolance wrote:When I cancel tray and exit from the right click menu, the systray icon is closed but the process not... and the bells ring!
Now I could reproduce that, but it's only sometimes that the canceling doesn't work, can't understand why yet, will look for a fix.

EDIT: The solution was actually quite simple, previously the code for cancelling was too complicated and therefore fragile, should be OK now, re-attached here:
http://murga-linux.com/puppy/viewtopic. ... 15#1043415
and here (v2):
http://murga-linux.com/puppy/viewtopic. ... 29#1043629

Fred

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

#806 Post by Argolance »

Bonjour,
:arrow: [EDIT]: yalrm 0.5.1

Cordialement.
Last edited by Argolance on Fri 20 Dec 2019, 16:49, edited 2 times in total.

dancytron
Posts: 1519
Joined: Wed 18 Jul 2012, 19:20

#807 Post by dancytron »

fredx181 wrote:Hi all, another change to the alarm script, included now the earlier suggestion for setting "relative" time (thanks vovchik), attached yalarm2
(the config file is different: ~/.yalrm2, so not compatible with earlier versions).

EDIT 2019-12-05: Canceling from tray needed a fix, should work now, re-attached.
See also here:
http://murga-linux.com/puppy/viewtopic. ... 88#1043688

Fred
This is working great for me.

Is a snooze button (ideally the space bar but choosing from the task bar would be okay too) with a settable duration possible?

stemsee

#808 Post by stemsee »

Thanks Argolance

yalrm works well on dpupbuster64_8.0.0

User avatar
josejp2424
Posts: 556
Joined: Sun 01 Aug 2010, 22:35
Contact:

yalrm-gettex

#809 Post by josejp2424 »

Argolance wrote:Bonjour,
Here is yalrm 0.2 which incorporates the latest changes made by fredx181 without the countdown since other programs :arrow: like this one for example already exist.
I added the "Frequency" option which allows you to set the blinking (from 0.1 to 2 seconds) according to the type of icons you choose: 5 themes are available.
Internationalized: fr

[EDIT]: if already existing, the hidden /root/.yalrm file must be deleted for the script to run properly because it creates a directory with the same name at startup.

Cordialement.
hi Argolance.

It is very good.
there would be the possibility of adding gettex?.

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

#810 Post by Argolance »

Bonjour,
josejp2424 wrote:there would be the possibility of adding gettex?.
Yes obviously: the script is internationalized using gettext and the pot file is /usr/share/doc/2PDE/yalrm/yalrm.pot (I note I should have put it to /usr/share/doc/nls/yalrm) :oops: .
Thanks.

Additional note regarding the countdown option: I forgot to mention the excellent :arrow: pTiming by zigbert for "relative" time alarm.

Cordialement.

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

#811 Post by Argolance »

Bonjour,
Does anyone know how to have the standard yad buttons labels (ok, cancel, yes, no, close, quit, etc...) in the user's language? The old versions of yad did it right!
___________________________________________________
Something else, for those who would be interested in a way of customizing yad windows and widgets, :arrow: I found this...

Image
Cordialement.

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

Re: Alarm script

#812 Post by fredx181 »

dancytron wrote:
fredx181 wrote:Hi all, another change to the alarm script, included now the earlier suggestion for setting "relative" time (thanks vovchik), attached yalarm2
(the config file is different: ~/.yalrm2, so not compatible with earlier versions).

EDIT 2019-12-05: Canceling from tray needed a fix, should work now, re-attached.
See also here:
http://murga-linux.com/puppy/viewtopic. ... 88#1043688

Fred
This is working great for me.

Is a snooze button (ideally the space bar but choosing from the task bar would be okay too) with a settable duration possible?
I'm not sure if it's what you're looking for, but I added some sort of pause options to the "alarm running" icon menu.

Also made other improvements:
Now in any case when choosing Stop... from menu, the sound will stop immediately, also when selecting pause (but named "Stop alarm and restart after ... min", to avoid confusion)
Added 'Info' to "waiting" tray-icon menu with some explanation about duration interval etc..
Fixed that everytime when the function "alrm" (inside script) runs, that the process hangs, even when it seems to be finished (resulted in many zombie processes if you ran the script several times)

Fred
Attachments
2019-12-14-001220_771x460_scrot_671x400.jpg
(56.77 KiB) Downloaded 737 times
yalarm3.tar.gz
yalarm3
(3.86 KiB) Downloaded 155 times

achim
Posts: 48
Joined: Thu 13 Apr 2017, 19:36
Location: Germany

Manpages with yad

#813 Post by achim »

Hello experts,

the following script for displaying the man page via YAD works quite well so far. However, I would like to color the background of the browser page (something like this: # fef1e0). So far I have no working idea. So I want to ask if any of you have a suggestion.

Thank you in advance.

achim

Code: Select all

#! /bin/bash
#
function close_exit () {
    echo "close and exit"
    kill -s SIGUSR1 $YAD_PID
}
#
cd /usr/bin
brows="x-www-browser -new-tab"
asked="$1"
help="
Enter a command here for help on the function and options:"
m_del="/tmp/mpage"
if [[ -f "${m_del}" ]]; then
rm -f /tmp/mpage
fi
#
function y_brow () {
	/usr/bin/man $asked > /tmp/mpage
	$brows /tmp/mpage
}
export -f y_brow
while [ ! -n "$asked" ]
	do asked=$(yad --text="  $help" --entry --title="  Linux instructions" --width=500 --height=250  \
	--borders=10 --image=gtk-help --image-on-top --center --window-icon="gtk-help" --separator="\n")
	
	if [ "$?" = "1" ]
		then
		exit 1
	fi
done
man $asked | yad --text-info --title="  Help file too $asked" --width=950 --height=850 --button="break up":1 --button="Send to browser":0 \
--borders=10 --image=gtk-help --image-on-top --center --window-icon="gtk-help" --fore="black" --back="#fef1e0" --separator="\n"

	acd=$(echo $?)									# Exit-Code auswerten
	
	if [[ $acd == 1 ]] || [[ $acd == 9 ]] || [[ $acd == 252 ]]; then	# Taste Abbrechen gedrückt || Skript-Ende mit [X] || Skript-Ende mit [Esc]
	bash -c close_exit &>/dev/null
	exit
	else
	y_brow
	bash -c close_exit &>/dev/null
	exit
fi
Last edited by achim on Sat 14 Dec 2019, 21:26, edited 1 time in total.

dancytron
Posts: 1519
Joined: Wed 18 Jul 2012, 19:20

Re: Alarm script

#814 Post by dancytron »

fredx181 wrote:
dancytron wrote:
fredx181 wrote:Hi all, another change to the alarm script, included now the earlier suggestion for setting "relative" time (thanks vovchik), attached yalarm2
(the config file is different: ~/.yalrm2, so not compatible with earlier versions).

EDIT 2019-12-05: Canceling from tray needed a fix, should work now, re-attached.
See also here:
http://murga-linux.com/puppy/viewtopic. ... 88#1043688

Fred
This is working great for me.

Is a snooze button (ideally the space bar but choosing from the task bar would be okay too) with a settable duration possible?
I'm not sure if it's what you're looking for, but I added some sort of pause options to the "alarm running" icon menu.

Also made other improvements:
Now in any case when choosing Stop... from menu, the sound will stop immediately, also when selecting pause (but named "Stop alarm and restart after ... min", to avoid confusion)
Added 'Info' to "waiting" tray-icon menu with some explanation about duration interval etc..
Fixed that everytime when the function "alrm" (inside script) runs, that the process hangs, even when it seems to be finished (resulted in many zombie processes if you ran the script several times)

Fred
Great. I'll test it out soon.

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

#815 Post by fredx181 »

dancytron wrote:Great. I'll test it out soon.
And...? You didn't sleep all those days, I guess :lol:

Anyway here's a new yalarm, with some changes made to the yad dialog (thanks Argolance ! , for the digital time display setup ) and more.

Fred
Attachments
2019-12-19-171733_765x404_scrot.png
yalarm
(82.98 KiB) Downloaded 633 times
yalrm.tar.gz
Extract and run yalarm inside "yalrm" folder
(41.42 KiB) Downloaded 184 times

Post Reply