Jump to content
pawelgrzybek

Div — simple windows manager

Recommended Posts

Div — simple windows manager

This is simple Alfred workflow to help you manage opened windows. It is simple (50 lines of applescript) but powerful tool. It allows you to create your own layouts, custom sizes and custom proportion.

Requirements

Some of the mac OS apps are non-scriptable which means they are not working very well with applescript. Fortunately "SystemEvents" can handle them really well. Few simple steps are required to enable Alfred's access to Accessibility tools.

1. Open System Preferences
2. Go to Security & Privacy
3. Go to last Privacy tab
4. On the left panel choose Accessibility
5. Unlock access to preferences by clicking lock in bottom left corner and pass your password
5. Click small `+` icon and add Alfred from the list.
6. Done :)

Other windows managers requires similar procedure. It is not related with Div only. If you use older operating system than El Capitan, have a look at great instruction on [Mizage website](http://mizage.com/help/accessibility.html).

 

Download

Download Div from Packal

How to use

 

I published a detailed instruction on my personal website. Have a look if you are keen to understand a full potential of Div.

Choose predefined layout

Simply type `div` in Alfred window and choose layout from predefined list.

Custom bounds

Choose custom bounds by passing 4 space separated values. For example `div 20 20 80 80` will place top left corner of an app 20% from top and 20% from left edge of a screen, and bottom right corner 80% from top and 80% from left edge of a screen.

Custom size

Choose custom size by passing 2 space separated values. For example `div 800 600` will resize your window to 800px width and 600px height and place the window on the middle of a screen.

Hotkeys

Use predefined settings and bind custom hotkeys to them to place window in common locations:

- ⌃ ⌥ 1  Full
- ⌃ ⌥ 2  Medium
- ⌃ ⌥ 3  Small
- ⌃ ⌥ ←  Left
- ⌃ ⌥ →  Right
- ⌃ ⌥ ↑  Top
- ⌃ ⌥ ↓  Bottom

 

2016-08-28-3.gif

 

2016-08-28-4.gif

 

2016-08-28-5.gif

 

2016-08-28-6.gif

Edited by pawelgrzybek
Update hotkeys manual

Share this post


Link to post
17 hours ago, Craig Hamilton said:

I really like the workflow!  I'm having trouble getting the predefined hotkeys to work.  Is there any setup that needs to done to enable them?

Thanks, Craig

 

Same for me. Followed the steps and gave Alfred access to the accessibility tools.

 

I have another extensions which is accessible via keyboard shortcuts, and that one works just fine.

 

Would love some tips.

Share this post


Link to post

The key bindings were also not present for me after I imported the workflow into Alfred.

 

A quick diff between the downloaded version and my edited workflow shows no differences though. So this is not the fault of the author but some Alfred security/compatibility measure on import.

 

You can edit this quickly yourself though:

- Go into Alfred Preferences, select the Workflows tab, then find the Div workflow on the left side

- Double click into each of the boxes titled "Hotkey"

- With selection on the "Hotkey" textbook press for example (control) + (option) + (left)

- Save

- Repeat with next box

 

The order is: Left, Right, Top, Bottom, Full-Screen, Medium-Size, Small-Size

Share this post


Link to post
20 minutes ago, geberl said:

some Alfred security/compatibility measure on import.

 

This. Alfred strips hotkeys when you import a workflow. It keeps your own hotkeys when you update a workflow, however.

Share this post


Link to post
1 hour ago, geberl said:

The key bindings were also not present for me after I imported the workflow into Alfred.

 

A quick diff between the downloaded version and my edited workflow shows no differences though. So this is not the fault of the author but some Alfred security/compatibility measure on import.

 

You can edit this quickly yourself though: [..]

 

Awesome, thanks for letting me know!

Share this post


Link to post

O hi!

 

I didn't expect that popularity of this little script! I can promise you guys that the support for multiple screens will come at some point very soon. Is there anything else that you would like to add to a workflow? I may reconsider some additional features as well.

 

Have a great day you all ?

Share this post


Link to post

Hey,

 

I've tried using this but I can't get it to work. It just does nothing. I gave permission to alfred. I imported div, I can see the presets in alfred when typing div, but selecting any option does nothing. Any idea why it doesn't work?

 

Thanks!

 

L.E. Don't know how but I got it working. Weird.

Edited by Aysun
fixed

Share this post


Link to post

Finally managed to figure out how to create custom sizing for this. Not really intuitive to be honest, but I suppose you have no other way around.

For example, it would be better if each value would mean the distance from it's own margin, just like in CSS. Margin 20 20 80 80 would go clockwise and thus you have the amount of space relative to the edges of the screen. Are you forced by some circumstances to go from top left edge of the screen? Thanks!

Share this post


Link to post

Quick update on multiple monitors support.

 

I finally find a way to make this workflow speak to ObjC NSScreen class. It means that the support for multiple monitors is coming very shortly. I am currently on a business trip, but you can expect it before end of this week.

 

👌

Share this post


Link to post
On 8/15/2017 at 6:23 PM, pontus said:

Great workflow! I wish it had support for multiple screens…

 

On 1/17/2019 at 3:38 AM, Vijay said:

This is a great workflow. Thank you.

Eagerly waiting for the multi monitor support :)

 

☝️just landed 

Share this post


Link to post

Thank you very much for making and improving this great workflow! I think it works great, just wonder is it possible to make it faster (i.e. decrease the time the workflow takes to move/resize windows)? It's not a big deal, but compared to some other window management programs, e.g. BetterTouchTool, it's a bit slower and improving speed would make it even more useful. 

Share this post


Link to post
On 2/3/2019 at 5:41 PM, pawelgrzybek said:

☝️just landed 

 

Yeah, made me rediscover this workflow. Super handy! Big thanks

 

Share this post


Link to post
On 2/7/2019 at 12:02 PM, cands said:

Thank you very much for making and improving this great workflow! I think it works great, just wonder is it possible to make it faster (i.e. decrease the time the workflow takes to move/resize windows)? It's not a big deal, but compared to some other window management programs, e.g. BetterTouchTool, it's a bit slower and improving speed would make it even more useful. 

 

Hi.

 

I noticed that since I added a support for multiple screens it takes a little bit longer for this workflow to do its job. It was expected tho. This workflow is built wit AppleScript and requires few calculations whenever you trigger the workflow. It needs to be aware of the screen size, how many screens, position of screens etc. On top of that it injects a NSScreen class from ObjectiveC macOS library — it takes some time to invoke it too.

 

I am not macOS dev / AppleScript expert, but I will do my best to improve the performance of this workflow. if you have any hints how to measure a performance of particular function / method it would be very helpful.

 

Native tools like BetterTouchTool etc. are built using compiles languages like ObjectiveC / Swift. It makes this apps very fast. Pros and cons. Div is just few kbs AppleScript workflow but performance isn't the best, BetterTouchTool is few mbs separated app but its very fast.

 

Thanks

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...