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 Wed 21 Nov 2018, 08:30
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Is there a try container for own scripts?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [14 Posts]  
Author Message
puppy_apprentice


Joined: 07 Feb 2012
Posts: 219

PostPosted: Fri 05 Oct 2018, 10:10    Post subject:  Is there a try container for own scripts?  

In Puppy there is a firewall shield in the jwm try. When this shield is clicked via RMB a popup menu with several options is shown. I've made a script and i want to attach it to try. I can add a button to the jwm app bar but a try container will be much better. I mean try container as "do nothing app/applet" that will only serve as popup menu for my scripts.

For example i have a script that i use to store code snippets from internet:
Code:

#!/bin/sh
clip=$(xclip -selection clipboard -o)
gxmessage -name "Save clip" -nearmouse -buttons "SAVE:42,CANCEL:255" "$clip"
case $? in
  42) name=$(gxmessage -name "Save clip" -nearmouse -entry "Name of file")
      echo "$clip" > "$name" ;;
  *) echo "Operation Canceled" # or empty
esac
pic2.png
 Description   save as...
 Filesize   6.03 KB
 Viewed   248 Time(s)

pic2.png

pic1.png
 Description   shows code snippet
 Filesize   16.51 KB
 Viewed   248 Time(s)

pic1.png

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


Joined: 26 Oct 2011
Posts: 1679

PostPosted: Fri 05 Oct 2018, 11:10    Post subject:  

There are few choices that I'm aware of:

1. Simple Icon Tray: http://murga-linux.com/puppy/viewtopic.php?t=76431
2. Gtrayicon: http://gtrayicon.sourceforge.net/
3. YAD: https://sourceforge.net/projects/yad-dialog/

At least one of them should be available OOTB in every Puppy.

Here's an example with YAD, because its syntax is quite unusual.
I'm not YAD expert, btw, but I found the relevant code in some old script of mine:

Code:
#!/bin/sh

save_clip() {

   if which xclip >/dev/null 2>&1; then
      clip=$(xclip -selection clipboard -o)
   else
      clip=$(xsel --clipboard -o)
   fi

   gxmessage -name "Save clip" -nearmouse -buttons "SAVE:42,CANCEL:255" "$clip"

   case $? in
      42) name=$(gxmessage -name "Save clip" -nearmouse -entry "Name of file")
         echo "$clip" > "$name" ;;
      *) echo "Operation Canceled" # or empty
   esac

}

export -f save_clip

PIPE="/tmp/snippets_${USER}_${$}"
mkfifo "$PIPE"
exec 3<> "$PIPE"
trap 'echo "quit" >&3; rm -f "$PIPE"' EXIT

yad --notification --kill-parent --listen --image="gtk-save" --text="Save clip" --command="sh -c save_clip" <&3

Middle-click to exit.

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
puppy_apprentice


Joined: 07 Feb 2012
Posts: 219

PostPosted: Fri 05 Oct 2018, 12:53    Post subject:  

Thx SFR.

I've seen all the solutions on forum many times, but i forgot about them.
Gtrayicon is even a part of every (at least Slacko 5.7) Puppy:
Code:

/usr/bin/gtrayicon
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 13009
Location: Gatineau (Qc), Canada

PostPosted: Fri 05 Oct 2018, 14:34    Post subject:  

Hi puppy_apprentice.

"Try container"? Is this a new synonym for "back-up"? Smile

Just a reminder, not pulling your leg (well, maybe a little!):
back-ups have been around for a long, long while you know!!!

What I do when I wish to try something very experimental, I reboot my
Puppy with pfix=ram and create a second pupsave named "experiments"
(without the quotes).

Next boot, I load in pupsave "experiments". I test scripts or whatever in this
one. It is my "try container"! If something goes awfully wrong in pupsave
"experiments", I still have my main pupsave for regular computing.

An alternative is an horodated zip of your pupsave, say every 15 minutes
if you are doing intensive development.

As I said, it's a reminder.

More on the software side:
I devised a little script working from right-click that back-ups single scripts
that I am developing, which I find very convenient. If interested, holler? Smile

Finally, I hope you know that geany has an automatic back-up procedure. It
stores your drafts of anything in /root/my-documents/tmp. This feature is
already in geany's config panel, one just needs to activate it.

IHTH.

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
puppy_apprentice


Joined: 07 Feb 2012
Posts: 219

PostPosted: Fri 05 Oct 2018, 15:44    Post subject:  

Quote:
"Try container"? Is this a new synonym for "back-up"? Smile


I was thinking about:
https://en.wikipedia.org/wiki/Intermodal_container
Wink

English isn't my native language and sometimes i sound like Master Yoda.

Let the light side of the Force be with you both!
Back to top
View user's profile Send private message 
s243a

Joined: 02 Sep 2014
Posts: 1293

PostPosted: Fri 05 Oct 2018, 16:15    Post subject:  

On fatdog64 you can use:
http://distro.ibiblio.org/fatdog/web/faqs/sandbox.html
Back to top
View user's profile Send private message 
puppy_apprentice


Joined: 07 Feb 2012
Posts: 219

PostPosted: Fri 05 Oct 2018, 16:28    Post subject:  

Thx i will check this. I was seeking something similar to sandboxie on Windows.

But SFR solutions are what i need now an applet that will start my own scripts via RMB or LMB.
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1682
Location: Japan

PostPosted: Sat 06 Oct 2018, 07:12    Post subject: Re: Is there a try container for own scripts?  

puppy_apprentice wrote:
I can add a button to the jwm app bar
Certainly
Quote:
but a try container will be much better
Why would this be better?
Quote:
I mean try container as "do nothing app/applet" that will only serve as popup menu for my scripts.
I may not fully understand what you are looking for, but if all you need is a button that pops up a menu with your scripts, then why don't you use a button (JWM TrayButton) that pops up a custom menu (JWM menu)? Why do you feel that an additional application that permanently runs in the tray is "better"?
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 13009
Location: Gatineau (Qc), Canada

PostPosted: Sat 06 Oct 2018, 10:07    Post subject:  

Hi Puppy_Apprentice.

I re-read your first post, and you mean "tray" container, not "try" container,
I think. English is not my mother tongue either, which is why it took me a
little time to figure it out.

And probably a container in the tray, as well. Not a container that contains
the tray. Yes?

No offense intended, just trying to understand what you wish.

If so, besides the Custom Jwm Menu suggested above by MochiMoppei, you
may wish to look at aemenu and gtkmenu, to have your scripts easily at
hand.

One cannot put aemenu or gtkmenu in the tray, except complicated case, but
you can have one or the other of these menus (even both?!) as icons on the
desktop.

If interested, you may search this forum for work by former member aragon
on aemenu (he has called it "spm2") and gtkmenu (he has called it "spm3").
Plus work by myself and vovchik on aemenu only, however.

BFN.

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
puppy_apprentice


Joined: 07 Feb 2012
Posts: 219

PostPosted: Sat 06 Oct 2018, 12:23    Post subject:  

Yep it should be 'tray' not 'try' in my first post. SFR sensed context well and gave me good answer.

Some answers:

1) buton - it is permanent solution, on every machine i will have to edit .jwmrc-tray, and every script will need own button

2) gtrayicon - is portable, most (if not every puppy) has this program, i can store icons, menu files and my scripts on usb stick, and if i put on usb stick gtrayicon as well i could run it from not puppy derivative distro and others window managers as well(?).

Quote:

One cannot put aemenu or gtkmenu in the tray, except complicated case, but
you can have one or the other of these menus (even both?!) as icons on the
desktop.


You mean that if i want open my custom menu i have to click an icon on the desktop first. If yes i will have to minimize eg. internet browser first. With gtrayicon it isn't necessary.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4842
Location: Blue Springs, MO

PostPosted: Sat 06 Oct 2018, 14:13    Post subject:  

I haven't worked on it in a while (because I'm not happy with gtk), but there is my old Simple Icon Tray (sit)
_________________
Check out my github repositories. I may eventually get around to updating my blogspot.
Back to top
View user's profile Send private message Visit poster's website 
musher0

Joined: 04 Jan 2009
Posts: 13009
Location: Gatineau (Qc), Canada

PostPosted: Sat 06 Oct 2018, 14:36    Post subject:  

Hello, Puppy_Apprentice.

No, that is not what I mean. You have never used an alternative menu,
it seems.

But I'm giving up. Someone else, please continue. You are a nice person,
with a sense of humor, but it is too difficult for me to figure out what you
really want.

Do you want a menu from the tray, is that it?

Do you want access to your scripts? But which access?
-- launch your scripts from there?
or
-- only view them, as in your snapshot?

Do you want an easy back-up from this menu?

I am confused.

IMO, the simplest form of container for your scripts would be a sub-directory
with links to your scripts in it. Then bring the icon of this sub-directory on
the desktop. Your scripts will be 2 clicks away.
OR
an ae or gtk or Custom jwm menu, with your scripts listed in such menu.
Your scripts will be 2 clicks away also, same number of clicks as above.

As to methodology,
first build the menu (it does not matter which),
then
use technosaurus' sit
OR
there is a YAD for this also (its name is escaping me at the moment, but I
remember that it is resource-hungry).

Pursuing one thing at a time, defining one idea at a time, can only help!!

Sorry for being so frank.

Best regards from this tired fellow (aka "me").

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
puppy_apprentice


Joined: 07 Feb 2012
Posts: 219

PostPosted: Sat 06 Oct 2018, 16:31    Post subject:  

I've chosen one of SFR solutions - gtrayicon. This is why i write to SFR - thx. If you read SFR post, SFR gave me technosaurs SIT as example too.

This topic should be finished on post no 3, but you started asking me... ;p
temp3.png
 Description   
 Filesize   66.97 KB
 Viewed   72 Time(s)

temp3.png

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

Joined: 04 Jan 2009
Posts: 13009
Location: Gatineau (Qc), Canada

PostPosted: Sat 06 Oct 2018, 18:19    Post subject:  

Posted in error. Sorry.
_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [14 Posts]  
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.1217s ][ Queries: 13 (0.0373s) ][ GZIP on ]