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

Add Support for Loop WM #1738

Open
plyght opened this issue Jan 26, 2025 · 0 comments
Open

Add Support for Loop WM #1738

plyght opened this issue Jan 26, 2025 · 0 comments

Comments

@plyght
Copy link

plyght commented Jan 26, 2025

Problem Description

Window Reversion After Manual Loop Adjustment
When using Loop’s radial menu (with mouse/arrow keys) to manually reposition a window over another:

  1. Moved window overlaps target window (no swap occurs).
  2. Switching focus to another window/app triggers Amethyst to revert the moved window to its original pre-Loop position.
  3. Expected behavior: Amethyst should treat the Loop-adjusted position as intentional and swap windows instead of restoring old layouts.

Root Cause Analysis

  • Amethyst’s layout engine periodically reasserts its tiling logic (e.g., on focus changes), overriding manual Loop adjustments.
  • Loop’s movement logic does not update Amethyst’s internal state, causing a "layout drift" that Amethyst "corrects" aggressively.

Requested Solution

1. Manual Window Position Locking

  • Add a lock_window_positions: bool config option to pause layout reassertion for manually moved windows.
  • Integrate with macOS’s AXUIElementSetAttributeValue to flag windows moved via external tools.

2. Swapping Instead of Reversion

  • When Amethyst detects a window was manually moved over another:
    • Swap their positions in the layout grid (if compatible with active layout).
    • Resize both windows to fit the layout (e.g., halves, thirds).

3. Loop-Specific Integration

  • Expose a Swift/AppleScript API for Loop to notify Amethyst of manual moves:
    AmethystBridge.shared.notifyWindowMoved(windowID: CGWindowID, newFrame: CGRect)  
  • Add Amethyst config to trust Loop-sourced movements:
    experimental:  
      accept_external_window_events:  
        - com.MrKai77.Loop  

Alternatives Tested & Rejected

  • Yabai’s window_placement=second_child: Works for swaps but lacks Loop’s radial UX.
  • Amethyst’s mouse_follows_focus: No impact on layout reversion behavior.
  • Disabling Amethyst temporarily: Defeats the purpose of hybrid tiling.

Additional Context

  • Reproduction Steps:

    1. Open two windows in Amethyst (Tall layout).
    2. Use Loop’s radial menu to move Window A over Window B.
    3. Click Window C (or another app).
    4. Observe: Window A snaps back, overlap persists.
  • Technical Constraints:

    • Loop cannot inject NSEvent to mimic Amethyst-native resize commands.
    • Amethyst’s WindowManager does not account for external frame changes unless triggered via its own logic.
  • Proposed Architecture:

    Loop Movement → AX API → Amethyst Observer → Layout Recalculation → Swap/Resize  
    
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

1 participant