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

Float "small" windows #47

Open
pepribas opened this issue Dec 11, 2023 · 26 comments
Open

Float "small" windows #47

pepribas opened this issue Dec 11, 2023 · 26 comments
Assignees

Comments

@pepribas
Copy link

I would like "small" windows to float by default.
This comes from xmonad and amethyst. See float-small-windows in https:/ianyh/Amethyst/blob/development/docs/configuration-files.md

@nikitabobko
Copy link
Owner

Normally, applications should set accessibility attributes to let other applications know how to interact with them.

If window is a dialog it's subrole attribute should be kAXDialogSubrole or kAXFloatingWindowSubrole

AeroSpace float kAXDialogSubrole and kAXFloatingWindowSubrole by default

@nikitabobko
Copy link
Owner

What application do you use that doesn't work as expected? Firstly, we need to let the developers of the app to know about this problem

@ctruett
Copy link

ctruett commented Dec 11, 2023

I'm not the OP, but Finder file copy dialog boxes aren't floating by default, as an example.

@nikitabobko
Copy link
Owner

nikitabobko commented Dec 11, 2023

I agree that some applications can be slow at fixing the accessibility issue (or simply don't care). In such cases, "small" windows heuristic can be implemented.

But, I'd implement it in on-window-callback. This way you can enable the heuristic only for needed applications

Concept:

[[on-window-detected]]
if.app-id = 'id.of.bad-accessibility.app'
if.width = '0...500'           # width is bigger or equals and width is smaller or equals 500
if.height = '0...500'          # height is bigger or equals and height is smaller or equals 500
run = 'layout floating'

I would like "small" windows to float by default.

I'm not sure that I'd enable it by default. "Small window" is a heuristic. Heuristics are not 100% accurate

As a former Amethyst user, I recall that I rather disliked this default heuristic

@nikitabobko
Copy link
Owner

I'm not the OP, but Finder file copy dialog boxes aren't floating by default, as an example.

Thanks, normally, I don't use Finder, so I didn't know that. I confirm that Finder doesn't set proper subrole attribute for "copy" dialog 🤦 (it sets "AXStandardWindow" https://developer.apple.com/documentation/applicationservices/kaxstandardwindowsubrole)

Or maybe I'm wrong and dialogs are not supposed to have a kAXDialogSubrole

Here is a screenshot of the accessibility properties of "copy" dialog

Screenshot 2023-12-11 at 20 53 50

I might wanna try to match this window by a set of properties (maybe, smth like identifier + title + app-id + absence of maximize button) and float it

@nikitabobko
Copy link
Owner

Or maybe I'm wrong and dialogs are not supposed to have a kAXDialogSubrole

It would help if we could collect accessibility properties of different windows that are supposed to float in this issue to decide on heuristics

@pepribas
Copy link
Author

I've seen this behaviour on web browser popup windows (ie: authenticate via google, add to todoist extension)
Todoist quick add window is another example.
Screenshot 2023-12-11 at 21 09 18
Screenshot 2023-12-11 at 21 06 28

@nikitabobko
Copy link
Owner

I'd not say that these windows are small. But I notice that all of them don't have a "maximize" button.

"absence of maximize button to float" is an interesting heuristic to try...

@nikitabobko
Copy link
Owner

nikitabobko commented Dec 16, 2023

I implemented the heuristic and tested it:

  • Safari's 'Login with google' window mistakenly reports that it has a fullscreen button. In UI, the button is not clickable, but if you click it using accessibility API then Safari crashes. I reported the bug to Apple (no hope that they will fix it though)
  • Todoist 'add task' dialog was not even considered as a window. So I couldn't reproduce the problem
  • Finder 'Copy' progress dialog now floats
  • IntelliJ various dialogs ('Rebase...', 'Edit commit message') now floats
  • System Settings window now floats (it doesn't have a fullscreen button, it only has a maximize button)

@nikitabobko nikitabobko self-assigned this Dec 16, 2023
@nikitabobko
Copy link
Owner

The heuristic is released in 0.7.0-Beta

Please let me know if it doesn't work for you / if it does more harm than good

@pepribas
Copy link
Author

@nikitabobko In order to open "quick add" in todoist as a separate window you need to trigger it using the quick add keyboard shortcut.
I have tested it with the latest beta and I it's being considered a regular window.

Thanks for the fixes!

@nikitabobko
Copy link
Owner

I have tested it with the latest beta and I it's being considered a regular window.

@pepribas you mean dialog, right? Does it float now?

@pepribas
Copy link
Author

@nikitabobko Sorry for the misunderstanding.

It's being treated as a regular window and it's being tiled like the screenshot I shared above

@wojciech-kulik
Copy link
Contributor

wojciech-kulik commented Jan 4, 2024

if.app-id = 'id.of.bad-accessibility.app'
if.width = '0...500'           # width is bigger or equals and width is smaller or equals 500
if.height = '0...500'          # height is bigger or equals and height is smaller or equals 500
run = 'layout floating'

It would be great to have it.

Also, it would be very useful to have an option to set that all "subwindows" should be floating. In 99% cases I want only the main window to tile and all subwindows like settings, popups etc. to be floating. It's really annoying when I open a settings window and it moves everything around

@wojciech-kulik
Copy link
Contributor

To show the problem, look at this. When the caps lock is enabled, the system presents a small green bubble (sometimes it shows also language). AeroSpace treats it as a new window and applies tiling:
image

That's why I think we should have an option to:

  1. Disable tiling of small windows
  2. Disable tiling of child windows
  3. Set min width/height for tiling

@nikitabobko
Copy link
Owner

@wojciech-kulik

When the caps lock is enabled, the system presents a small green bubble (sometimes it shows also language). AeroSpace treats it as a new window and applies tiling

It should have been fixed in #53 One day, I will introduce aerospace list-windows --debug to print all the accessibility info about windows, so it will be easier to diagnose problems like this.

But until then it would be helpful if you could "catch" the window in "Accessibility Inspector.app" (like I did here #47 (comment))

Also, it would be very useful to have an option to set that all "subwindows" should be floating

-> #71 What program or programs do you have in mind where it would be useful? (please answer in #71)

@wojciech-kulik
Copy link
Contributor

@nikitabobko
image

@nikitabobko
Copy link
Owner

@wojciech-kulik Sorry, your screenshot is a screenshot of "Button accessibility object" but I'm interested in the window accessibility object, please click <empty description> (dialog) [TUINSWindow] in the Hierarchy

Screenshot 2024-01-05 at 02 10 02

@wojciech-kulik
Copy link
Contributor

I can't everything blinks then and nothing changes in this app. But bubbles work if I change my config. This problem is caused by: #71 (comment)

@nikitabobko
Copy link
Owner

Safari's 'Login with google' window mistakenly reports that it has a fullscreen button. In UI, the button is not clickable, but if you click it using accessibility API then Safari crashes. I reported the bug to Apple (no hope that they will fix it though)

0.8.3 fixes this problem by manually checking enabled/disabled state of the button

@mike1808
Copy link

mike1808 commented May 7, 2024

@wojciech-kulik

When the caps lock is enabled, the system presents a small green bubble (sometimes it shows also language). AeroSpace treats it as a new window and applies tiling

It should have been fixed in #53 One day, I will introduce aerospace list-windows --debug to print all the accessibility info about windows, so it will be easier to diagnose problems like this.

I don't think it got fixed. Whenever I switch languages the small blue window showing selected layout gets treated as standalone window.

aerospace.mp4

@wojciech-kulik
Copy link
Contributor

@mike1808 yeap, I finally gave up and switched to layouting shortcuts like those from Rectangle/Magnet without window management. I tried tons of apps, this one is the most promising, but I realized that most of the time I'm actually fighting with glitches and issues while 95% of the time I'm just using a single window without any side-by-side layouts.

@nikitabobko
Copy link
Owner

Whenever I switch languages the small blue window showing selected layout gets treated as standalone window

@mike1808 please try to capture the debug information of the popup window with aerospace debug-windows command

@mike1808
Copy link

mike1808 commented May 17, 2024

Whenever I switch languages the small blue window showing selected layout gets treated as standalone window

@mike1808 please try to capture the debug information of the popup window with aerospace debug-windows command

Here is the extra window which appears:

rg.mozilla.firefox.window.252 windowId: 252
org.mozilla.firefox.window.252 workspace: 9
org.mozilla.firefox.window.252 treeNodeParent: Workspace(name: '9', isVisible: 'true', isEffectivelyEmpty: 'false')
org.mozilla.firefox.window.252 recognizedAsDialog: true
org.mozilla.firefox.window.252 AXTitle: Optional()
org.mozilla.firefox.window.252 AXRole: Optional(AXWindow)
org.mozilla.firefox.window.252 AXSubrole: Optional(AXDialog)
org.mozilla.firefox.window.252 AXFocused: Optional(0)
org.mozilla.firefox.window.252 AXFullScreen: Optional(0)
org.mozilla.firefox.window.252 AXFrame: Optional(<AXValue 0x6000024a6a80> {value = x:29.000000 y:621.000000 w:144.000000 h:77.000000 type = kAXValueCGRectType})
org.mozilla.firefox.window.252 AXPosition: Optional(<AXValue 0x600003fedb00> {value = x:29.000000 y:621.000000 type = kAXValueCGPointType})
org.mozilla.firefox.window.252 AXGrowArea: nil
org.mozilla.firefox.window.252 AXMinimizeButton: nil
org.mozilla.firefox.window.252 AXDocument: nil
org.mozilla.firefox.window.252 AXSections: nil
org.mozilla.firefox.window.252 AXCloseButton: nil
org.mozilla.firefox.window.252 AXMain: Optional(0)
org.mozilla.firefox.window.252 AXActivationPoint: Optional(<AXValue 0x600003fba580> {value = x:-1.000000 y:1118.000000 type = kAXValueCGPointType})
org.mozilla.firefox.window.252 AXFullScreenButton: nil
org.mozilla.firefox.window.252 AXProxy: nil
org.mozilla.firefox.window.252 AXDefaultButton: nil
org.mozilla.firefox.window.252 AXMinimized: Optional(0)
org.mozilla.firefox.window.252 AXParent: Optional(<AXUIElement Application 0x600003fca3d0> {pid=795})
org.mozilla.firefox.window.252 AXTitleUIElement: nil
org.mozilla.firefox.window.252 AXCancelButton: nil
org.mozilla.firefox.window.252 AXModal: Optional(0)
org.mozilla.firefox.window.252 AXZoomButton: nil
org.mozilla.firefox.window.252 AXSize: Optional(<AXValue 0x600003fedb00> {value = w:144.000000 h:77.000000 type = kAXValueCGSizeType})
org.mozilla.firefox.window.252 AXToolbarButton: nil
org.mozilla.firefox.window.252 Ignored: AXChildrenInNavigationOrder, AXChildren, AXRoleDescription
org.mozilla.firefox            AXRole: Optional(AXApplication)
org.mozilla.firefox            AXTitle: Optional(Firefox)
org.mozilla.firefox            AXFunctionRowTopLevelElements: [
org.mozilla.firefox            ]
org.mozilla.firefox            AXFrame: nil
org.mozilla.firefox            AXFocusedUIElement: AXUIElement(windowId=3424, title="", role="AXTextArea", subrole=nil)
org.mozilla.firefox            AXFrontmost: Optional(1)
org.mozilla.firefox            AXExtrasMenuBar: nil
org.mozilla.firefox            AXMainWindow: AXUIElement(windowId=3424, title="Float "small" windows · Issue #47 · nikitabobko/AeroSpace", role="AXWindow", subrole="AXStandardWindow")
org.mozilla.firefox            AXFocusedWindow: AXUIElement(windowId=3424, title="Float "small" windows · Issue #47 · nikitabobko/AeroSpace", role="AXWindow", subrole="AXStandardWindow")
org.mozilla.firefox            AXMenuBar: Optional(<AXUIElement 0x600003fee070> {pid=795})
org.mozilla.firefox            AXWindows: [
org.mozilla.firefox                AXUIElement(windowId=252, title="", role="AXWindow", subrole="AXDialog"),
org.mozilla.firefox                AXUIElement(windowId=3424, title="Float "small" windows · Issue #47 · nikitabobko/AeroSpace", role="AXWindow", subrole="AXStandardWindow")
org.mozilla.firefox            ]
org.mozilla.firefox            AXSize: nil
org.mozilla.firefox            AXPosition: nil
org.mozilla.firefox            Ignored: AXChildren, AXChildrenInNavigationOrder, AXEnhancedUserInterface, AXPreferredLanguage, AXRoleDescription, AXHidden

I also noticed that issue only happens in firefox and only on workspace 9. In my config I had this:

[[on-window-detected]]
if.app-name-regex-substring = 'firefox|spotify'
run = ['layout tiling', 'move-node-to-workspace 9']  

After removing it, the issue got resolved.

nikitabobko added a commit that referenced this issue May 19, 2024
#47 (comment)

Motivation: for some reasons, AXCursorActionsWindow isn't set in some
machines

Anyway new aggressive method should also detect context menus (right
mouse click) in IntelliJ, Telegram and who knows what else
@nikitabobko
Copy link
Owner

@mike1808 should be fixed in 0.11.0-Beta

@mike1808
Copy link

@mike1808 should be fixed in 0.11.0-Beta

thanks, that helped!

@mike1808 yeap, I finally gave up and switched to layouting shortcuts like those from Rectangle/Magnet without window management. I tried tons of apps, this one is the most promising, but I realized that most of the time I'm actually fighting with glitches and issues while 95% of the time I'm just using a single window without any side-by-side layouts.

You do you, but Aerospace is much more than Rectangles/Scissors. It's a full blown window manager. I love it a lot and rarely had issues and even if I had them @nikitabobko was very responsive in fixing them.

jakenvac pushed a commit to jakenvac/AeroSpace that referenced this issue Aug 16, 2024
jakenvac pushed a commit to jakenvac/AeroSpace that referenced this issue Aug 16, 2024
nikitabobko#47 (comment)

Motivation: for some reasons, AXCursorActionsWindow isn't set in some
machines

Anyway new aggressive method should also detect context menus (right
mouse click) in IntelliJ, Telegram and who knows what else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants