pawelgrzybek / div

Div — a simple Alfred window manager
https://pawelgrzybek.com/div-simple-alfred-windows-manager/
218 stars 19 forks source link

Would it be possible to add padding to options? #14

Closed tbrek closed 5 years ago

tbrek commented 5 years ago

Hi, great workflow. I wonder if it's possible to add optional padding when resizing windows?

pawelgrzybek commented 5 years ago

Hi.

It would be hard :( To add a padding is needs to be a global option. I bet that more users want their windows to be positioned absolutely with no padding so I am not going to do it globally for sure.

There is a hope tho. Embrace the power of creating your own hotkeys and assign custom settings to them. You can do a bit of math and position your windows with padding using 4 arguments notation. For example div 13 13 47 97.

Hopefully it makes sense to you. Have a great day 🥑

tbrek commented 5 years ago

Thanks for your reply.

I've done that by editing the script.

set positionX to ((item 1 of args / 100) * item 1 of screenSize) + (item 1 of screensOrigin) + 5 set positionY to ((item 2 of args / 100) * item 2 of screenSize) - (item 2 of screensOrigin) + 5 set sizeX to ((item 3 of args / 100) - (item 1 of args / 100)) * item 1 of screenSize - 10 set sizeY to ((item 4 of args / 100) - (item 2 of args / 100)) * item 2 of screenSize - 10 resizeApp(positionX, positionY, sizeX, sizeY)

pawelgrzybek commented 5 years ago

Cool. This is nice! The only downside if that it locks you to this version now. If I release some updates in a future (and I will) you may loose this functionality :(

tbrek commented 5 years ago

That's fine. I'm happy to update and then redo it.

pawelgrzybek commented 5 years ago

Cool. You can do this...

set padding to 5

...to keep the value in one place, and change it simply when you need it :-)