finestructure / Hummingbird

A macOS utility that makes window management a breeze
https://hbird.app
MIT License
218 stars 19 forks source link

Enhancement: Add edge magnetism #19

Open dlehman opened 4 years ago

dlehman commented 4 years ago

As a suggestion, add a user preference to "stop at screen edge" which would stop moving the current window (in that direction) once it hits a screen edge.

Currently, when you move past a screen edge (left, right, bottom), the window can be moved partially off-screen.

ChasonDeshotel commented 4 years ago

And/or a new key combination. For example, adding shift to your current hotkey would cause it to stop growing at the screen edge or if you want to get fancy adding shift once it's past the screen edge would snap it back

finestructure commented 4 years ago

Sorry, @dlehman , I completely missed your issue here.

To be honest, I actually want it to act this way. What I might do is add a little magnetism at the screen edge. I thought it was already there thanks to the underlying window management but when I tested it just now it worked only when moving windows via the title bar.

On the other hand the fact that I didn't know for sure is a good indicator how often I actually look for this :)

@ChasonDeshotel I feel like in a way - the reverse - this is already there. I'm using the default keys (surprise! ;)) of fn+ctrl to move and the additional opt to resize. So I can just move to the edge by holding fn+ctrl and then pressing opt when I hit the edge to shrink it.

That is when I'm at the left edge. On the right it takes a little extra push and shove as the resize acts on the lower right of the window. Still, I think it'd be very hard to explain that additional modifier behaviour. (I'm not even sure I fully understood what you're describing, to be honest.)

bxsx commented 4 years ago

To be honest, I actually want it to act this way. What I might do is add a little magnetism at the screen edge. I thought it was already there thanks to the underlying window management but when I tested it just now it worked only when moving windows via the title bar.

+1 for magnetism instead of total locking.

Keep in mind that user can connect multiple displays so total locking could avoid to move windows between screens.

bxsx commented 4 years ago

Spark application has a problem here.

For most applications, once I moved the window to the edge, it should just "push back" a little to see the window. However, instead of "pushing back" Spark moves totally out of screen and it's not easy to bring it back. Super annoying :(

finestructure commented 4 years ago

@bartskowron You mention Spark - did you mean to post this elsewhere or is this related to Hummingbird? It's not clear to me if you're referring to a problem with Spark (I don't know what Spark is/does btw) or Hummingbird.

bxsx commented 4 years ago

Spark is an email client app: http://sparkmailapp.com and while moving the app via Hummingbird it behaves as described above. Please take a look, Spark doesn't use a standard UI and I believe this is the issue. On the other hand, alternative apps for moving windows work correctly with Spark.

finestructure commented 3 years ago

Best I can tell right now this doesn't seem to be possible, at least not in the way HB works right now or without a lot of hackery. The issue is that the window in HB is an AXUIElement but in order to get the screen (NSScreen) that the window is on, I need an NSWindow (and use its screen property).

NSScreen.main by itself fails when moving windows that aren't in the foreground on a secondary screen.

apotenza92 commented 2 years ago

Hi has there been any additional movement on this idea? I think the way AltSnap does this on Windows 10 is great. It's optional whether to magnetise to screen edges or even other windows. It also lets you use snapping zones to quickly flick windows around into quarters / halves etc.

If Hummingbird somehow managed to move windows using the native technique it could get snapping for free with the help of other apps like Rectangle. I'd gladly pay more for Hummingbird if it included more of these options. Unfortunately I'm not experienced enough to be able to code something like that.