Jump to content

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
Link to comment
  • 11 months later...
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.

Link to comment

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

Link to comment
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!

Link to comment

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 ?

Link to comment

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
Link to comment

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!

Link to comment
  • 1 year later...
  • 4 months later...
  • 2 weeks later...

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. 

Link to comment
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

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...