Page 6 of 9

Posted: Mon 07 Jan 2013, 16:40
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

Posted: Tue 08 Jan 2013, 17:00
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.

Posted: Tue 08 Jan 2013, 17:11
by vovchik
Dear technosaurus,

Very nice. I like the addition of markup.

With kind regards,
vovchik

Posted: Tue 08 Jan 2013, 21:40
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

Posted: Thu 24 Jan 2013, 02:05
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

Posted: Sun 27 Jan 2013, 01:28
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)

Posted: Sat 02 Feb 2013, 11:45
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).

Posted: Sat 02 Feb 2013, 14:45
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

Posted: Mon 04 Feb 2013, 17:46
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

Posted: Sun 14 Apr 2013, 11:32
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...

Posted: Sun 14 Apr 2013, 15:54
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.

Posted: Sun 14 Apr 2013, 16:36
by eadmaster
oh, you're right... i didn't think about it!
:wink:

Posted: Sat 20 Jul 2013, 04:06
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.

Posted: Sun 21 Jul 2013, 19:13
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,

Posted: Tue 19 Aug 2014, 02:40
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)

Posted: Tue 19 Aug 2014, 11:53
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>
:?:

SIT and cmake

Posted: Fri 05 Dec 2014, 23:41
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.

Posted: Sat 06 Dec 2014, 00:28
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 

Posted: Sat 06 Dec 2014, 09:52
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



sdesk Ubuntu

Posted: Sun 07 Dec 2014, 02:35
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!!