summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--mktrayicon.c18
2 files changed, 18 insertions, 4 deletions
diff --git a/README.md b/README.md
index dc9bba8..db15ad8 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ command. Each command should be terminated by a newline. The following commands
are supported:
- `q`: Terminate `mktrayicon` and remove the tray icon
- - `i <icon>`: Set the graphic to use for the tray icon (see `/usr/share/icons`)
+ - `i <icon>`: Set the graphic to use for the tray icon; it can be a stock icon name (see `/usr/share/icons`) or path to a custom icon
- `t <text>`: Set the text to display in the icon tooltip
- `t`: Remove the icon tooltip
- `c <cmnd>`: Set the command to be execute when the user clicks the icon (`cmnd` is passed to `/bin/sh -c`)
@@ -22,7 +22,7 @@ are supported:
- `s`: Show the tray icon
By default, the `none` tooltip icon is used. To change this, pass `-i
-<icon_name>` when running `mktrayicon`.
+<stock_icon_name>` or `-i <path_to_custom_icon>` when running `mktrayicon`.
Note that any script communicating with `mktrayicon` **must**, for the time
being, send `q` when they are done. Just removing the FIFO file will **not**
diff --git a/mktrayicon.c b/mktrayicon.c
index f4deb10..d793c89 100644
--- a/mktrayicon.c
+++ b/mktrayicon.c
@@ -55,7 +55,14 @@ gboolean set_icon(gpointer data)
#ifdef DEBUG
printf("Setting icon to '%s'\n", p);
#endif
- gtk_status_icon_set_from_icon_name(icon, p);
+ if (strchr(p, '/'))
+ {
+ gtk_status_icon_set_from_file(icon, p);
+ }
+ else
+ {
+ gtk_status_icon_set_from_icon_name(icon, p);
+ }
free(data);
return FALSE;
}
@@ -189,7 +196,14 @@ static GtkStatusIcon *create_tray_icon(char *start_icon)
{
GtkStatusIcon *tray_icon;
- tray_icon = gtk_status_icon_new_from_icon_name(start_icon);
+ if (strchr(start_icon, '/'))
+ {
+ tray_icon = gtk_status_icon_new_from_file(start_icon);
+ }
+ else
+ {
+ tray_icon = gtk_status_icon_new_from_icon_name(start_icon);
+ }
g_signal_connect(G_OBJECT(tray_icon), "activate", G_CALLBACK(tray_icon_on_click), NULL);
g_signal_connect(G_OBJECT(tray_icon), "popup-menu", G_CALLBACK(tray_icon_on_menu), NULL);
gtk_status_icon_set_visible(tray_icon, TRUE);
bgstack15