Is there a try container for own scripts?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
puppy_apprentice
Posts: 299
Joined: Tue 07 Feb 2012, 20:32

Is there a try container for own scripts?

#1 Post by puppy_apprentice »

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: Select all

#!/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
Attachments
pic2.png
save as...
(6.03 KiB) Downloaded 279 times
pic1.png
shows code snippet
(16.51 KiB) Downloaded 280 times

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

#2 Post by SFR »

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: Select all

#!/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!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
puppy_apprentice
Posts: 299
Joined: Tue 07 Feb 2012, 20:32

#3 Post by puppy_apprentice »

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: Select all

/usr/bin/gtrayicon

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#4 Post by musher0 »

Hi puppy_apprentice.

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

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

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
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
puppy_apprentice
Posts: 299
Joined: Tue 07 Feb 2012, 20:32

#5 Post by puppy_apprentice »

"Try container"? Is this a new synonym for "back-up"? Smile
I was thinking about:
https://en.wikipedia.org/wiki/Intermodal_container
;)

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

Let the light side of the Force be with you both!

s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

#6 Post by s243a »


User avatar
puppy_apprentice
Posts: 299
Joined: Tue 07 Feb 2012, 20:32

#7 Post by puppy_apprentice »

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.

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

Re: Is there a try container for own scripts?

#8 Post by MochiMoppel »

puppy_apprentice wrote: I can add a button to the jwm app bar
Certainly
but a try container will be much better
Why would this be better?
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"?

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#9 Post by musher0 »

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
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
puppy_apprentice
Posts: 299
Joined: Tue 07 Feb 2012, 20:32

#10 Post by puppy_apprentice »

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(?).
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.

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

#11 Post by technosaurus »

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 [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#12 Post by musher0 »

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
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
puppy_apprentice
Posts: 299
Joined: Tue 07 Feb 2012, 20:32

#13 Post by puppy_apprentice »

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
Attachments
temp3.png
(66.97 KiB) Downloaded 104 times

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#14 Post by musher0 »

Posted in error. Sorry.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Post Reply