xystray-trayicons

Stuff that has yet to be sorted into a category.
Post Reply
Message
Author
User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

xystray-trayicons

#1 Post by MU »

Image

Very small Trayicon - list.

You can configure size and position by editing
/usr/local/xystray-trayicons/run-xystray

Code: Select all

// ------------------
// --- User-Setup ---
// ------------------

NumberOfIcons = 10
PositionX = screenwidth()/2 - (NumberOfIcons*22)/2
PositionY = 0
Install the Dotpup, and run the program from the menue.
It is better, to add
sleep 3 && /usr/local/xystray-trayicons/run-xystray&
to your .xinitrc, as it just can display Programs started from new, but not programs already running. So it should run before all others.

It works fine with Icewm and Oroborus.
With JWM, you must click in the trayicon-window, to make the Title disappear. In jwm, the Window-Borders still remain.

Download (10 kb):
http://dotpups.de/dotpups/Desktop-Tools ... yicons.pup

Homepage:
http://stlman.fm.interia.pl/xystray/

Mark
Last edited by MU on Fri 14 May 2010, 01:02, edited 2 times in total.

steelman

New homepage.

#2 Post by steelman »

Greetings.

I have moved xystray to a new address. Check it at:
http://stlman.fm.interia.pl/xystray/

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#3 Post by MU »

steelman, thanks for the info, and this nice small programm :D

User avatar
SimplyFlower
Posts: 49
Joined: Fri 03 Mar 2006, 10:46
Location: Oregon, United States

Question regarding xystray

#4 Post by SimplyFlower »

What is the tray suppose to do? I downloaded and installed the dotpup. Added the line to .xinitrc file. It starts when I bootup, but there aren't any icons in it. I've started programs like Thunderbird, Mozilla, Beaver, Mtpaint, etc. No icons ever show up in the tray. Is there something I'm doing wrong or am I not understanding the function?
[color=#8B0AE0]-- [i][size=150]SimplyFlower[/size][/i][/color]
[size=25]Puppy Linux 2.15CE Final, Frugal w/pup_save.2fs file; Dell w/ Intel Celeron 1.1 GHZ, 512 MB RAM[/size]
[color=#8B0AE0][url=http://my.care2.com/simplyflower]Care2[/url][/color]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#5 Post by MU »

Tryicons are mostly supported by KDE and Gnome -programs (but not only).

If you have KDE, try klipper.
This is a tool to manage the KDE-clipboard.
With the trayicon, you can access the clipboard.

Thunderbird needs an extension, but I did not try it myself yet: http://moztraybiff.mozdev.org/

If you google for "linux trayicon", you should find more programssupporting trayicons.

Mark

User avatar
SimplyFlower
Posts: 49
Joined: Fri 03 Mar 2006, 10:46
Location: Oregon, United States

Thank you

#6 Post by SimplyFlower »

Mark, Thank you. I installed the extension for Thunderbird and it works. I was looking for something to visually notify me of new emails since I can't hear the mail notification sound with Thunderbird. This works great for me. Once again, Thanks. :D
[color=#8B0AE0]-- [i][size=150]SimplyFlower[/size][/i][/color]
[size=25]Puppy Linux 2.15CE Final, Frugal w/pup_save.2fs file; Dell w/ Intel Celeron 1.1 GHZ, 512 MB RAM[/size]
[color=#8B0AE0][url=http://my.care2.com/simplyflower]Care2[/url][/color]

User avatar
lior2b
Posts: 97
Joined: Sat 04 Feb 2006, 12:15
Location: The Holy Land
Contact:

#7 Post by lior2b »

See also:
Add a notification area to JWM http://www.murga.org/~puppy/viewtopic.php?p=42164
[color=#4682B4]Lior Tubi[/color]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#8 Post by MU »

I modified Liors freememapplet for JWM, so that it does not run in a window (what it technically is in the JWM-taskbar, though it looks like a tray-icon), but as a tray-icon compatible with the freedesktop.org-specifications.
So you can use it in other windowmanagers than JWM, if they support trayicons, or by using xystray.

Source is included, and a menu-entry to start the trayicon:
http://dotpups.de/dotpups/Desktop-Tools ... con-MU.pup

Like this it looks in Icewm using xystray, beside the "klipper" trayicon from KDE:

Image

Compilation-instructions for interested developpers are included.
I took eggtrayicon from the current Gaim-release (1.5.0).
Mark

User avatar
lior2b
Posts: 97
Joined: Sat 04 Feb 2006, 12:15
Location: The Holy Land
Contact:

#9 Post by lior2b »

Thanks MU! I didn't know eggtrayicon, I'll look into it!
[color=#4682B4]Lior Tubi[/color]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#10 Post by MU »

Eggtryicon provides a function, that you can use instead of gtk_window_new.

Code: Select all

//	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	window = egg_tray_icon_new("freemem");
That's almost all, quite simple.
It just works with Gtk2, fortunately your code worked immedeatly, just the Gdk-font did not.
I used instead a new option, to alter font-settings via a HTML-like syntax:

Code: Select all

        snprintf(freeMemStringFormatted, sizeof(freeMemStringFormatted), "<span font_desc='7.5'>%s</span>", freeMemString);
        gtk_label_set_markup (GTK_LABEL (label), freeMemStringFormatted);
This sets the labeltext to 7.5 point :)

There seems to be a bug in my simple patch, after a while the tooltip and the contextmenu start behaving extremely slow, so maybe something else has to be changed.

Mark

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#11 Post by MU »

there currently IS a bug in my patch.

The interval -delay is ignored, it updates every second, producing permanent processor-usage of 3% on my system.
This seems to be critical on slower machines, reported here:
http://www.murga.org/~puppy/viewtopic.p ... 4&start=16

The interval works correct, if I don't use
gtk_widget_show(GTK_WIDGET(window));

But that is nonsense, as this makes the applet invisible.
I tried to build it the same way as gaim does in docklett.c, still no success :(

Code: Select all

int main(int argc, char **argv) {

//MU
 static EggTrayIcon *window = NULL;

//	GtkWidget *window;

//MU	GtkWidget  *hbox;
//MU	GdkFont *font;
	int i;
	unsigned int interval = INTERVAL;

	gtk_init(&argc, &argv);

	for(i = 1; i < argc; ++i) {
		if((!strcmp(argv[i], "-u") || !strcmp(argv[i], "--update")) && (i < argc-1)) {
			interval = (unsigned int)strtoul(argv[++i], NULL, 10);
		} else {
			if(!(!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version") || !strcmp(argv[i], "-h") || !strcmp(argv[i], "--help"))) {
				printf("%s: bad option or missing argument `%s`\n\n", argv[0], argv[i]);
			}

			printf("%s v%s by Lior Tubi <lior2b@gmail.com>\n" \
			"options:\n" \
			"  -u <seconds>, --upadte <seconds>: Set update interval (default %d)\n" \
			"  -h, --help, -v, --version:        Display this help text and exit\n" \
			, APPNAME, APPVERSION, INTERVAL);
			return 0;
		}
	}

//MU
//	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	window = egg_tray_icon_new("freemem");

	gtk_signal_connect(GTK_OBJECT(window), "delete_event", GTK_SIGNAL_FUNC(AppQuit), NULL);
	gtk_window_set_title(GTK_WINDOW(window), APPNAME);
	gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, TRUE);

	tips = gtk_tooltips_new();

	gdk_color_parse(COLOR_NORMAL, &colorNormal);
	gdk_color_parse(COLOR_LOW, &colorLow);
	gdk_color_parse(COLOR_LOW_FLASH1, &colorLowFlash1);
	gdk_color_parse(COLOR_LOW_FLASH2, &colorLowFlash2);

	label = gtk_label_new("");
	style = gtk_style_copy(gtk_widget_get_style(label));
	style->fg[GTK_STATE_NORMAL] = style->white;
//MU
/*
	if((font = gdk_font_load(FONT))) {
		style->font = font;
	}
*/ 


	gtk_widget_set_style(label, style);

	//hbox = gtk_hbox_new(FALSE, 0);
	//gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 2);

	eventbox = gtk_event_box_new();
gtk_container_add(GTK_CONTAINER(eventbox), label);

/*
	gtk_signal_connect(GTK_OBJECT(eventbox), "button_press_event", GTK_SIGNAL_FUNC(ShowMenu), NULL);
	gtk_signal_connect_after(GTK_OBJECT(eventbox), "expose_event", GTK_SIGNAL_FUNC(ExposeUpdate), NULL);
*/
	g_signal_connect(G_OBJECT(eventbox), "button_press_event", G_CALLBACK(ShowMenu), NULL);
	g_signal_connect_after(G_OBJECT(eventbox), "expose_event", G_CALLBACK(ExposeUpdate), NULL);
	//style = gtk_style_copy(gtk_widget_get_style(eventbox));

	//gtk_container_add(GTK_CONTAINER(eventbox), hbox);
	gtk_container_add(GTK_CONTAINER(window), eventbox);


    flashTimeout = 0;
    status = NORMAL;
    interval *= 1000;
gtk_widget_show(label);
gtk_widget_show(eventbox);
//gtk_widget_show(window);

//egg_tray_icon_realize (window);
gtk_widget_show(GTK_WIDGET(window));

//	if(!gtk_check_version(2,4,0))
//		g_object_set(G_OBJECT(eventbox), "visible-window", FALSE, NULL);

printf("%i\n" , interval);

g_object_set(G_OBJECT(eventbox), "visible-window", TRUE, NULL);
g_object_ref(G_OBJECT(window));
   // gtk_timeout_add(interval, Update, NULL);
g_timeout_add(interval, Update, NULL);

//MU	gtk_widget_show_all(window);

gtk_widget_realize(GTK_WIDGET(window));
//gtk_widget_show_all(GTK_WIDGET(window));
	Update(NULL);

	gtk_main();

	return 0;
}
Add a

Code: Select all

gboolean Update(gpointer ptr) {

printf("test\n" );
to see the difference.

Mark

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#12 Post by MU »

ok, simply comment this to solve the bug:

Code: Select all

//	g_signal_connect_after(G_OBJECT(eventbox), "expose_event", G_CALLBACK(ExposeUpdate), NULL);
Mark

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#13 Post by MU »

updated the bugfixed freemem dotpup.
It includes the sources and 2 versions.
freememapplet-trayicon works fine in xystray,
freememapplet-trayicon2 works fine in the Icewm-tray.

Mark

Post Reply