pawelgrzybek Posted August 26, 2016 Share Posted August 26, 2016 (edited) 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). DownloadDownload Div from PackalHow 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 Edited February 3, 2019 by pawelgrzybek Update hotkeys manual cfchou, geberl, 40-02 and 2 others 4 1 Link to comment
40-02 Posted August 31, 2016 Share Posted August 31, 2016 Nice workflow! Thanks for sharing! Link to comment
pawelgrzybek Posted September 1, 2016 Author Share Posted September 1, 2016 I'm glad you liked it. Enjoy Link to comment
Craig Hamilton Posted August 11, 2017 Share Posted August 11, 2017 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 Link to comment
jvdmeij Posted August 12, 2017 Share Posted August 12, 2017 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
geberl Posted August 13, 2017 Share Posted August 13, 2017 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 Craig Hamilton 1 Link to comment
deanishe Posted August 13, 2017 Share Posted August 13, 2017 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. Craig Hamilton 1 Link to comment
jvdmeij Posted August 13, 2017 Share Posted August 13, 2017 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
Craig Hamilton Posted August 15, 2017 Share Posted August 15, 2017 Wonderful! Thanks, deanishe, I know this awesome community would know what is going on. Link to comment
Craig Hamilton Posted August 15, 2017 Share Posted August 15, 2017 Oh, and thanks to you too, geberl, thanks for the step-by-step. Link to comment
pontus Posted August 15, 2017 Share Posted August 15, 2017 (edited) Great workflow! I wish it had support for multiple screens… Edited August 15, 2017 by pontus Link to comment
pawelgrzybek Posted August 16, 2017 Author Share Posted August 16, 2017 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
Aysun Posted August 22, 2017 Share Posted August 22, 2017 (edited) 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 August 22, 2017 by Aysun fixed Link to comment
pawelgrzybek Posted August 22, 2017 Author Share Posted August 22, 2017 I'm glad that you sorted it out. Enjoy using Div Link to comment
Aysun Posted August 28, 2017 Share Posted August 28, 2017 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
pawelgrzybek Posted September 5, 2018 Author Share Posted September 5, 2018 Hi. Just to let you all know, latest version of Google Chrome v69 introduces a big layout and window behaviour changes. I just updated Div to nicely handle these changes and keep your workflow smooth. I described more technical details on this Github issue. Updated version of a workflow: Div on Packal Source code on GitHub Enjoy using Div ? Link to comment
pawelgrzybek Posted September 5, 2018 Author Share Posted September 5, 2018 Ps. I am still working on support for multiple screens. It turns out it is harder than I thought to do it via AppleScript only. shmulvad, cands and Vijay 3 Link to comment
Vijay Posted January 17, 2019 Share Posted January 17, 2019 This is a great workflow. Thank you. Eagerly waiting for the multi monitor support Link to comment
pawelgrzybek Posted January 30, 2019 Author Share Posted January 30, 2019 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. 👌 bivalvegruff 1 Link to comment
pawelgrzybek Posted February 3, 2019 Author Share Posted February 3, 2019 Multiple screen support just landed. https://github.com/pawelgrzybek/div http://www.packal.org/workflow/div bivalvegruff 1 Link to comment
pawelgrzybek Posted February 3, 2019 Author Share Posted February 3, 2019 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 Link to comment
cands Posted February 7, 2019 Share Posted February 7, 2019 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
pontus Posted February 9, 2019 Share Posted February 9, 2019 On 2/3/2019 at 5:41 PM, pawelgrzybek said: ☝️just landed Yeah, made me rediscover this workflow. Super handy! Big thanks Link to comment
pawelgrzybek Posted February 11, 2019 Author Share Posted February 11, 2019 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
pawelgrzybek Posted February 11, 2019 Author Share Posted February 11, 2019 On 2/9/2019 at 10:15 AM, pontus said: Yeah, made me rediscover this workflow. Super handy! Big thanks Thanks for using Div :) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now