ianyh / Amethyst

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

Hotkey for Main Pane #356

Open jasonology opened 8 years ago

jasonology commented 8 years ago

This enhancement is primarily for using in Tall, Wide and Widescreen-Tall layouts.

I would like to be able to assign a hotkey which, while it is held down and Focus Follows Mouse is on, makes the target window (the one my mouse is over) into the Main Pane.

This is to avoid having to use the “Swap focused window clockwise/counter clockwise” shortcuts.

This might also need a delay in milliseconds value so I don't trigger it while moving over a window I don't want to become the Main Pane.

Trello Card

ianyh commented 8 years ago

If you want to make the focused window the main pane window you can use the swap focused with main command (mod1+enter by default). Does that work?

jasonology commented 8 years ago

Ah yes. It does. I suppose this enhancement would just tie that into the Focus Follows Mouse function somehow.

ianyh commented 8 years ago

I'm confused. Why can't you use focus follows mouse alongside that command? It seems like adding another command specifically for focus follows mouse would be duplicating logic.

jasonology commented 8 years ago

The utility “Zooom2” implements a kind of Focus Follows Mouse they call “Auto Raise”. zooom2autoraise I was hoping for the idea in Amethyst to look like this:

✅Ignore Menu Bars ✅Mouse follows focused windows ✅Focus follows mouse (experimental) ✅Swap Focused Window with Main Only when these keys are pressed: ☐fn ☐⇧ ☐‸ ☐⌥ ☐⌘ Delay: 0.20s ← this would be an editiable field

This way I can hold down a modifier key with my non-mouse hand, and after n milliseconds the Focused window becomes the Main Pane.

ianyh commented 8 years ago

That still seems like using a hot key, but putting a delay on it. Is the advantage being able to do it with one hand? Why not use z or m, whichever end your off hand is?

jasonology commented 8 years ago

I don't understand. How can I use z or m to do this? Come to think of it, a user might want to just make windows into the Main Pane just to view them without changing Focus, a bit like in HyperDock. Personally I would use this feature to make windows over which I hovered into the Main Pane and then have that receive Focus so I can work in them.

ianyh commented 8 years ago

Sorry, was on a phone and couldn't give more of an explanation. Will try to give a more expansive answer, but in the meantime by z or m I meant mod1+z or mod1+m which would both be one handed commands, leaving your other hand for the mouse.

jasonology commented 8 years ago

OK I see what you mean. You meant remap the mod1 + return - swap the focused window with the main window (two handed keyboard shortcut) to mod1 + z (left hand) However I often assign one of these modifier keys to an extra mouse button on my multi-button mouse, so the whole operation becomes mouse-based and one handed.

jasonology commented 8 years ago

So, is it hard to have Amethyst send the mod1+z for me after Focus is applied to a window? That's really all it needs to do.

ianyh commented 8 years ago

It's actually non-trivial to make anything time-based. The way you define shortcuts is generally a binary switch of either pressed or released, which (a) assumes a keyboard, (b) assumes an instantaneous interaction, and (c) doesn't work for just modifiers. I think I know, theoretically, how to do this in general, but it would require monitoring all device events (keyboard, mouse, etc.) and coordinating between them over time. Even just monitoring the events independent of time is complicated. The naive approach works for cursor movements (which we use for focus-follows-mouse), but doesn't actually work for keyboard events as some applications consume them before they even hit the appropriate event target. I'm also not entirely sure what kind performance penalty monitoring would introduce, but I would expect it to be non-trivial. Even just focus-follows-mouse incurs a pretty hefty performance hit, which is the only reason there's a delay in focusing in the first place.

This could be something for the future, but I'm not sure I see it happening in the immediate future.

gwerbin commented 8 years ago

What about a general "undo" hotkey?