[v3 linux] systray: cleanup + add basic menu

This commit is contained in:
Travis McLane 2023-09-21 15:56:51 -05:00
commit 71fc222059
2 changed files with 8 additions and 14 deletions

View file

@ -1157,9 +1157,9 @@ func systrayNew(label string) pointer {
indicator := C.app_indicator_new(labelStr, labelStr, C.APP_INDICATOR_CATEGORY_APPLICATION_STATUS)
trayMenu := C.gtk_menu_new()
// item := C.gtk_menu_item_new_with_label(labelStr)
// C.gtk_menu_shell_append((*C.GtkMenuShell)(unsafe.Pointer(trayMenu)), item)
// C.gtk_widget_show(item)
item := C.gtk_menu_item_new_with_label(labelStr)
C.gtk_menu_shell_append((*C.GtkMenuShell)(unsafe.Pointer(trayMenu)), item)
C.gtk_widget_show(item)
C.app_indicator_set_status(indicator, C.APP_INDICATOR_STATUS_ACTIVE)
C.app_indicator_set_menu(indicator, (*C.GtkMenu)(unsafe.Pointer(trayMenu)))
iconStr := C.CString("wails-systray-icon")
@ -1187,17 +1187,6 @@ func systrayMenuSet(tray pointer, menu pointer) {
// C.app_indicator_set_menu((*C.AppIndicator)(tray), (*C.GtkMenu)(unsafe.Pointer(menu)))
}
/*
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file(icon_file_path, NULL);
int width, height;
gdk_pixbuf_get_file_info (icon_file_path, &width, &height);
gtk_icon_theme_add_builtin_icon ("custom_icon", width, pixbuf);
g_object_unref (G_OBJECT (pixbuf));
GtkToolItem *toolbar_item = gtk_toggle_tool_button_new();
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON(toolbar_item), "custom_icon");
*/
func systraySetTemplateIcon(tray pointer, icon []byte) {
dirname, err := os.UserHomeDir()
if err != nil {

View file

@ -95,6 +95,11 @@ func newSystemTrayImpl(s *SystemTray) systemTrayImpl {
isTemplateIcon: s.isTemplateIcon,
}
}
func (s *linuxSystemTray) openMenu() {
if s.tray == nil {
return
}
}
func (s *linuxSystemTray) openMenu() {
}