mirror of
https://github.com/FelixKratz/SketchyBar
synced 2024-11-22 19:33:03 +00:00
use CGDisplayMainID if SLSCopyActiveMenuBarDisplayIndentifier does not return the active display id
This commit is contained in:
parent
71463b85c4
commit
f48e9217b6
3 changed files with 11 additions and 5 deletions
|
@ -542,7 +542,7 @@ void bar_manager_begin(struct bar_manager* bar_manager) {
|
|||
|
||||
memset(bar_manager->bars, 0, sizeof(struct bar*) * bar_manager->bar_count);
|
||||
bar_manager->bars[0] = bar_create(did);
|
||||
bar_manager->bars[0]->adid = 1;
|
||||
bar_manager->bars[0]->adid = display_arrangement(did);
|
||||
}
|
||||
else {
|
||||
bar_manager->bar_count = display_active_display_count();
|
||||
|
@ -551,7 +551,7 @@ void bar_manager_begin(struct bar_manager* bar_manager) {
|
|||
sizeof(struct bar *) * bar_manager->bar_count);
|
||||
|
||||
memset(bar_manager->bars, 0, sizeof(struct bar*) * bar_manager->bar_count);
|
||||
for (uint32_t index=1; index <= bar_manager->bar_count; index++) {
|
||||
for (uint32_t index = 1; index <= bar_manager->bar_count; index++) {
|
||||
uint32_t did = display_arrangement_display_id(index);
|
||||
bar_manager->bars[index - 1] = bar_create(did);
|
||||
bar_manager->bars[index - 1]->adid = index;
|
||||
|
@ -563,6 +563,7 @@ void bar_manager_begin(struct bar_manager* bar_manager) {
|
|||
bar_manager->active_displays |= 1 << bar_manager->bars[i]->adid;
|
||||
}
|
||||
|
||||
bar_manager->active_adid = display_arrangement(display_active_display_id());
|
||||
bar_manager->needs_ordering = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,10 @@ int display_arrangement(uint32_t did) {
|
|||
if (!uuid) return 0;
|
||||
|
||||
CFArrayRef displays = SLSCopyManagedDisplays(g_connection);
|
||||
if (!displays) return 0;
|
||||
if (!displays) {
|
||||
CFRelease(uuid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int result = 0;
|
||||
int displays_count = CFArrayGetCount(displays);
|
||||
|
@ -139,7 +142,9 @@ uint32_t display_main_display_id(void) {
|
|||
}
|
||||
|
||||
CFStringRef display_active_display_uuid(void) {
|
||||
return SLSCopyActiveMenuBarDisplayIdentifier(g_connection);
|
||||
CFStringRef menubar = SLSCopyActiveMenuBarDisplayIdentifier(g_connection);
|
||||
if (!menubar) return display_uuid(CGMainDisplayID());
|
||||
return menubar;
|
||||
}
|
||||
|
||||
uint32_t display_active_display_id(void) {
|
||||
|
|
|
@ -43,7 +43,7 @@ static bool popup_set_blur_radius(struct popup* popup, uint32_t radius) {
|
|||
static void popup_order_windows(struct popup* popup) {
|
||||
int level = popup->topmost
|
||||
? kCGScreenSaverWindowLevel
|
||||
: kCGNormalWindowLevel - 1;
|
||||
: kCGBackstopMenuLevel;
|
||||
window_set_level(&popup->window, level);
|
||||
window_order(&popup->window, NULL, W_ABOVE);
|
||||
|
||||
|
|
Loading…
Reference in a new issue