simple icon tray

Window managers, icon programs, widgets, etc.
Message
Author
seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#101 Post by seaside »

technosaurus,

I noticed that Vovchik's Yweather application uses markup in the icon tooltip.

Is it possible for "sit" to do this as well? :?:

Regards,
s

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

#102 Post by technosaurus »

you can now,... http://developer.gnome.org/pango/stable ... ormat.html

(just had to change *tooltip_text to *tooltip_markup ... unformatted text still works too, though I didn't check new lines)

I have included the current master branch which should build on Linux, BSD, Mac and Win32/64

the win32 version has lots of downloads but no comments, if anyone is using it let me know its shortcomings so I can improve its cross platform abilities (for example what would be a good path for includefiles? C:\\MinGW...) ... same goes for Mac if anyone has built it... so I can put out another point release.
Attachments
sit-master.tar.gz
(3.89 KiB) Downloaded 638 times
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].

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#103 Post by vovchik »

Dear technosaurus,

Very nice. I like the addition of markup.

With kind regards,
vovchik

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#104 Post by seaside »

technosaurus,

You have done it again. Works nicely indeed, thank you.

New lines seem to work just fine.

I really think sit should be part of Puppy, as it is versatile, small, and so easily implements an attractive interface.

Best Regards,
s

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#105 Post by jamesbond »

Patch:
1. Remove default include files path (if this path doesn't exist, execution fails - bad)
2. change popen mode from "r" to "w" - otherwise no output
3. ensure pclose after popen so that we don't get zombie process
4. close pid from g_spawn_async
5 add version numbering so we know which version of sit this is.
6. modify build process so that it is 64-bit compatible (should still work on 32-bit)
7. modify build process so that it tests correctly
Attachments
sit-master-james.patch.gz
(1.43 KiB) Downloaded 607 times
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#106 Post by seaside »

jamesbond wrote:Patch:
1. Remove default include files path (if this path doesn't exist, execution fails - bad)
2. change popen mode from "r" to "w" - otherwise no output
3. ensure pclose after popen so that we don't get zombie process
4. close pid from g_spawn_async
5 add version numbering so we know which version of sit this is.
6. modify build process so that it is 64-bit compatible (should still work on 32-bit)
7. modify build process so that it tests correctly
jamesbond,

Thank you for the improvements.
The original sit-master binary compiled by technosaurus runs in Puppy precise 5.4.1 and this one failed after patching.....

Code: Select all

 ./build
/usr/bin/ld: /tmp/cckw5xNo.o: undefined reference to symbol 'g_file_monitor_file'
/usr/bin/ld: note: 'g_file_monitor_file' is defined in DSO /usr/lib/libgio-2.0.so.0 so try adding it to the linker command line
/usr/lib/libgio-2.0.so.0: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
I added the link to -L/usr/lib/libgio-2.0.so.0 on the command line and that didn't make any difference.

I think it would be great to have this generally in Puppy and ideally one version for all, but I don't know enough about compiling.

Regards,
s
(EDIT: I just tried to compile the master-sit original and got the same error, so something must be different in Puppy Precise 5.4.1, even though the binary included works)

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#107 Post by jamesbond »

I agree.

This is how to fix the compile it recent puppies (tested in my homebrew slackware-based 32-bit puplet). Do it after you apply the patch.

Change line 7 in "build" from

Code: Select all

sit.c -o sit -lgtk-x11-2.0 && strip --strip-all -R .note -R .comment sit
To

Code: Select all

sit.c -o sit -lgtk-x11-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 && strip --strip-all -R .note -R .comment sit
Note the addition of -lgio-2.0 -lgobject-2.0 -lglib-2.0.

The easier way to compile without having to remember all this thingamagic is

Code: Select all

sit.c -o sit $(pkg-config --libs gtk+-2.0) && strip --strip-all -R .note -R .comment sit
but technosaurus will disapprove of it :lol: (because, although it does make it easier to compile, it causes the compile to pull in unnecessary dependencies and make it slightly larger).
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

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

#108 Post by technosaurus »

I think I was adding the -Wl,--as-needed flag too, which tells the linker to look in the deps. Amazingly it builds and runs fine on windows, so I would guess its the hacky canonical patches. I cant' check the puppy build right now since my classes all require windows and/or a full java sdk.

-btw thanks for the patches
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].

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#109 Post by seaside »

jamesbond wrote:
Change line 7 in "build" from

Code: Select all

sit.c -o sit -lgtk-x11-2.0 && strip --strip-all -R .note -R .comment sit
To

Code: Select all

sit.c -o sit -lgtk-x11-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 && strip --strip-all -R .note -R .comment sit
Note the addition of -lgio-2.0 -lgobject-2.0 -lglib-2.0.
jamesbond,

Thanks. It worked nicely.

In case anyone wants the compiled binary made in Precise 5.4.3, I've attached it here.

Regards,
s
Attachments
sit-james-master-bin.tar
James patch to technosaurus sit-master
(20 KiB) Downloaded 783 times

eadmaster
Posts: 46
Joined: Sat 09 Feb 2013, 11:34
Contact:

#110 Post by eadmaster »

is it possible to set the tooltip as a command instead of a fixed string?
So when the mouse is hovering, the cmd is executed and the output is displayed in the tooltip...

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

#111 Post by technosaurus »

You can set something up in your control script to modify the tooltip file ... either by periodically running said command or running it based on some event.
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].

eadmaster
Posts: 46
Joined: Sat 09 Feb 2013, 11:34
Contact:

#112 Post by eadmaster »

oh, you're right... i didn't think about it!
:wink:

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

#113 Post by technosaurus »

I am reworking sit to also do the desktop ... Tentatively renaming to sdesk
New abilities will be desktop widgets that can be provided by using svg images... Like in pwidgets or gkrellm. Webcam shots, tv tuner captures, slideshows, graphs, text, possibly even desktop icons.
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].

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

#114 Post by technosaurus »

sdesk is now in a working alpha state with all of the sit parts still intact.
the usage has changed to the following format:

Code: Select all

  -i   <include files>
  -b  <background imagge>
  -t  <status icon> <tooltip> <left click action> <right click action>
      the -t option can be used multiple times,
Attachments
sdesk.tar.gz
(8.79 KiB) Downloaded 738 times
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].

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

#115 Post by technosaurus »

Could someone give me some pointers on how/where to wedge gettext in to the tooltip messages? I don't think it can be done internally since there are no strings... it needs to be done in the caller (shell script or whatever invokes the tray app)
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].

User avatar
Bert
Posts: 1103
Joined: Fri 30 Jun 2006, 20:09

#116 Post by Bert »

Hi Techno,

Something like this:

Code: Select all

<pixmap tooltip-text="'$(gettext ' This is a good idea! ')'">
     <input file>'$WORKDIR'/icons/lightbulb.png</input>
</pixmap>
:?:
[url=http://pupsearch.weebly.com/][img]http://pupsearch.weebly.com/uploads/7/4/6/4/7464374/125791.gif[/img][/url]
[url=https://startpage.com/do/search?q=host%3Awww.murga-linux.com%2F][img]http://i.imgur.com/XJ9Tqc7.png[/img][/url]

User avatar
torios
Posts: 28
Joined: Fri 05 Dec 2014, 23:21

SIT and cmake

#117 Post by torios »

Hi I am wondering if anyone here has tried using cmake to compile sit... if so, I could use some pointers... I am trying to make a debian package for sit, as well as a PPA for Ubuntu.

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

#118 Post by technosaurus »

Here is a Makefile in case the ./build script doesn't work

Code: Select all

# Makefile for sdesk.
#CC = /usr/i386-linux-uclibc/bin/i386-uclibc-gcc
#CC = diet gcc
#CC = musl-gcc
CC ?= gcc
#CFLAGS = -pipe -Os -mtune=i386 -static -s -Wall -I/usr/i386-linux-uclibc/usr/include
#CFLAGS = -pipe -Os -mtune=i386 -static -s -Wall
CFLAGS = -Os -finline-small-functions -ffunction-sections -fdata-sections -fmerge-all-constants \
-fomit-frame-pointer -mno-accumulate-outgoing-args -fno-unwind-tables -fno-asynchronous-unwind-tables
#LDFLAGS = -L/usr/i386-linux-uclibc/lib -lm -Wl,--gc-sections,--sort-common,-s
LDFLAGS = -Wl,--gc-sections,--sort-common,--as-needed,-s -lm `pkg-config gtk+-x11-2.0 --libs`
#see stb_vorbis for various size vs. speed defines
DEFINES = `pkg-config gtk+-x11-2.0 --cflags`
OBJECTS = sdesk.c
BINDIR = /usr/bin
sdesk: $(OBJECTS)
	$(CC) $(CFLAGS) $(DEFINES) $(OBJECTS) $(LDFLAGS) -o sdesk
install:
	strip --strip-all -R .note -R .comment sdesk
	install sdesk $(BINDIR)/sdesk
uninstall:
	rm -f $(BINDIR)/sdesk
clean:
	rm -f *.o sdesk
depend:
	gccmakedep -- $(CFLAGS) -- sdesk.c 
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].

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

#119 Post by technosaurus »

some example C code for reading files in /proc/*
This one generates a battery svg and tooltip file.

Code: Select all

#include <stdio.h>
#include <fcntl.h>

void do_bat0(char *svg,char *tt){
	char var[64],val[64],model[32]="",oem[32]="",battype[32]="",text[]="Battery";
	int dcap=0,cap=0,rcap=1,dv=0,pv=0,warn=0,low=0,present='n',sz=48,percent;
	FILE *state = fopen("/proc/acpi/battery/BAT0/state", "r"),
		*info =  fopen("/proc/acpi/battery/BAT0/info", "r"),
		*svgfp =  fopen(svg, "w"),
		*ttfp =  fopen(tt, "w");
	while (fscanf(info, "%64[^:] %*s %64[^\n]\n", var, val) != EOF){
		if (!strcmp("design capacity",var)) sscanf(val, "%d %*s", &dcap);
		if (!strcmp("last full capacity",var)) sscanf(val, "%d %*s", &cap);
		if (!strcmp("design voltage",var)) sscanf(val, "%d %*s", &dv);
		if (!strcmp("model number",var)) sscanf(val, " %s", &model);
		if (!strcmp("OEM info",var)) sscanf(val, " %s", &oem);
		if (!strcmp("battery type",var)) sscanf(val, " %s", &battype);
		if (!strcmp("design capacity warning",var)) sscanf(val, "%d %*s", &warn);
		if (!strcmp("design capacity low",var)) sscanf(val, "%d %*s", &low);
	}
	fclose(info);
	while (fscanf(state, "%64[^:] %*s %64[^\n]\n", var, val) != EOF){
		if (!strcmp("present",var)) sscanf(val, "%c%*s", &present);
		if (!strcmp("remaining capacity",var)) sscanf(val, "%d %*s", &rcap);
		if (!strcmp("present voltage",var)) sscanf(val, "%d %*s", &pv);
	}
	fclose(state);
	percent=(100*cap)/rcap;
	
	fprintf(svgfp, "<svg width=\"%dpx\" height=\"%dpx\" version=\"1.1\" " \
			"viewBox=\"0 0 200 200\" preserveAspectRatio=\"none\" " \
			"xmlns=\"http://www.w3.org/2000/svg\">\n" \
		"<rect x=\"20%%\" width=\"60%%\" height=\"100%%\" fill=\"#111\"/>\n" \
		"<rect x=\"20%%\" width=\"60%%\" y=\"%d%%\" height=\"%d%%\" fill=\"#0F0\"/>\n" \
		"<text x=\"100\" y=\"100\" fill=\"#FFF\" font-size=\"%d\" " \
			"text-anchor=\"middle\" transform=\"rotate(90 100,100)\">%s</text>\n" \
		"</svg>", sz, sz, 100-percent, percent, 200/(strlen(text)-1), text);
	fclose(svgfp);
	fprintf(ttfp, "%20s: %s\n" "%20s: %s\n" "%20s: %s\n" "%20s: %d mWh\n",
		"Make", oem, "Model", model, "Type", battype, "Percent remaining", percent );
	fclose(ttfp);
}

int main(int argc, char **argv){
	do_bat0("batt.svg","batt.tt");
	return 0;
}

#if 0 //another example for /proc file with a header
int main(int argc, char **argv){
	FILE *fp = fopen("/proc/net/arp", "r");
	char ip[99], hw[99], flags[99], mac[99], mask[99], dev[99], dummy[99];
	fgets(dummy, 99, fp);
	while (fscanf(fp, "%s %s %s %s %s %s\n", ip, hw, flags, mac, mask, dev) != EOF)
		if (!strcmp(argv[1],ip))
			printf("%s\n",dev);
	return 0;
}
#endif


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

User avatar
torios
Posts: 28
Joined: Fri 05 Dec 2014, 23:21

sdesk Ubuntu

#120 Post by torios »

Hi technosaurus, that really helped! Thank you very much I did get the cmake file to configure and generate!!
I also have a preliminary package made...
However, I need to know:
What is this licensed and who do I license it to?
right now (place holder info)
GPL3
technosaurus

If you know all the people that contributed code to this, that would be very helpful!

I will let you know how it goes building the package for Ubuntu, and I am sure I will have questions for you about shell scripting and sdesk....

I don't know C, but only C++ so maybe now is a good time to learn C as well so I can make even lighter programs.

Thanks so much!!

Post Reply