Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting up Rules for "Role" doesn't work #396

Closed
alber70g opened this issue Feb 3, 2020 · 8 comments
Closed

Setting up Rules for "Role" doesn't work #396

alber70g opened this issue Feb 3, 2020 · 8 comments
Labels
help wanted Community help appreciated question Request for information or help, not an issue

Comments

@alber70g
Copy link

alber70g commented Feb 3, 2020

It might not be supported, if so, please consider this a feature request.

Regarding rules, I assumed one could use whatever is coming from the query command to use in the rules command. This seems to be not the case. As the docs say: "[..] windows that match app name and optionally title [..]".

I have a problem where Outlook is using windows to create tooltips. This results in flickering behaviour. Therefore I'd like to have one of these options:

  1. Use anything from the query command to select a screen
    E.g. yabai -m rule --add role=AXHelpTag manage=off

  2. Use a min-height (and potentially all properties in frame) to exclude windows from being managed
    E.g. yabai -m rule --add frame.h="<20" manage=off

The result of sleep 6 && yabai -m query --windows --space (I use sleep to get the windows in the way I want to query them):

[{
	"id":44893,
	"pid":91618,
	"app":"Microsoft Outlook",
	"title":"",
	"frame":{
		"x":1214.0000,
		"y":32.0000,
		"w":114.0000,
		"h":18.0000
	},
	"level":103,
	"role":"AXHelpTag",
	"subrole":"",
	"movable":1,
	"resizable":0,
	"display":1,
	"space":5,
	"visible":1,
	"focused":0,
	"split":"vertical",
	"floating":0,
	"sticky":0,
	"topmost":0,
	"border":0,
	"shadow":1,
	"zoom-parent":0,
	"zoom-fullscreen":0,
	"native-fullscreen":0
},{
	"id":44940,
	"pid":91618,
	"app":"Microsoft Outlook",
	"title":"Feature Platform • Meeting • Calendar • xx@yy",
	"frame":{
		"x":214.0000,
		"y":197.0000,
		"w":1709.0000,
		"h":1083.0000
	},
	"level":0,
	"role":"AXWindow",
	"subrole":"AXStandardWindow",
	"movable":1,
	"resizable":1,
	"display":1,
	"space":5,
	"visible":1,
	"focused":1,
	"split":"none",
	"floating":1,
	"sticky":0,
	"topmost":0,
	"border":1,
	"shadow":1,
	"zoom-parent":0,
	"zoom-fullscreen":0,
	"native-fullscreen":0
},{
	"id":44695,
	"pid":91618,
	"app":"Microsoft Outlook",
	"title":"Calendar",
	"frame":{
		"x":52.0000,
		"y":32.0000,
		"w":1147.0000,
		"h":1218.0000
	},
	"level":0,
	"role":"AXWindow",
	"subrole":"AXStandardWindow",
	"movable":1,
	"resizable":1,
	"display":1,
	"space":5,
	"visible":1,
	"focused":0,
	"split":"vertical",
	"floating":0,
	"sticky":0,
	"topmost":0,
	"border":1,
	"shadow":1,
	"zoom-parent":0,
	"zoom-fullscreen":0,
	"native-fullscreen":0
}]
@dominiklohmann
Copy link
Collaborator

dominiklohmann commented Feb 3, 2020

It might make more sense to generally ignore all windows whose role is AXHelpTag. That's already a thing, see below.

Aside from that...

  • You can already do what you want with a slightly more complicated setup:
    • Create a role that tells yabai to ignore all Outlook windows
    • Create a signal that tells yabai to tile all Outlook windows that don't match your restriction (requires two signals, both window_created and application_launched)
  • You can just match on the empty title:
    • yabai -m rule --add app='^Microsoft Outlook$' title='^$' manage='off'

@koekeishiya
Copy link
Owner

What is your end goal here? All windows that are not of role AXWindow and subrole AXStandardWindow is treated as floating by default. For more complicated things I think using signals might be more appropriate?

@alber70g
Copy link
Author

alber70g commented Feb 4, 2020

Okay, I got it resolved. I had some settings to only manage the main screen of Outlook. But the order was wrong. I think that's what caused the AXHelpTag to be managed. Now I don't setup a specific rule to manage the Outlook main screen, just to not manage all the others.

@alber70g
Copy link
Author

alber70g commented Feb 4, 2020

My bad, it still doesn't work the way I want. How is the priority of screens detected? Basically, Outlook has one main window that I want to be managed on a specific screen. All the others I want to be floating and unmanaged. How to accomplish this?

I have this now, but I'm not sure how the rules are applied. The windows that start with Inbox and Calendar is the main window. The rest should be unmanaged.

yabai -m rule --add app='^Microsoft Outlook$'                   manage=off
yabai -m rule --add app="^Microsoft Outlook$" title="^Inbox"    manage=on
yabai -m rule --add app="^Microsoft Outlook$" title="^Calendar" manage=on
yabai -m rule --add app="^Microsoft Outlook$" title="^$"        manage=off

@koekeishiya
Copy link
Owner

Rules are applied in the order they were added. You might want to enable debug output to inspect the window_title_changed events in particular, to see whether the outlook windows spawn with the correct title, or if it changes title shortly after being created (which would cause the rules to not match).

@alber70g
Copy link
Author

alber70g commented Feb 11, 2020

I've inspected this, but it doesn't seem to be like the window spawns with a title. At least, I don't see a window_title_changed.

Here's the log:
EVENT_HANDLER_MOUSE_DOWN: 21.06, 183.96
EVENT_HANDLER_MOUSE_UP: 21.06, 183.96
EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: Finder
EVENT_HANDLER_APPLICATION_DEACTIVATED: iTerm2
EVENT_HANDLER_APPLICATION_ACTIVATED: Finder
EVENT_HANDLER_DISPLAY_CHANGED: 69734406 7
event_signal_transmit: application_activated
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --windows --space'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --spaces --space'
EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: Microsoft Outlook
EVENT_HANDLER_APPLICATION_DEACTIVATED: Finder
EVENT_HANDLER_APPLICATION_ACTIVATED: Microsoft Outlook
event_signal_transmit: application_activated
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --windows --space'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --spaces --space'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --windows --window'
EVENT_HANDLER_WINDOW_CREATED: Microsoft Outlook 1030
EVENT_HANDLER_WINDOW_DESTROYED: Microsoft Outlook 1030
event_signal_transmit: window_created
EVENT_HANDLER_WINDOW_RESIZED: Microsoft Outlook 270
EVENT_HANDLER_WINDOW_RESIZED: Microsoft Outlook 270
event_signal_transmit: window_resized
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
event_signal_transmit: window_resized
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
EVENT_HANDLER_WINDOW_CREATED: Microsoft Outlook 1030
EVENT_HANDLER_WINDOW_DESTROYED: Microsoft Outlook 1030
event_signal_transmit: window_created
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --windows --space'
EVENT_HANDLER_WINDOW_RESIZED: Microsoft Outlook 270
EVENT_HANDLER_WINDOW_RESIZED: Microsoft Outlook 270
event_signal_transmit: window_resized
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
event_signal_transmit: window_resized
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
EVENT_HANDLER_WINDOW_CREATED: Microsoft Outlook 1030
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --windows --space'
event_signal_transmit: window_created
EVENT_HANDLER_WINDOW_DESTROYED: Microsoft Outlook 1030
EVENT_HANDLER_WINDOW_RESIZED: Microsoft Outlook 270
EVENT_HANDLER_WINDOW_RESIZED: Microsoft Outlook 270
event_signal_transmit: window_resized
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
event_signal_transmit: window_resized
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --spaces --space'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --windows --space'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --windows --space'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --spaces --space'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --windows --space'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --spaces --space'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --spaces --space'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --windows --window'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --spaces --space'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --windows --window'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --windows --window'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --windows --window'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --windows --space'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --windows --window'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --spaces --space'
EVENT_HANDLER_DAEMON_MESSAGE: msg 'query --windows --window'
EVENT_HANDLER_APPLICATION_FRONT_SWITCHED: iTerm2
EVENT_HANDLER_DISPLAY_CHANGED: 1124235357 10
EVENT_HANDLER_APPLICATION_DEACTIVATED: Microsoft Outlook
EVENT_HANDLER_APPLICATION_ACTIVATED: iTerm2
event_signal_transmit: application_activated

@koekeishiya
Copy link
Owner

koekeishiya commented Feb 11, 2020

Are you on the latest version (v2.2.2)? I noticed you are getting the following message:
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec(). which I have not been able to reproduce, but it should probably be addressed.

Edit: Created issue #410 for the The process has forked and you cannot use this CoreFoundation.. issue

@koekeishiya koekeishiya added help wanted Community help appreciated question Request for information or help, not an issue labels Feb 12, 2020
@koekeishiya
Copy link
Owner

In the latest version (2.4.0) you should now be able to use the following rule:

yabai -m rule --add app="^Microsoft Outlook$" title!="^(Calendar|Inbox)" manage=off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Community help appreciated question Request for information or help, not an issue
Projects
None yet
Development

No branches or pull requests

3 participants