Dear Zigbert,
You can either first scale the svg (with a text editor) like this (very quick and dirty):
Code: Select all
<svg width="25" height="25" viewBox="0 0 25 25" transform="scale(0.1)">
<g transform="matrix(1,0,0,1,-252,-282)">
<path style="fill:#595959;fill-opacity:0.7;stroke:#222222" d="m 501,410 a 121,121 0 0 1 -242,0 121,121 0 1 1 242,0 z"/>
<path style="fill:#222222;fill-opacity:0.7;stroke:none" d="m 472,409 a 92,92 0 0 1 -184,0 92,92 0 1 1 184,0 z"/>
<path style="fill:#5e9650;fill-opacity:1;stroke:none" d="m 438,408 c 0,6 -4,8 -4,8 l -76,44 c 0,0 -6,5 -12,2 -6,-3 -4,-7 -4,-7 l 0,-93 c 0,0 -1,-4 3,-7 4,-3 8,0 8,0 5,3 76,43 78,44 0,0 7,3 7,9 z"/>
</g>
</svg>
or modify the tray code like this (also quick and dirty):
Code: Select all
// http://www.meownplanet.net/zigbert/pmusic_PLUGIN_trayapp-0.3.c
/*Simple Pmusic tray icon by Iguleder
* Based on the tray icon skeleton by Barry Kauler*/
/* gcc `pkg-config --cflags --libs gtk+-2.0` -o pmusic_tray pmusic_tray.c */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
#include <glib/gstdio.h>
GdkPixbuf *pmusic_pixbuf, *pm_pixbuf;
GError *gerror;
//1 if Pmusic GUI is running, otherwise 0
int running=1;
// cd playing?
FILE *fp;
char cdplaying[21]="/tmp/cdplaying";
void play_next (GtkWidget *tray_icon, gpointer userdata)
{
system("pmusic -s next &");
}
void play_previous (GtkWidget *tray_icon, gpointer userdata)
{
system("pmusic -s prev &");
}
void quit_pmusic (GtkWidget *tray_icon, gpointer userdata)
{
system("pmusic -s quit");
}
void pause_song (GtkWidget *tray_icon, gpointer userdata)
{
system("pmusic -s pause");
}
void view_popup_menu (GtkWidget *tray_icon, GdkEventButton *event, gpointer userdata)
{
//add menu icons
GtkWidget *menu, *menuitem1, *menuitem2, *menuitem3, *menuitem4, *icon1, *icon2, *icon3, *icon4 ;
menu = gtk_menu_new();
menuitem1 = gtk_image_menu_item_new_with_label("Quit Pmusic");
icon1 = gtk_image_new_from_stock(GTK_STOCK_QUIT, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem1), icon1);
menuitem2 = gtk_image_menu_item_new_with_label("Next track");
icon2 = gtk_image_new_from_stock(GTK_STOCK_MEDIA_NEXT, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem2), icon2);
menuitem3 = gtk_image_menu_item_new_with_label("Previous track");
icon3 = gtk_image_new_from_stock(GTK_STOCK_MEDIA_PREVIOUS, GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem3), icon3);
menuitem4 = gtk_image_menu_item_new_with_label("Pause / Play");
icon4 = gtk_image_new_from_file("/tmp/icon_playpause.png");
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem4), icon4);
g_signal_connect(menuitem1, "activate", (GCallback) quit_pmusic, tray_icon);
g_signal_connect(menuitem2, "activate", (GCallback) play_next, tray_icon);
g_signal_connect(menuitem3, "activate", (GCallback) play_previous, tray_icon);
g_signal_connect(menuitem4, "activate", (GCallback) pause_song, tray_icon);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem1);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem2);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem3);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem4);
gtk_widget_show_all(menu);
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, (event != NULL) ? event->button : 0, gdk_event_get_time((GdkEvent*)event));
}
gboolean view_onPopupMenu (GtkWidget *tray_icon, gpointer userdata)
{
view_popup_menu(tray_icon, NULL, userdata);
return TRUE; /* we handled this */
}
void tray_icon_on_click(GtkStatusIcon *tray_icon, gpointer user_data)
{
// test if a CD is playing and resume appropriate GUI
system("ps -A|grep -q 'cdda2wav';echo $? >/tmp/cdplaying");
if (running == 0)
{
fp = fopen(cdplaying,"r");
int cdval;
if(fp == NULL)
{
printf("can't open file\n");
return;
}
while(!feof(fp))
{
fscanf(fp,"%d",&cdval);
}
fclose(fp);
{
if (cdval == 0)
{
system("pmusic -j -p '.CD' &");
}
else
{
system("pmusic &");
}
}
printf("%d", cdval);
running=1;
gtk_status_icon_set_tooltip(tray_icon, "Click to hide Pmusic");
}
else
{
system("pmusic -b &");
running=0;
gtk_status_icon_set_tooltip(tray_icon, "Click to show Pmusic");
}
}
static GtkStatusIcon *create_tray_icon()
{
GtkStatusIcon *tray_icon;
tray_icon = gtk_status_icon_new();
g_signal_connect(G_OBJECT(tray_icon), "activate", G_CALLBACK(tray_icon_on_click), NULL);
g_signal_connect(G_OBJECT(tray_icon), "popup-menu", (GCallback) view_onPopupMenu, NULL);
pmusic_pixbuf=gdk_pixbuf_new_from_file("/usr/share/icons/hicolor/scalable/apps/pmusic.svg",&gerror);
pm_pixbuf=gdk_pixbuf_scale_simple(pmusic_pixbuf,24,24,3);
gtk_status_icon_set_from_pixbuf(tray_icon,pm_pixbuf);
gtk_status_icon_set_tooltip(tray_icon, "Click to hide Pmusic");
gtk_status_icon_set_visible(tray_icon, TRUE);
return tray_icon;
}
int main(int argc, char **argv)
{
system("ln -sf $HOME/.pmusic/tmp/icon_playpause.png /tmp");
GtkStatusIcon *tray_icon;
gtk_init(&argc, &argv);
tray_icon = create_tray_icon();
gtk_main();
return 0;
}
I would still de-reference the pixbufs above, but that is minor.
With kind regards,
vovchik