simple icon tray
Thank you, that clear up so much for me!
I was not aware of some of those naming conventions, for example, I usually start my pointer variable names with p.
So, I would (generally speaking) name bp, something like pBuffer.
Though I have renamed it buffer_pointer in this code. I am very keen to learn more about how this works and understand the 'C' way of dong things... I do use some similar things, and and I definitely use some C libraries, but there is a lot that is very different in the overall way things are done. I may very well have more questions, but unravelling the mystery of the variable names (and knowing the general naming conventions you use) will definitely help me to expand this later. It is also a good lesson in learning how C is different and gives me a glimpse into the strengths of C.
Thank you so much!!
I was not aware of some of those naming conventions, for example, I usually start my pointer variable names with p.
So, I would (generally speaking) name bp, something like pBuffer.
Though I have renamed it buffer_pointer in this code. I am very keen to learn more about how this works and understand the 'C' way of dong things... I do use some similar things, and and I definitely use some C libraries, but there is a lot that is very different in the overall way things are done. I may very well have more questions, but unravelling the mystery of the variable names (and knowing the general naming conventions you use) will definitely help me to expand this later. It is also a good lesson in learning how C is different and gives me a glimpse into the strengths of C.
Thank you so much!!
Well, I have successfully built this in a few situations and I have no errors!!
So, now for the basic question. How do I use this correctly with sdesk?
I have been looking at the code some and trying to figure out exactly what I need and where I need it... but I am a little stumped at how to include this with sdesk...
for my scripts that I have put in the panel I use the normal format of
sdesk -t /path/to/icon "tooltip" "exec" "" (unless I want a second action with the other click...)
as far as I know (from my blossoming understanding of C) your program dynamically generates the svg and tooltip files... however since I am using Ubuntu rather than Puppy there may be some things I need to modify (like the permission of the sit folder in HOME for example
Of course there is also no /mnt/save so I could do something else like /home
strcpyALL(fname,i,HOME, batt, ".tt");
So basically ~/.sit/BATT0.tt is this right?
and much the same for the svg.
Sorry if my questions sometimes seem elementary, I am still learning.
And again thank you for your efforts to help me!
So, now for the basic question. How do I use this correctly with sdesk?
I have been looking at the code some and trying to figure out exactly what I need and where I need it... but I am a little stumped at how to include this with sdesk...
for my scripts that I have put in the panel I use the normal format of
sdesk -t /path/to/icon "tooltip" "exec" "" (unless I want a second action with the other click...)
as far as I know (from my blossoming understanding of C) your program dynamically generates the svg and tooltip files... however since I am using Ubuntu rather than Puppy there may be some things I need to modify (like the permission of the sit folder in HOME for example
Of course there is also no /mnt/save so I could do something else like /home
strcpyALL(fname,i,HOME, batt, ".tt");
So basically ~/.sit/BATT0.tt is this right?
and much the same for the svg.
Sorry if my questions sometimes seem elementary, I am still learning.
And again thank you for your efforts to help me!
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
from the post with the latest tarball:
//http://murga-linux.com/puppy/viewtopi ... 677#714677
sdesk -t /path/to/BAT0.svg /path/to/BAT0.tt abiword geany [-t ...]
//http://murga-linux.com/puppy/viewtopi ... 677#714677
so the c program is running and spitting out .svg and .tt filestechnosaurus wrote: -i <include files>
-b <background imagge>
-t <status icon> <tooltip> <left click action> <right click action>
the -t option can be used multiple times,
sdesk -t /path/to/BAT0.svg /path/to/BAT0.tt abiword geany [-t ...]
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].
Hi,
thanks so much! in retrospect I feel that I was asking something rather silly
In my test of it, it seems to use about 4MB for proc2imgd and 3MB for sdesk. If I can get a full network monitor in there and not use much more RAM, this will be extremely useful for many reasons.
I really like the tooltip display, very handy! I would like to change the SVG though.
I am thinking it would be nice to have something of a configuration file for this battery program.... And if there is an icon theme in use use the network icons from that theme, or be able to specify a certain icon theme.
This way the program would be able to fit visually with a variety of colour schemes. If I have time to do anything with your program I will let you know... I have been very busy trying to finish up some things with my FLTK JWM settings program. It is starting to be very handy these days
thanks so much! in retrospect I feel that I was asking something rather silly
In my test of it, it seems to use about 4MB for proc2imgd and 3MB for sdesk. If I can get a full network monitor in there and not use much more RAM, this will be extremely useful for many reasons.
I really like the tooltip display, very handy! I would like to change the SVG though.
I am thinking it would be nice to have something of a configuration file for this battery program.... And if there is an icon theme in use use the network icons from that theme, or be able to specify a certain icon theme.
This way the program would be able to fit visually with a variety of colour schemes. If I have time to do anything with your program I will let you know... I have been very busy trying to finish up some things with my FLTK JWM settings program. It is starting to be very handy these days
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
When I run my compile, it uses about 4kb not Mb, but I have my own c implementation that I use.
I may set something up to use a configure directory with 1 setting per file. That makes changing individual settings easier and allows us to use inotify to change things on the fly like SIT/Sdesk do with icons and tooltips. Most programs use a single flat or xml file and thus have to parse and do logic for everything and resave or rerender everything any time one thing is changed... If you want to do many changes, you have to do them in batches or it ends up looking like Christmas lights. As long as the content of individual configuration files is less than 60 bytes, it doesn't even allocate more than a symlink. I already have the code for it in my C macros thread.
I may set something up to use a configure directory with 1 setting per file. That makes changing individual settings easier and allows us to use inotify to change things on the fly like SIT/Sdesk do with icons and tooltips. Most programs use a single flat or xml file and thus have to parse and do logic for everything and resave or rerender everything any time one thing is changed... If you want to do many changes, you have to do them in batches or it ends up looking like Christmas lights. As long as the content of individual configuration files is less than 60 bytes, it doesn't even allocate more than a symlink. I already have the code for it in my C macros thread.
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].
This sounds good to me. I have been pretty busy checking some other things out... mainly networking.
I know there is some code in there for showing a network indicator.. is frisbee the main networking program for Puppy?
I downloaded a version of it to look through. (not trying to hijack this thread). If there is a different networking program used in Puppy could you point me to it? I'd ultimately like to use sdesk for everything, as I don't like NetworkManager in a lightweight system. Wicd is not being maintained anymore, and there are not too many other options (in the Ubuntu repositories).
If I can adapt the Puppy scripts for Ubuntu, then I could potentially combine this with sdesk.
I do think it is already a simpler battery indicator than using a power management system, and it can be extended with other 'on click' actions.
I know there is some code in there for showing a network indicator.. is frisbee the main networking program for Puppy?
I downloaded a version of it to look through. (not trying to hijack this thread). If there is a different networking program used in Puppy could you point me to it? I'd ultimately like to use sdesk for everything, as I don't like NetworkManager in a lightweight system. Wicd is not being maintained anymore, and there are not too many other options (in the Ubuntu repositories).
If I can adapt the Puppy scripts for Ubuntu, then I could potentially combine this with sdesk.
I do think it is already a simpler battery indicator than using a power management system, and it can be extended with other 'on click' actions.
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
Because the GTK devs felt it necessary to write 2 additional event handlers for the status icon (popup and activate) instead of just using button press events.Argolance wrote:why no action is assigned to the middle button of the mouse?
Only by completely rewriting an alternative statusicon widget.Could this be possible and how?
FWIW GTK devs do this a lot (add extra code that reduces functionality)
... another example of such is GtkIconView. It could make a perfect desktop icon replacement in ~10 lines except that they added code to the widget itself that makes the background solid white... you can only change the color, not add a background image.
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].
A bureaucratic process has to be involved; otherwise the world be heading nowhere.technosaurus wrote:(...)
FWIW GTK devs do this a lot (add extra code that reduces functionality)
... another example of such is GtkIconView. It could make a perfect desktop icon replacement in ~10 lines except that they added code to the widget itself that makes the background solid white... you can only change the color, not add a background image.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)
- Argolance
- Posts: 3767
- Joined: Sun 06 Jan 2008, 22:57
- Location: PORT-BRILLET (Mayenne - France)
- Contact:
Bonsoir,
Thanks.
It is already the case and this is why the world is "heading nowhere"!
(I'm probably missing something, but I don't really see the connection with the subject of this thread).
Cordialement.
Thanks.
Why? Very strange indeed!: It is a pity...technosaurus wrote:FWIW GTK devs do this a lot (add extra code that reduces functionality)
Perhaps 'yad' could be used to make such a 'simple icon tray' and should offer more capabilities?Only by completely rewriting an alternative statusicon widget.
??musher0 wrote:A bureaucratic process has to be involved; otherwise the world be heading nowhere
It is already the case and this is why the world is "heading nowhere"!
(I'm probably missing something, but I don't really see the connection with the subject of this thread).
Cordialement.
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
Yad is also gtk based, so no.Argolance wrote:Perhaps 'yad' could be used to make such a 'simple icon tray' and should offer more capabilities?
Fltk doesn't have a tray icon widget.torios wrote:I like FLTK quite a bit, it keeps improving and making things easier, rather than removing functionality.
You can make very small programs easily with FLUID to design the UX.
Might be something for other posters here to consider.
tcl/tk does
qt does
I did find an old X11 example here :
Code: Select all
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <stdio.h>
typedef enum systray_opcode_tag {
SYSTEM_TRAY_REQUEST_DOCK = 0,
SYSTEM_TRAY_BEGIN_MESSAGE = 1,
SYSTEM_TRAY_CANCEL_MESSAGE = 2
} systray_opcode_t;
void send_message(
Display *disp,
Window dest,
systray_opcode_t message,
long data1,
long data2,
long data3)
{
XEvent ev;
memset( &ev, 0, sizeof(ev)) ;
ev.xclient.type = ClientMessage ;
ev.xclient.window = dest;
ev.xclient.message_type = XInternAtom( disp, "_NET_SYSTEM_TRAY_OPCODE", False );
ev.xclient.format = 32 ;
ev.xclient.data.l[0] = CurrentTime ;
ev.xclient.data.l[1] = message ;
ev.xclient.data.l[2] = data1 ;
ev.xclient.data.l[3] = data2 ;
ev.xclient.data.l[4] = data3 ;
/* XXX handle error XXX */
XSendEvent( disp, dest, False, NoEventMask, &ev) ;
XSync( disp, False) ;
}
int main()
{
Display *disp ;
Window tray ;
Window icon ;
Window container = None ;
GC gc ;
XEvent ev ;
int icon_size = 22 ;
disp = XOpenDisplay(NULL) ;
/* get system tray(as a embedder). */
/* XXX exec tray if it is nonexistent */
/* XXX assuming screen is 0 */
tray = XGetSelectionOwner( disp,
XInternAtom(disp, "_NET_SYSTEM_TRAY_S0", True) );
printf("tray window = %p\n", tray) ;
/* create system tray icon window */
icon = XCreateSimpleWindow( disp, DefaultRootWindow(disp),
0,0, icon_size,icon_size, 0, 0xFF,0x0);
printf("icon window = %p\n", icon) ;
/* select all of masks for debugging */
XSelectInput( disp, icon, (OwnerGrabButtonMask << 1) -1 );
/* create GC */
gc = XCreateGC( disp, icon, 0, NULL);
XSetForeground( disp, gc, 0xFF) ;
/* set minimum size */
{
XSizeHints *hints;
hints = XAllocSizeHints() ;
hints->flags = PMinSize ;
hints->min_width=icon_size;
hints->min_height=icon_size;
XSetWMNormalHints( disp, icon, hints);
XFree( hints);
}
/* set xembed infos */
{
Atom xa_xembed_info ;
unsigned int buffer[2];
xa_xembed_info = XInternAtom( disp, "_XEMBED_INFO", False) ;
buffer[0]=0; /* ver 0 (0:0?) */
buffer[1]=1; /* request mapping */
XChangeProperty( disp, icon, xa_xembed_info,
xa_xembed_info, 32, PropModeReplace,
(unsigned char *)buffer, 2);
}
/* request embedding */
send_message( disp, tray, SYSTEM_TRAY_REQUEST_DOCK, icon,0,0);
while(1){
XNextEvent( disp, &ev);
printf("type %d\n", ev.type);
switch(ev.type)
{
case Expose: /*12*/
XClearWindow( disp, icon);
XDrawLine( disp, icon, gc, 1,1, icon_size-1,icon_size-1) ;
printf("\texpose\n");
break;
case VisibilityNotify: /*15*/
printf("\tvisible\n");
break;
case MapNotify: /*19*/
printf("\tmapped\n");
break;
case ReparentNotify: /*21*/
printf("\twindow %p\n", ev.xreparent.parent);
break;
case ResizeRequest: /*25*/
printf("\twidth %d\n", ev.xresizerequest.width);
printf("\theight %d\n", ev.xresizerequest.height);
if( ev.xresizerequest.width > ev.xresizerequest.height)
icon_size = ev.xresizerequest.height ;
else
icon_size = ev.xresizerequest.width ;
XResizeWindow( disp, icon, icon_size, icon_size);
if(container)
XResizeWindow( disp, container, icon_size, icon_size);
break;
case PropertyNotify: /*29*/
printf("\tatom %s\n", XGetAtomName( disp, ev.xproperty.atom));
break;
case ClientMessage: /*33*/
printf("\twindow %p\n", ev.xclient.window);
printf("\ttype %s\n", XGetAtomName( disp, ev.xclient.message_type));
printf("\ttime 0x%X\n", ev.xclient.data.l[0]);
printf("\tmajor 0x%X\n", ev.xclient.data.l[1]);
printf("\tdetail 0x%X\n", ev.xclient.data.l[2]);
printf("\tdata1 0x%X\n", ev.xclient.data.l[3]);
printf("\tdata2 0x%X\n", ev.xclient.data.l[4]);
/* container window could be got from ReparentNotify */
if( ev.xclient.data.l[1] == 0)
container = ev.xclient.data.l[3] ;
break;
default:
;
};
}
}
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].
Hi,
I simply meant that FLTK is great for making simple programs to use with sdesk. It is very easy to mockup a design and keep all the code in FLUID. This makes it very simple for others to adapt the UX for their own purposes, or change it.
I have taken to causing my programs to read the .jwmrc file to set colors.
sdesk does all the work to set the tray icon, so FLTK does not need to
Plus FLTK is not as crazy as GTK. It seems like more and more things change and become more complex (for no reason?) with each release.
I simply meant that FLTK is great for making simple programs to use with sdesk. It is very easy to mockup a design and keep all the code in FLUID. This makes it very simple for others to adapt the UX for their own purposes, or change it.
I have taken to causing my programs to read the .jwmrc file to set colors.
sdesk does all the work to set the tray icon, so FLTK does not need to
Plus FLTK is not as crazy as GTK. It seems like more and more things change and become more complex (for no reason?) with each release.
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
technosaurus, I think it would be cool to modify the -t portion to allow checking for the icon theme icons, using:
gtk_icon_theme_load_icon ("icon_name")
it would be nice if this could be modified during runtime, as then things like a battery/wifi/wtc... could update the icon at will using a generic icon name that could be changed to fit the icon theme used.
So a few questions..
Is this possible in Puppy?
Would this be too hard to implement for you?
gtk_icon_theme_load_icon ("icon_name")
it would be nice if this could be modified during runtime, as then things like a battery/wifi/wtc... could update the icon at will using a generic icon name that could be changed to fit the icon theme used.
So a few questions..
Is this possible in Puppy?
Would this be too hard to implement for you?
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
It may be easier to just try that if the image file fails to load normally, just use the contents of the file as the name.
It already allows this to be changed at run time though, just touch the symlink or change it.
It already allows this to be changed at run time though, just touch the symlink or change it.
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].
-
- Posts: 13
- Joined: Sat 15 Nov 2014, 20:53
1. Is this last source code of sit ?
http://www.murga-linux.com/puppy/viewto ... 677#714677
2. Can you put 64 bit support to " build " file ?
For example:
3. Can you put or move source code to first post ?
4. Can you add version to source code ?
Edit:
From X11 http://murga-linux.com/puppy/viewtopic. ... 027#828027
Edit:
sit-1.0.tar.gz from http://murga-linux.com/puppy/viewtopic.php?t=76431
I upgraded to sit-1.0-2.tele.tar.gz ( is in attachment )
- added own example with icon ( left click , right click icon tray )
- added support for 64bit in "build" script ( I get help for this on other forum )
But this have bugs:
- "right click" window sometimes is in at the top, bottom
- Working on Debian 8.8 ( Mate 64bit ) , but probably not working on Ubuntu ( I'm not sure )
Edit:
I tried rebuild sdesk to sdesk-1.0-3.tele ( file in attachment )
http://www.murga-linux.com/puppy/viewto ... 677#714677
- added 64bit support
- added test script
but
- I can run function only from file ( this is good )
- I don't know how working <status icon> , can you add example ?
Edited:
I added to sdesk-1.0-3.tele second example ( now it is sdesk-1.0-4.tele
How get sdesk pid to kill only first or second app ?
http://www.murga-linux.com/puppy/viewto ... 677#714677
2. Can you put 64 bit support to " build " file ?
For example:
Code: Select all
#!/bin/sh
#compile
if [ `getconf LONG_BIT` = "64" ]; then
echo "ARCH: 64-bit"
#compile
gcc `pkg-config gtk+-x11-2.0 --cflags` -DGTK_NO_CHECK_CASTS -DG_DISABLE_CAST_CHECKS \
sdesk.c -o sdesk `pkg-config gtk+-x11-2.0 --libs` && strip --strip-all -R .note -R .comment sdesk
else
echo "ARCH: 32-bit"
#compile
gcc `pkg-config gtk+-x11-2.0 --cflags` -DGTK_NO_CHECK_CASTS -DG_DISABLE_CAST_CHECKS \
-Os -fmerge-all-constants -mno-accumulate-outgoing-args -march=i486 -mtune=i686 \
-Wl,-O2,--gc-sections,--as-needed,--sort-common,-s sdesk.c -o sdesk \
-lgtk-x11-2.0 -lgdk-x11-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
strip --strip-all -R .note -R .comment sdesk
fi
4. Can you add version to source code ?
Edit:
From X11 http://murga-linux.com/puppy/viewtopic. ... 027#828027
Code: Select all
$ ./buildsit
ARCH: 64-bit
sit.c: In function ‘send_message’:
sit.c:23:9: warning: incompatible implicit declaration of built-in function ‘memset’
memset( &ev, 0, sizeof(ev)) ;
^
/usr/bin/ld: /tmp/cclQRUt1.o: undefined reference to symbol 'XSetForeground'
//usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Edit:
sit-1.0.tar.gz from http://murga-linux.com/puppy/viewtopic.php?t=76431
I upgraded to sit-1.0-2.tele.tar.gz ( is in attachment )
- added own example with icon ( left click , right click icon tray )
- added support for 64bit in "build" script ( I get help for this on other forum )
But this have bugs:
- "right click" window sometimes is in at the top, bottom
- Working on Debian 8.8 ( Mate 64bit ) , but probably not working on Ubuntu ( I'm not sure )
Edit:
I tried rebuild sdesk to sdesk-1.0-3.tele ( file in attachment )
http://www.murga-linux.com/puppy/viewto ... 677#714677
- added 64bit support
- added test script
but
- I can run function only from file ( this is good )
- I don't know how working <status icon> , can you add example ?
Edited:
I added to sdesk-1.0-3.tele second example ( now it is sdesk-1.0-4.tele
How get sdesk pid to kill only first or second app ?
- Attachments
-
- sdesk-1.0-4.tele.tar.gz
- (9.32 KiB) Downloaded 544 times
-
- sit-1.0-2.tele.tar.gz
- (6.63 KiB) Downloaded 572 times