[PATCH]: Add the domain name to virt-viewer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All,
     When using virt-viewer for multiple different virtual machines, you can't
easily distinguish between them.  Attached is a simple patch to add the domain
name to the title bar so that you can distinguish between multiple windows at a
glance.

Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx>
--- virt-viewer-0.0.2/src/main.c.orig
+++ virt-viewer-0.0.2/src/main.c
@@ -66,7 +66,7 @@ static const struct keyComboDef keyCombo
 	{ { GDK_Print }, 1, "_PrintScreen"},
 };
 
-
+char *domname = NULL;
 static void viewer_set_title(VncDisplay *vnc, GtkWidget *window, gboolean grabbed)
 {
 	const char *name;
@@ -79,8 +79,8 @@ static void viewer_set_title(VncDisplay 
 		subtitle = "";
 
 	name = vnc_display_get_name(VNC_DISPLAY(vnc));
-	snprintf(title, sizeof(title), "%s%s - Virt Viewer",
-		 subtitle, name);
+	snprintf(title, sizeof(title), "%s%s - %s - Virt Viewer",
+		 subtitle, domname, name);
 
 	gtk_window_set_title(GTK_WINDOW(window), title);
 }
@@ -708,6 +708,7 @@ int main(int argc, char **argv)
 	char *vncport = NULL;
 	char *transport = NULL;
 	char *user = NULL;
+	const char *tmpname = NULL;
 	int port = 0;
 	int fd = -1;
 	int direct = 0;
@@ -772,6 +773,10 @@ int main(int argc, char **argv)
 		if (!vncport)
 			usleep(300*1000);
 	} while (!vncport);
+	tmpname = virDomainGetName(dom);
+	if (tmpname != NULL) {
+		domname = strdup(tmpname);
+	}
 	virDomainFree(dom);
 	virConnectClose(conn);
 
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux