Skip to content

Software Engineer at Polygon

Div — a simple Alfred window manager

There are tons of window managers for Mac OS X around. Chris Coyier published a nice comparison of the most popular ones some time ago. These apps are great utilities that can boost your productivity by eliminating the time that you normally spend adjusting the window positions on your screen. I was using Divvy by Mizage for a long time and it worked like a charm for me. Another app that I use non-stop is Alfred. It looks like the default Spotlight search feature but it is much more powerful than that. It allows you to create advanced search functionality, custom hotkeys, explore files, control apps, store snippets, use clipboard history and so on. The app in itself is a subject that deserves a separate article (expect one soon).

Being uber minimalistic in terms of my workflow I decided to create a windows manager for Alfred. Say hello to Div! It is a simple Applescript (which incidentally was great fun to learn) with many triggers attached to it. I even created a logo for it :)

Div — simple Alfred windows manager logo

How to use Div #

As I mentioned previously — Div is a simple script with many options to control it. You can download it from Packal — a community driven repository of the best Alfred workflows. It comes with some predefined layout settings, but it’s dead easy to add custom ones. It is written in AppleScript — a very basic scripting language to do practical but also cool stuff on Apple computers.

Enable access for assistive devices (required) #

AppleScript works nicely with the majority of Mac OS X applications. Unfortunately some of them are non-scriptable. The solution is not to control app’s position but the window around it. We need to give Alfred access for assistive devices first. Just follow these easy steps:

  1. Open System Preferences
  2. Go to Security & Privacy
  3. Go to Privacy tab
  4. Go to the Accessibility on the left panel
  5. Click the lock and type your password
  6. Click small + icon and add Alfred from the list
  7. Done :)

Enable access for assistive devices on El Capitan

Predefined list of layouts #

Div comes with a predefined list of layouts. To use one simply type div and choose an option from the list.

Predefined list of layouts in Div Alfred workflow

Using hotkeys #

There are a few predefined settings. It is probably the quickest and most efficient way to manage your layouts. That’s how I use it mainly. Bind your favorite hotkeys to these settings or even add your own ones.

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

Using hotkeys in Div Alfred workflow

Custom arguments #

Sometimes predefined settings are not enough. Div knows how to deal with these situations. It allows you to pass custom arguments to create a custom position. It accepts two or four arguments.

Custom boundaries #

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

Custom boundaries in Div Alfred workflow

Custom size #

Choose a custom size by passing 2 (space separated) values. For example div 800 600 will resize your window to 800px wide and 600px high and place the window in the middle of the screen.

Custom size in Div Alfred workflow

Thanks for using Div #

Hopefully you will find it useful. If you need something more advanced have a look at the amazing Alfred 2 layout workflow by Bodo Junglas. As always, user feedback is welcome. Use the comments section below to share your love, opinions or report any bugs. If you would like to help me in the future development of Div feel free to fork it on Github and send a pull request. Enjoy!

Comments

  • z
    zeal7s

    Hi, I really like this workflow! It has become my most frequently used Alfred workflow. I hope it will support multiple screens in the future.

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
    • Pawel Grzybek
      Pawel Grzybek

      So happy to hear from happy user. I promise to drop support for multi screens very soon. Just need to find a spare moment and second screen to test with :) Thanks again @zeal7s:disqus for kind words!

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
    • Pawel Grzybek
      Pawel Grzybek

      Hi. Its been a while, but support for multiple monitors just landed :-)

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
      • V
        Vijay Teja

        Thank you so much for the multi monitor support!

        👆 you can use Markdown here

        Your comment is awaiting moderation. Thanks!
      • M
        Michael Le Du

        Thanks for this!

        Can you add to the road map: 1. Maximize, 2. Split screen, 3. move window to the next display (left/right)? with these additions I think most of us could remove the 3rd party apps we are using (I'm currently using MaxSnap because it's the only one I've seen that supports starting split screen)

        👆 you can use Markdown here

        Your comment is awaiting moderation. Thanks!
        • Pawel Grzybek
          Pawel Grzybek

          Can you elaborate a little bit about each of your feature requests please?

          👆 you can use Markdown here

          Your comment is awaiting moderation. Thanks!
          • M
            Michael Le Du

            Sure.

            1. Maximize is different than expanding the window the full screen width, this is basically equivalent to pressing the green window button when the window isn't maximized.

            2. Later versions of OSX have the ability to have 2 apps "maximized" next to each other, this is the equivalent to a long press on the green window button.

            3. Many window managers have a way of moving the active window to the next display. So in a two monitor setup you can move the window to the next display, often you can choose if it moves it to the display to the left or the display to the right (only really useful if you have >2 displays)

            👆 you can use Markdown here

            Your comment is awaiting moderation. Thanks!
            • Pawel Grzybek
              Pawel Grzybek

              Thanks for details and help.

              1. In my opinion globally accessible shortcut (Cmd + Shift + F) is much quicker than messing around with Alfred to maximize a window.

              2. I don't see a user friendly solution for this one within Alfred window interface. Even if this one is possible, it wouldn't be convenient to use.

              3. This is a feature that I was planing to add one day and you may be assured that I will add it at some point.

              Have a great day Michael :-)

              👆 you can use Markdown here

              Your comment is awaiting moderation. Thanks!
  • E
    Eric F

    Hey, this looks awesome. I dealt with the Accessibility settings. I'm still getting no response from selecting div commands from the Alfred command palette. Any ideas. I do use Path Finder instead of Finder, but I tried it with both active. Curious if you have this working on macOS Sierra

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
    • Pawel Grzybek
      Pawel Grzybek

      I'm sorry to see that something isn't working for you as expected. Can you describe your issue please? I'm more than happy to resolve a problem if it sit's on workflow's site. If its problem with your OS configuration I'll do my best to help you to run it.

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
    • M
      Márton Baranyai

      I experienced the same issue on macOS Sierra. Basically installed Alfred, downloaded and imported Div, turned on accessibility settings and nothing happens. Even restarting the computer did not help.

      Then I went into Alfred's preferences > workflows > div and started to poke around. Turns out, somehow the hotkey assignments are lost. I just reassigned "0 0 50 100" with is half size window on the left to "⌃ ⌥ ←", and now it started to work

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
  • W
    Will Beethoven

    Love it! Thanks for your great work!

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
    • Pawel Grzybek
      Pawel Grzybek

      Glad you found it useful! I'll update it very soon with few new features and support for multiple screens. Have a great day!

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
      • b
        burtonkent

        Any support for multiple screens yet? This is the only thing missing for me.

        👆 you can use Markdown here

        Your comment is awaiting moderation. Thanks!
        • Pawel Grzybek
          Pawel Grzybek

          Hi :-)

          I added support for multiple screens few months ago :) Works OK for me :)

          👆 you can use Markdown here

          Your comment is awaiting moderation. Thanks!
  • n
    nayma.pl

    So great workflow. I found Siema from you and that JS slider is great but this workflow is so great and blow my mind. So simple to use and customize and make my face smile !! Thank you.

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
  • D
    Dixens

    Thank you for this wonderful tool ! :-)

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
    • Pawel Grzybek
      Pawel Grzybek

      I'm happy that you found it useful. Have a great day 🍩

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
  • ~
    ~i.scorp

    Hi. Would love to use it. But it does not work for me either. Debugging in Alfred logs this "execution error: Finder got an error: Can’t get bounds of window of desktop. (-1728)". Settings in Accessibility done. Using latest version of Alfred and your workflow. Any ideas?

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
    • a
      andymcintosh

      I encountered this error too, but it turns out it was because I had disabled my desktop with this command (to hide the clutter): defaults write com.apple.finder CreateDesktop -bool FALSE; killall Finder.

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
      • Pawel Grzybek
        Pawel Grzybek

        Thanks for this tip. It solved an issue for you and for many other users.

        👆 you can use Markdown here

        Your comment is awaiting moderation. Thanks!
      • g
        gotofritz

        FYI - I used OnyX / parameters / 'hide desktop icons' to disable desktop icons, and the command you suggest doesn't work. But re-enabling desktop icons through OnyX fixed my problem

        👆 you can use Markdown here

        Your comment is awaiting moderation. Thanks!
  • j
    jvdmeij

    Awesome idea, and smart to implement it via Alfred. The extension works fine when entering div in Alfed, but I can't get the keyboard shortcuts to work. Alfred has access in the accessibility prefs. Any ideas why? Cheers!

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
    • j
      jvdmeij

      For anyone looking for a solution, You have to set the controls yourself. Check this out: https://www.alfredforum.com...

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
      • Pawel Grzybek
        Pawel Grzybek

        Thanks for your help a lot 😻

        👆 you can use Markdown here

        Your comment is awaiting moderation. Thanks!
        • k
          kari1358

          Super helpful. Thank you @pawelgrzybek:disqus for building such a good tool. It now works perfectly well for my MacBook Pro 2018 running Catalina. Thanks @jvdmeji, I am glad that this is a quick fix.

          👆 you can use Markdown here

          Your comment is awaiting moderation. Thanks!
          • Pawel Grzybek
            Pawel Grzybek

            Enjoy :-)

            👆 you can use Markdown here

            Your comment is awaiting moderation. Thanks!
  • M
    Mayank Jain

    This is a great workflow! Thanks for sharing

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!
    • Pawel Grzybek
      Pawel Grzybek

      Thanks a lot! I am glad that you found it useful.

      👆 you can use Markdown here

      Your comment is awaiting moderation. Thanks!
  • J
    Jason

    Seriously...Is no one going to comment on all the 90s reference gifs?!? Granted the David Hasselhoff one did give me the jitters a lil bit. Haha

    Anyway, great work on this workflow! I was just about to start using Raycast instead of Alfred if I hadn't found this neat trick. Keep up the good work!

    👆 you can use Markdown here

    Your comment is awaiting moderation. Thanks!

Leave a comment

👆 you can use Markdown here

Your comment is awaiting moderation. Thanks!