if there is only one display, it is always the active one (#316)

This commit is contained in:
Felix Kratz 2023-01-25 11:17:29 +01:00
parent f48e9217b6
commit 4981a906c9

View file

@ -138,13 +138,23 @@ int display_arrangement(uint32_t did) {
}
uint32_t display_main_display_id(void) {
return CGMainDisplayID();
return CGMainDisplayID();
}
CFStringRef display_active_display_uuid(void) {
CFStringRef menubar = SLSCopyActiveMenuBarDisplayIdentifier(g_connection);
if (!menubar) return display_uuid(CGMainDisplayID());
return menubar;
if (display_active_display_count() == 1) {
uint32_t did = 0;
uint32_t count = 0;
CGGetActiveDisplayList(1, &did, &count);
if (count == 1)
return display_uuid(did);
else {
printf("Error: No active display found!\n");
}
}
CFStringRef menubar = SLSCopyActiveMenuBarDisplayIdentifier(g_connection);
return menubar;
}
uint32_t display_active_display_id(void) {