From 1af909adaeec437b71cae14ae4d6887f0b979d99 Mon Sep 17 00:00:00 2001 From: Quantum Date: Wed, 29 Jul 2026 00:37:26 -0400 Subject: [PATCH] [client] main: display spice VM name in process title --- client/src/core.c | 17 ++++++++++++++++- client/src/core.h | 1 + client/src/main.c | 6 ++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/client/src/core.c b/client/src/core.c index 582c018c..84d8c5b4 100644 --- a/client/src/core.c +++ b/client/src/core.c @@ -24,11 +24,12 @@ #include "util.h" #include "kb.h" #include "message.h" -#include "message.h" #include "common/time.h" #include "common/debug.h" #include "common/array.h" +#include "common/proctitle.h" +#include "common/version.h" #include @@ -757,3 +758,17 @@ void core_updateOverlayState(void) } } } + +void core_setTitle(const char * title) +{ + if (!lgCanSetProcessTitle()) + return; + + char * string; + if (asprintf(&string, "Looking Glass Client %s%s%s", BUILD_VERSION, + title && *title ? ": " : "", title ? title : "") >= 0) + { + lgSetProcessTitle(string); + free(string); + } +} diff --git a/client/src/core.h b/client/src/core.h index c98501b8..c234ed86 100644 --- a/client/src/core.h +++ b/client/src/core.h @@ -42,5 +42,6 @@ void core_handleMouseGrabbed(double ex, double ey); void core_handleMouseNormal(double ex, double ey); void core_resetOverlayInputState(void); void core_updateOverlayState(void); +void core_setTitle(const char * title); #endif diff --git a/client/src/main.c b/client/src/main.c index 061728ce..8ee78e58 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -49,6 +49,7 @@ #include "common/paths.h" #include "common/cpuinfo.h" #include "common/ll.h" +#include "common/proctitle.h" #include "message.h" #include "core.h" @@ -739,6 +740,8 @@ void spiceReady(void) PSServerInfo info; if (purespice_getServerInfo(&info)) { + core_setTitle(info.name); + bool uuidValid = false; for(int i = 0; i < sizeof(info.uuid); ++i) if (info.uuid[i]) @@ -1631,6 +1634,9 @@ int main(int argc, char * argv[]) return -1; } + lgInitProcessTitle(argc, &argv); + core_setTitle(NULL); + DEBUG_INFO("Looking Glass (%s)", BUILD_VERSION); DEBUG_INFO("Locking Method: " LG_LOCK_MODE); cpuInfo_log();