Skip to content

Commit

Permalink
#2126 window queries include subset of information for windows withou…
Browse files Browse the repository at this point in the history
…t AX-reference
  • Loading branch information
koekeishiya committed Feb 27, 2024
1 parent 7e23785 commit ae6f902
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
4 changes: 0 additions & 4 deletions doc/yabai.1
Original file line number Diff line number Diff line change
Expand Up @@ -715,10 +715,6 @@ The properties that contain incorrect information for windows with \f(CRhas\-ax\
"can\-move": bool,
"can\-resize": bool,
"has\-shadow": bool,
"is\-native\-fullscreen": bool,
"is\-minimized": bool,
"is\-hidden": bool,
"is\-sticky": bool,
}
.fam
.fi
Expand Down
4 changes: 0 additions & 4 deletions doc/yabai.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -515,10 +515,6 @@ The properties that contain incorrect information for windows with `has-ax-refer
"can-move": bool,
"can-resize": bool,
"has-shadow": bool,
"is-native-fullscreen": bool,
"is-minimized": bool,
"is-hidden": bool,
"is-sticky": bool,
}
----

Expand Down
21 changes: 19 additions & 2 deletions src/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,21 @@ uint64_t window_space(uint32_t wid)
return sid ? sid : window_display_space(wid);
}

int window_space_count(uint32_t wid)
{
int count = 0;
CFArrayRef window_list_ref = cfarray_of_cfnumbers(&wid, sizeof(uint32_t), 1, kCFNumberSInt32Type);
CFArrayRef space_list_ref = SLSCopySpacesForWindows(g_connection, 0x7, window_list_ref);
if (!space_list_ref) goto err;

count = CFArrayGetCount(space_list_ref);
CFRelease(space_list_ref);

err:
CFRelease(window_list_ref);
return count;
}

uint64_t *window_space_list(uint32_t wid, int *count)
{
uint64_t *space_list = NULL;
Expand Down Expand Up @@ -139,6 +154,8 @@ void window_nonax_serialize(FILE *rsp, uint32_t wid)
char *escaped_title = ts_string_escape(title);

uint64_t sid = window_space(wid);
bool is_fullscreen = space_is_fullscreen(sid);
bool is_sticky = window_space_count(wid) > 1;

int space = space_manager_mission_control_index(sid);
int display = display_arrangement(space_display_id(sid));
Expand Down Expand Up @@ -208,12 +225,12 @@ void window_nonax_serialize(FILE *rsp, uint32_t wid)
json_bool(false),
json_bool(false),
json_bool(false),
json_bool(is_fullscreen),
json_bool(false),
json_bool(false),
json_bool(false),
json_bool(false),
json_bool(false),
json_bool(false),
json_bool(is_sticky),
json_bool(false));
}

Expand Down
1 change: 1 addition & 0 deletions src/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ enum window_rule_flag
CFStringRef window_display_uuid(uint32_t wid);
uint32_t window_display_id(uint32_t wid);
uint64_t window_space(uint32_t wid);
int window_space_count(uint32_t wid);
uint64_t *window_space_list(uint32_t wid, int *count);
void window_unknown_serialize(FILE *rsp, uint32_t wid);
void window_serialize(FILE *rsp, struct window *window);
Expand Down

0 comments on commit ae6f902

Please sign in to comment.