Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 27 Feb 2020, 23:10
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
YAD - Tips
Post new topic   Reply to topic View previous topic :: View next topic
Page 55 of 56 [837 Posts]   Goto page: Previous 1, 2, 3, ..., 53, 54, 55, 56 Next
Author Message
Argolance


Joined: 06 Jan 2008
Posts: 3734
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Mon 09 Dec 2019, 08:12    Post subject:  

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


Cordialement.

_________________

A second life for your PCs...
Back to top
View user's profile Send private message Visit poster's website 
fredx181


Joined: 11 Dec 2013
Posts: 4289
Location: holland

PostPosted: Fri 13 Dec 2019, 19:15    Post subject: Re: Alarm script  

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.php?p=1043688#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
2019-12-14-001220_771x460_scrot_671x400.jpg
 Description   
 Filesize   56.77 KB
 Viewed   518 Time(s)

2019-12-14-001220_771x460_scrot_671x400.jpg

yalarm3.tar.gz
Description  yalarm3
gz

 Download 
Filename  yalarm3.tar.gz 
Filesize  3.86 KB 
Downloaded  44 Time(s) 

_________________
Dog Linux website
Tinylinux blog by wiak
Back to top
View user's profile Send private message 
achim

Joined: 13 Apr 2017
Posts: 48
Location: Germany

PostPosted: Sat 14 Dec 2019, 15:02    Post subject: Manpages with yad  

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:

#! /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, 17:26; edited 1 time in total
Back to top
View user's profile Send private message 
dancytron

Joined: 18 Jul 2012
Posts: 1479

PostPosted: Sat 14 Dec 2019, 15:58    Post subject: Re: Alarm script  

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.php?p=1043688#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.
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 4289
Location: holland

PostPosted: Thu 19 Dec 2019, 12:34    Post subject:  

dancytron wrote:
Great. I'll test it out soon.

And...? You didn't sleep all those days, I guess Laughing

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
2019-12-19-171733_765x404_scrot.png
 Description   yalarm
 Filesize   82.98 KB
 Viewed   399 Time(s)

2019-12-19-171733_765x404_scrot.png

yalrm.tar.gz
Description  Extract and run yalarm inside "yalrm" folder
gz

 Download 
Filename  yalrm.tar.gz 
Filesize  41.42 KB 
Downloaded  54 Time(s) 

_________________
Dog Linux website
Tinylinux blog by wiak
Back to top
View user's profile Send private message 
dancytron

Joined: 18 Jul 2012
Posts: 1479

PostPosted: Thu 19 Dec 2019, 12:56    Post subject:  

Sorry, it worked fine.

Will install the new version.
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 3734
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Fri 20 Dec 2019, 05:18    Post subject:  

Bonjour,
Here are the internationalized version of yalarm script above, the *.pot and the French *.mo files.
Translations welcome!

Exclamation [EDIT]: Sorry, missing
Code:
. gettext.sh

at line 147 to get the text of the popup window...

Cheers!
yalarm-script_pot_mo-fr.tar.gz
Description  Fixed
gz

 Download 
Filename  yalarm-script_pot_mo-fr.tar.gz 
Filesize  7.01 KB 
Downloaded  40 Time(s) 
191220_100602_792x391_easyshot.jpg
 Description   
 Filesize   37.45 KB
 Viewed   341 Time(s)

191220_100602_792x391_easyshot.jpg


_________________

A second life for your PCs...
Back to top
View user's profile Send private message Visit poster's website 
Argolance


Joined: 06 Jan 2008
Posts: 3734
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Fri 20 Dec 2019, 12:41    Post subject:  

Bonsoir,
To understand and learn how some yad options work, I played with yalarm and made this version that fredx181 was kind enough to modify according to the latest improvements of its script.
Merci.

Cordialement.
191212_225233_1064x611_easyshot.jpg
 Description   
 Filesize   108.48 KB
 Viewed   314 Time(s)

191212_225233_1064x611_easyshot.jpg

yalrm-0.5.1.pet
Description 
pet

 Download 
Filename  yalrm-0.5.1.pet 
Filesize  119.97 KB 
Downloaded  53 Time(s) 

_________________

A second life for your PCs...
Back to top
View user's profile Send private message Visit poster's website 
Mike Walsh


Joined: 28 Jun 2014
Posts: 5910
Location: King's Lynn, UK.

PostPosted: Sat 21 Dec 2019, 10:55    Post subject:  

Afternoon, all.

Now then; I need a wee bit of instruction here, please.

I use variations on the following script to place icons in the 'system-tray' area, in order to have commonly-used items permanently available:-

Code:
#!/bin/sh
#
#YAD 'one-liner' from musher0 / fredx181, to place executable tray icon in notification area
#
yad --notification --text="Brightness control" --command='./usr/local/bin/Bright' --image='/usr/local/lib/X11/pixmaps/Bright.png' 2>/dev/null


Which works very well for what I want it for.

What I would like to know is:-

What would be the easiest way possible to add a simple right-click command to this? All I want to be able to do is to right-click the tray icon, have 'Quit' (or 'Leave', or 'Exit', or something along those lines come up), and click on it, so that the tray-icon will then disappear again.

I found this thread from Stu91 (from several years back):-

http://www.murga-linux.com/puppy/viewtopic.php?t=81841&sid=ec6b8dc7cf969983f3aac11604b53c46

.....but it's rather too much like overkill for my needs. I simply want a right-click 'Quit' function. I've been trawling the 'net for a couple of hours or more, and can't really find anything that'll help; most of the stuff I'm getting up seems to be all about adding commands to an existing right-click context menu in the various Linux file-managers.....

Any advice/assistance will, as always, be very much appreciated. TIA.


Mike. Wink

_________________
MY 'PUPPY' PACKAGES

Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 4289
Location: holland

PostPosted: Sat 21 Dec 2019, 12:05    Post subject:  

Hi Mike, something like this ?

Using a named pipe and added --listen and --no-middle to the notification command.
(without --no-middle the icon quits by mouse middle click)
Code:
#!/bin/sh

# function quit_tray
quit_tray () {
# quit tray
echo "quit" > $PIPE
# cleanup, remove $PIPE
rm -f $PIPE
}; export -f quit_tray

# create PIPE
export PIPE="/tmp/Y_NOTI_BRIGHT.$RANDOM"
mkfifo $PIPE

# attach a file descriptor to the file
exec 3<> $PIPE

# send menu to $PIPE
echo menu:"Quit!bash -c quit_tray!gtk-quit" >$PIPE &

yad --notification --listen --no-middle --text="Brightness control" --command='./usr/local/bin/Bright' --image='/usr/local/lib/X11/pixmaps/Bright.png' <&3


To make more menu entries it would be something like:
Code:
echo menu:"Quit!bash -c quit_tray!gtk-quit| \
NAME!COMMAND!ICON| \
NAME!COMMAND!ICON" >$PIPE &


EDIT: Just thought that it can be much more simple with --menu option, so then as a one-liner only:
Code:
yad --notification --item-separator=":" --no-middle --text="Brightness control" --command='./usr/local/bin/Bright' --image='/usr/local/lib/X11/pixmaps/Bright.png' --menu="Quit:quit:gtk-quit"


Fred

_________________
Dog Linux website
Tinylinux blog by wiak
Back to top
View user's profile Send private message 
Mike Walsh


Joined: 28 Jun 2014
Posts: 5910
Location: King's Lynn, UK.

PostPosted: Sat 21 Dec 2019, 14:38    Post subject:  

Hiya, Fred.

fredx181 wrote:
Hi Mike, something like this ?

Using a named pipe and added --listen and --no-middle to the notification command.
(without --no-middle the icon quits by mouse middle click)
Code:
#!/bin/sh

# function quit_tray
quit_tray () {
# quit tray
echo "quit" > $PIPE
# cleanup, remove $PIPE
rm -f $PIPE
}; export -f quit_tray

# create PIPE
export PIPE="/tmp/Y_NOTI_BRIGHT.$RANDOM"
mkfifo $PIPE

# attach a file descriptor to the file
exec 3<> $PIPE

# send menu to $PIPE
echo menu:"Quit!bash -c quit_tray!gtk-quit" >$PIPE &

yad --notification --listen --no-middle --text="Brightness control" --command='./usr/local/bin/Bright' --image='/usr/local/lib/X11/pixmaps/Bright.png' <&3


To make more menu entries it would be something like:
Code:
echo menu:"Quit!bash -c quit_tray!gtk-quit| \
NAME!COMMAND!ICON| \
NAME!COMMAND!ICON" >$PIPE &


Fred


I like option 2, mate. With a head like mine, 'simple' is good, in my book..! Laughing

No, the modified 'one-liner' is exactly what I was looking for. It means that for some of my commonly-used tray 'utilities', if I don't want 'em there permanent, like, I can just dismiss 'em when I want to.

I want to re-build a few of my small 'tray-based' utilities as ROX-Apps - using your build-scripts - so I can dismiss 'em when required, in the same way that I can clear bigger self-extracters/portables by clicking the window 'X' (or click 'Cancel', or 'Quit' if it exists in the app itself).

Until now, the only way to get rid of the tray icon has been to re-start 'X'.....which isn't always convenient (especially if you're in the middle of summat important, y'know)? I remember I rebuilt a couple of 'em with a pinstall.sh for greengeek, but the way he runs his custom Slacko 560 is as a permanent 'Live' session, never saving except to external media.....so for him it all resets at every boot anyway.

Looking at stu91's script, I didn't think the one-liner could be quite that simple. That is very much appreciated.

Thanks, Fred!


Mike.

_________________
MY 'PUPPY' PACKAGES

Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 4289
Location: holland

PostPosted: Sat 21 Dec 2019, 15:02    Post subject:  

You're welcome Mike !

Quote:
Until now, the only way to get rid of the tray icon has been to re-start 'X'

Just for info, if you have a middle mouse button (scroll wheel) then you can always quit the tray icon by 'middle' clicking on it.
(that is: if the yad --notification command is without the --no-middle option).

Fred

_________________
Dog Linux website
Tinylinux blog by wiak
Back to top
View user's profile Send private message 
Mike Walsh


Joined: 28 Jun 2014
Posts: 5910
Location: King's Lynn, UK.

PostPosted: Sat 21 Dec 2019, 15:31    Post subject:  

@ Fred:-

fredx181 wrote:
Just for info, if you have a middle mouse button (scroll wheel) then you can always quit the tray icon by 'middle' clicking on it.
(that is: if the yad --notification command is without the --no-middle option).


A-ha. Nope, I wasn't aware of that. Shall have to experiment in a few of the other Pups.....see what happens.

Thanks for the tip.


Mike. Wink

_________________
MY 'PUPPY' PACKAGES

Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 4289
Location: holland

PostPosted: Sat 21 Dec 2019, 15:55    Post subject:  

Hi All, Re: Alarm again Smile

As I like the themed version by Argolance and want to be able to use setting alarm to "relative" time (checkbox 'Set alarm after minutes/seconds') , I modified his version (hope you don't mind Argolance !).
Because of adding 3 more fields for that, I went for the horizontal view (otherwise the height would be too large).

Fred
yalrm-0.6.0.pet
Description 
pet

 Download 
Filename  yalrm-0.6.0.pet 
Filesize  118.72 KB 
Downloaded  49 Time(s) 
2019-12-21-203436_741x369_scrot.png
 Description   
 Filesize   77.41 KB
 Viewed   213 Time(s)

2019-12-21-203436_741x369_scrot.png


_________________
Dog Linux website
Tinylinux blog by wiak
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 3734
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Sat 21 Dec 2019, 17:35    Post subject:  

Hello,
Quote:
(hope you don't mind Argolance !).

Absolutely not! On the contrary, this is very enjoyable and maybe the two versions will end up coming together, which would be the happiest ending! Wink

Cordialement.

_________________

A second life for your PCs...
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 55 of 56 [837 Posts]   Goto page: Previous 1, 2, 3, ..., 53, 54, 55, 56 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1341s ][ Queries: 12 (0.0694s) ][ GZIP on ]