ianyh / Amethyst

Automatic tiling window manager for macOS à la xmonad.
https://ianyh.com/amethyst/
MIT License
14.68k stars 487 forks source link

Feature request: Allow for tracking window identity (IDs) in custom layouts on Sonoma #1571

Closed joliss closed 8 months ago

joliss commented 11 months ago

It would be fantastic if Amethyst exposed some way to track window identity across calls to getFrameAssignments in custom layouts, as the ids seem to have become unstable in Sonoma.

I just wanted to post this as a follow-up feature request to the problem I encountered in https://github.com/ianyh/Amethyst/issues/1570#issuecomment-1783530190. I hope you don't mind me opening a new issue for this – I was just trying to figure out whether or not there's any hope that this might be fixable in Amethyst, before I spend an afternoon working around this in my custom layout code. If you think it's not doable or worthwhile, I completely understand if you want to simply close this issue.

For what it's worth, the window IDs don't seem to be completely random, but rather change and swap semi-randomly. This makes me wonder if we're seeing the result of some non-deterministic operation on the set of window IDs, like getting the keys from a hash table in unspecified order.

P.S. I saw the "Donating" section in the README, but if you ever want to charge for a license, even if it's just an optional fee (e.g. by putting Amethyst binaries in the app store), I'd be more than happy to pay! I bought a Pro Display XDR from Apple, and Amethyst helps me get value out of all the screen real estate, so even something like $99 would be a no-brainer compared to the hardware cost. Just thought I'd mention cause I'm feeling a bit freeloadery just asking for features without offering a patch.

joliss commented 10 months ago

I just looked into working around this, by reconstructing the state from the window positions, but now I don't think that's a feasible workaround. That's because the updateState functions in each command get a focusedWindowID and return a state, like so:

    commands: {
      command1: {
        description: "Move window to left pane",
        updateState: (state, focusedWindowID) => {
          state.runCommand(focusedWindowID, LEFT); // my code
          return state;
        }
      },

But because the window IDs are no longer stable, I cannot return a state that the next call to getFrameAssignments can meaningfully act on.

ianyh commented 8 months ago

Figured it out. Unstable JSON key ordering!

ianyh commented 8 months ago

Also, I very much appreciate the kind words. I've considered various open source funding mechanisms, but when it comes down to it I think it would be a source of stress beyond my normal software job stress, and I would prefer to do this because I care about it when I have time.