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 21 Jun 2018, 16:37
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to place an executable icon in the systray area?[SOLVED]
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 4 [50 Posts]   Goto page: Previous 1, 2, 3, 4 Next
Author Message
greengeek


Joined: 20 Jul 2010
Posts: 5054
Location: Republic of Novo Zelande

PostPosted: Mon 12 Mar 2018, 03:11    Post subject:  

Mike Walsh wrote:
Hi, DJ.

Mm. I know where you're coming from; that'll put a 'clickable' icon in the left-side 'launcher' area.....which is not quite what I want.

According to /root/.jwmrc-tray, I need my icon to be over on the right-hand side, among all that <Swallow> and 'Blinky' stuff (which I can't make head or tail of, I'm afraid).....

What I'm after is the method by which a GTK app will place an icon in the 'system' tray area, on the right-hand side of the tray. Scripting is not my strong point, though I'm slowly getting there..!


Mike. Wink
Hi Mike, I would like to understand your terminology. Are you able to post an image showing what you consider the left and right areas to be? "System tray" is a windows construct.

I view it this way:
The left side of the tray is for launching.
The right side of the tray is for displaying info.

Do i have this wrong?

What are you wanting to do on the right hand side?

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


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

PostPosted: Mon 12 Mar 2018, 04:06    Post subject:  

Hi, greengeek.

Technically, on Linux, I believe it is called the "notification area". Not that the area in itself
is really "notifying" the user of anything, it's just there.

Maybe an expression like "active icons area" would be more telling. It is obviously an area;
there are icons there; they all do an action when the user clicks on them. For some, that
action is a notification to the user. (We linguists do know how to split hairs, don't we?)

Just a thought.

BFN.

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3099
Location: holland

PostPosted: Mon 12 Mar 2018, 06:16    Post subject:  

Hi Mike and all,

Mike, can you run the "tray icon" script in terminal and see if there are errors ?

Assuming your path for the icon at TRAY_ICON= and the path for command in "on_click" function are correct, I can't understand why it wouldn't work for you. Rolling Eyes

One important thing for this line:
Code:
export PIPE=$(mktemp -u --tmpdir ${0##*/}.XXXXXXXX)

It may work on most systems, but better change to:
Code:
export PIPE=$(mktemp -u /tmp/${0##*/}.XXXXXXXX)

Some puppies (or most ?) use busybox mktemp , it doesn't have the "--tmpdir" option and it will fail.
(just found out by testing on D-pup-Stretch, which does indeed use busybox mktemp)
EDIT: Edited my above posts by changing this in the code, also just received a PM from someone (thanks!) with confirmation that the problem was because of that earlier line.

About the backslashes at the "yad --notification" command, these are just common use for to give better overview (specially for long commands) but may give problems when doing copy and paste, so can be this (oneliner) as well:
Code:
yad --notification --kill-parent --text="$POPUP_TEXT" --listen --image="$TRAY_ICON" --text="$POPUP_TEXT" --command="bash -c on_click" <&3


Worth trying to change to the above and see if it works then.

Fred

_________________
Dog Linux website
Back to top
View user's profile Send private message 
stemsee

Joined: 27 Jun 2013
Posts: 2208
Location: In The Way

PostPosted: Mon 12 Mar 2018, 07:56    Post subject:  

musher0 wrote:
Hi, greengeek.

Technically, on Linux, I believe it is called the "notification area". Not that the area in itself
is really "notifying" the user of anything, it's just there.

Maybe an expression like "active icons area" would be more telling. It is obviously an area;
there are icons there; they all do an action when the user clicks on them. For some, that
action is a notification to the user. (We linguists do know how to split hairs, don't we?)

Just a thought.

BFN.


How then does 'active icons area' differ to the desktop?
Back to top
View user's profile Send private message MSN Messenger 
musher0


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

PostPosted: Mon 12 Mar 2018, 08:35    Post subject:  

stemsee wrote:
musher0 wrote:
Hi, greengeek.

Technically, on Linux, I believe it is called the "notification area". Not that the area in itself
is really "notifying" the user of anything, it's just there.

Maybe an expression like "active icons area" would be more telling. It is obviously an area;
there are icons there; they all do an action when the user clicks on them. For some, that
action is a notification to the user. (We linguists do know how to split hairs, don't we?)

Just a thought.

BFN.


How then does 'active icons area' differ to the desktop?

I wish I knew!!!! Laughing

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1538
Location: Japan

PostPosted: Mon 12 Mar 2018, 09:00    Post subject:  

stemsee wrote:
How then does 'active icons area' differ to the desktop?

Let's forget 'active icons area'. The notification area, which JWM refers to as "Dock", may contain icons and these icons may be clickable, but this is not a requirement. I run a script in the notification area that keeps track of the battery status. Looks like the clock, no icon and definitely not clickable,

Simply speaking: Desktop and notification area are owned by the window manager. The WM runs programs either windowed on the desktop or windowless in the notification area.
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3099
Location: holland

PostPosted: Mon 12 Mar 2018, 09:34    Post subject:  

There was request through PM to clarify (thought I post my answer here also)
Quote:
Re the line:
Code:
## ... do some more if desired


would you be so kind as to expand upon its meaning and how it works


You can put several commands after each other in the function on_click, e.g.
Code:
function on_click() {
# Execute program
command1
# ... do some more if desired
command2
# again one more
command3
}
export -f on_click   



In this case command2 will run when command1 has exited, but for example to run command2 while command1 is still busy, run it in the background with a "&" :

Code:
command1 &



Hope this clarified.

Fred

_________________
Dog Linux website
Back to top
View user's profile Send private message 
musher0


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

PostPosted: Mon 12 Mar 2018, 09:55    Post subject:  

Fine. Thank you, fredx.

Could you use that left-click sub-routine to run another menu similar to what you have
at the "echo line"?

Or even have something for middle-click?

To prevent tendinitis in the wrist, I use a Logitech "Marble" track-ball

instead of a regular mouse, and it has left-click, right-click, middle-right-click and
middle-left-click. Some other computer mice have as many buttons or more.

Is it possible to configure a single yad icon to use all four buttons?
Is the yad utility limited in this respect?

TIA.

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
Mike Walsh


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

PostPosted: Mon 12 Mar 2018, 10:22    Post subject:  

Right then, boys & girls. I see y'all have been busy in my absence.... Very Happy

Let's see if I can answer these posts in some kind of order.

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

@fredx181:-

Running the script as is, from the terminal, produces absolutely no output at all. However, the terminal won't return to the prompt; it just sits there, with the cursor blinking at me, mid-stride (as it were)...

I've moved things around a bit; icon now lives in /usr/local/share/icons (as suggested by some1), and the executable (my 'spot-to-root' script, now lives in /usr/local/bin.

Your script has been modified to reflect this.....including your suggested change from

Code:
export PIPE=$(mktemp -u --tmp/${0##*/}.XXXXXXXX)


...to:-

Code:
export PIPE=$(mktemp -u /tmp/${0##*/}.XXXXXXXX)


I've also added 'exec' to the executable's line (just to make sure this wasn't the problem)....thus:-

Code:
function on_click() {
# Execute program
exec /usr/local/bin/spot-to-root
## ... do some more if desired
}
export -f on_click


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

Now, then: running the modified script from urxvt now gives this output:-

Code:
# /root/Startup/S2R.sh
Usage: mktemp [-V] | [-dqtu] [-p prefix] [template]
BusyBox v1.21.0 (2013-02-18 15:57:06 WST) multi-call binary.

Usage: mkfifo [-m MODE] NAME

Create named pipe

   -m MODE   Mode (default a=rw)

/root/Startup/S2R.sh: line 24: $PIPE: ambiguous redirect


.....which refers to this line:-

Code:
exec 3<> $PIPE


Any suggestions? Just FYI, I'm doing all this in Slacko 570.

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

@musher0:-

I'll have a look at yr .pet in a wee while, and let ya know what (if anything) happens. Cheers.

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

@greengeek:-

Yah; I agree with your assessment. 'Systray' is a hangover from my Windoze days, it's true.

I want to place an icon in the notification area which, when clicked upon, will execute a small script. That's all I want it to do.

The script merely moves stuff from one directory to another, via an 'intermediate', temporary folder, changing ownership permissions as it does so. It then displays a small Zenity window to let me know the script has run successfully. I'm experimenting with Bash, and YAD/Zenity, and trying out something I thought of which was inspired by the way that current Chrome insists on running as 'spot'.

That all works fine if you click directly on my own script. It's getting it to run from an icon in the notification area that's proving to be, um.....problematic.

It seems it doesn't matter where I place my icon that I want to use for this, fred's script simply doesn't seem to want to pick it up. Yad insists on displaying its default 'green flask' icon instead. Mind you, I'm not blaming Fred; it's like as not my system is playing 'silly buggers' for some reason....

I was trying to base this on a small utility Bill (rcrsn51) wrote a few years ago to 'switch' Adobe's FlashPlayer 'on' or 'off', as required. He let me have his build-script and code for it, which I successfully modified to work with PepperFlash instead.

You click on the tray icon for it; it turns FlashPlayer off by simply appending the '.off' extension, so FlashPlayer isn't recognised, and changes the icon colour. You click on it again, ; it removes the '.off' extension, so FlashPlayer will work again, and resets the icon colour back to original.

Trouble is, I don't know enough about Bash & scripting in general yet (I stress yet) to be able to recognise which bits of the script are doing what! Oh, I recognise some of it.....but I can't 'read' the whole thing from start to finish of any given script. I don't understand the 'language' well enough at this point in time.....and I don't have as much time to spare as I would like, to be able to spend hours playing around & experimenting.

Stuff like 'pipe'; 'grep'; 'awk'; 'sed'....things like that; it's complete Greek to me. I'd like nothing better than to spend several hours at a time experimenting and teaching myself from the ground up.....but life gets in the way, doesn't it? So I try to pick up bits & pieces here and there as and when I can. Don't get me wrong; I can script stuff now that I could never have imagined doing when I started with Pup nearly 4 years ago. It's all good fun. We all have different learning curves with this kinda thing. Some folks pick it up as naturally as breathing. For others, it's a tooth-and-claw uphill struggle, every step of the way..!! Rolling Eyes Laughing Laughing

(Kinda describes me, I think...)


Mike. Wink

_________________
MY PUPPY PACKAGES | 'Thanks' are always appreciated!
--------------------------------------

Back to top
View user's profile Send private message Visit poster's website 
Mike Walsh


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

PostPosted: Mon 12 Mar 2018, 11:46    Post subject:  

Guys, I'm giving this up as a bad job.

I've tried this in half-a-dozen different Pups. In every single case, I get a 'green flask' in the notification area instead of my chosen icon.....and a total lack of anything happening when I click on that icon.

(@ musher:- Same lack of success using your modified script, mate.)

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

The script had a MenuEntry written for it a few days ago.

If I click direct on the script in /usr/local/bin.....it runs.

If I click on the MenuEntry....it runs.

If I put a shortcut for the MenuEntry in the launcher area, and click on that.....it runs.

But from the icon in the notification area.....nada. Zilch. Nowt 'appens. It appears to be working fine for everybody else.....but it just will not work for me..!

Can't work that one out. At all.

My best solution is to run it from the icon in the 'launcher area'. Not exactly what I wanted, but it'll have to do. For some reason, all variations of this script simply will not 'see' the executable and the icon on my systems.

Thanks for everybody's efforts; I'm really sorry to have wasted your time.


Mike. Embarassed

_________________
MY PUPPY PACKAGES | 'Thanks' are always appreciated!
--------------------------------------

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


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

PostPosted: Mon 12 Mar 2018, 12:28    Post subject:  

Hi Mike_Walsh.

You did something bad to that script while writing it, and now it's getting back at you! Laughing
It somehow knows you want it to run from the tray, but it's sticking its tongue at you: it will
work from anywhere else, but not from there, tra-lala! (This is a joke!) Smile

Welcome to the club!!! Wink (I too have a few scripts like that, who think they are funny!!!)

Seriously: have you made your script executable? As in
Code:
chmod +x script.sh
Sometimes we complicated bipeds forget about the simplest things...

BFN.

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
musher0


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

PostPosted: Mon 12 Mar 2018, 12:51    Post subject:  

Hello again folks.

I just found out that former member stu91 juggled with this before we did:
http://www.murga-linux.com/puppy/viewtopic.php?t=81841&sid=ec6b8dc7cf969983f3aac11604b53c46

BFN.

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3099
Location: holland

PostPosted: Mon 12 Mar 2018, 13:54    Post subject:  

@ Mike Walsh
Nooooo... !! Don't give up, you may be close to a solution !
I understand the frustration, though, sometimes things are so f*ckin' mysterious Wink
Seeing your output:
Code:
# /root/Startup/S2R.sh
Usage: mktemp [-V] | [-dqtu] [-p prefix] [template]

It looks like still something's going wrong with the mktemp command on your system.
(otherwise it wouldn't show it's usage info)
So instead of:
Code:
export PIPE=$(mktemp -u /tmp/${0##*/}.XXXXXXXX)

Try to make it simply (no mktemp command involved), just:
Code:
export PIPE="/tmp/S2R.$RANDOM"

EDIT: obviously, if the PIPE variable is not set properly, the mkfifo command (after that) will fail also.
(as it doesn't know the name of the named pipe to be created then)

@musher0
Quote:
Could you use that left-click sub-routine to run another menu similar to what you have
at the "echo line"?

Or even have something for middle-click?

To prevent tendinitis in the wrist, I use a Logitech "Marble" track-ball

instead of a regular mouse, and it has left-click, right-click, middle-right-click and
middle-left-click. Some other computer mice have as many buttons or more.

Is it possible to configure a single yad icon to use all four buttons?
Is the yad utility limited in this respect?


I don't think that sort of behavior can be changed from yad options.
(but I might be wrong, I'm no expert)

Fred

_________________
Dog Linux website

Last edited by fredx181 on Mon 12 Mar 2018, 15:22; edited 3 times in total
Back to top
View user's profile Send private message 
musher0


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

PostPosted: Mon 12 Mar 2018, 15:03    Post subject:  

Thanks, fredx.

~~~~~~~~~~~~~~

@all.

Related to the subject at hand, I wrote a bit of a rant, plus
hopefully a useful "sdesk" script here.

After studying and testing sdesk for the equivalent of a full
day, I finally managed to make it work... I had to recompile
it for 32-bit as well. Grrr.

Maybe give this "sdesk" a try, Mike_Walsh?

BFN.

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
puppy_apprentice


Joined: 07 Feb 2012
Posts: 184

PostPosted: Mon 12 Mar 2018, 15:44    Post subject:  

You can add your script to Parcellite actions menu. There is only one drawback - Parcellite icon will disappear, but if you click on area when you last saw it Parcellite will work as normal. When you reload graphical server it will appear again.

saveclips:
Code:

#!/bin/sh
strings /root/.local/share/parcellite/history
exit 0


There is option in new Parcellite for saving clips to txt file, but i use still original one from Salcko 5.7 Wink
parcellite_actions_2.jpg
 Description   Edit actions window
 Filesize   26.46 KB
 Viewed   61 Time(s)

parcellite_actions_2.jpg

parcellite_actions_1.jpg
 Description   Control + LMBC
 Filesize   9.99 KB
 Viewed   61 Time(s)

parcellite_actions_1.jpg

Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 4 [50 Posts]   Goto page: Previous 1, 2, 3, 4 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.1543s ][ Queries: 12 (0.0184s) ][ GZIP on ]