8 Replies Latest reply: Nov 18, 2012 4:51 AM by Roguish
Roguish Level 1 Level 1 (0 points)

I've written a couple apps for iOS, but nothing major. And now I have a goal of writing my own window manager for OS X. Mainly because I find developing in XCode painful after using Windows Aero/Snap features. Yes, I know about several good existing window managers, but this project seems like a good way to get my feet wet in the Apple OS development arena. I've been Googling around for about an hour looking for answers to these questions, but I'm still not 100% sure on any of them. Here goes:

  1. What is the name for the default Lion / Mountain Lion Window Manager?
  2. X11/Quartz can be restored in 10.7+ to run "legacy" OS X apps. Does that have an effect on the existing window manager?
  3. Are there any open source projects that I could look at to get a handle on the concepts behind the Mac OS X 10.7+ system management?
  • 1. Re: (Mountain)Lion Window Manager Questions
    etresoft Level 7 Level 7 (24,270 points)

    Roguish wrote:

     

    now I have a goal of writing my own window manager for OS X.

     

     

    Why?

     

    Mainly because I find developing in XCode painful after using Windows Aero/Snap features.

     

    Such as? This is a Mac forum. I have no idea what "Aero" or "Snap" is.

     

    this project seems like a good way to get my feet wet in the Apple OS development arena.

     

    I'll go ahead and disagree with you on that one.

     

    What is the name for the default Lion / Mountain Lion Window Manager?

     

    There is no such thing.

     

    X11/Quartz can be restored in 10.7+ to run "legacy" OS X apps. Does that have an effect on the existing window manager?

     

    There is no window manager. X11 is an ugly, atroicious, obselete, decrept beast. If you need it for running some horrible academic/scientific application from 1993, then go knock yourself out with it. Otherwise, you are skipping right over the "painful" parts of Xcode and going right to masochism.

     

    Are there any open source projects that I could look at to get a handle on the concepts behind the Mac OS X 10.7+ system management?

     

    No.

     

    I suggest you start over and explain just what you consider "painful" about Xcode. It sounds like you just aren't familiar with it. There is really no other path to developing quality iOS or Mac software than Xcode. If you truly find "Windows Aero/Snap" more pleasurable, then do that. Otherwise, you are just wasting your time.

  • 2. Re: (Mountain)Lion Window Manager Questions
    Roguish Level 1 Level 1 (0 points)

    First off, thank you for the reply etresoft.  Let me answer your questions:

    Why?

    Why not? I know tons of stuff applicable to Windows, I'd like to know more about Mac OS.  And the best teacher is experience in my opinion.

     

     

    Such as? This is a Mac forum. I have no idea what "Aero" or "Snap" is.

    "Snap" is a rather convienient window resizing feature of Windows 7.  I suppose that I was a little misleading.  XCode isn't my problem, the minimalistic window controls in Mac OS X are my problem.  But I only have to deal with them in an irritating fashion when I'm coding in XCode, and, as you pointed out, to code for Apple products I need to use XCode. I just didn't want to start a flame war over operating systems.  I personally don't have an OS preference; if an application I need is only on Mac OS then I'll use Mac OS, if I need to write a document I'll use Word in Win7, if I need to rapidly prototype a script for research purposes I'll use Ubuntu.

     

     

    I'll go ahead and disagree with you on that one.

    It's a free country.  Could you suggest a better one besides the developer tutorials in the Mac Developer Library?  I've written a couple drivers using it, but I can't seem to find the correct wording to locate the current topic in there.

     

     

    There is no such thing.

    Really? What would you call Mission Control then (I finally succeeded with Google)?

     

     

    X11 is an ugly, atroicious, obselete, decrept beast. If you need it for running some horrible academic/scientific application from 1993, then go knock yourself out with it. Otherwise, you are skipping right over the "painful" parts of Xcode and going right to masochism.

    How about Inkscape, the free SVG editor?  Which is still in active development.  And as of this post requires Quartz to create an X11 window to run in.  I'm sure they'll get to updating it eventually, but until then I'd rather not shell out for Illustrator just to make SVG's quickly.

     

     

    No.

    Very helpful, thanks.

     

     

    I suggest you start over and explain just what you consider "painful" about Xcode. It sounds like you just aren't familiar with it. There is really no other path to developing quality iOS or Mac software than Xcode. If you truly find "Windows Aero/Snap" more pleasurable, then do that. Otherwise, you are just wasting your time.

    Or maybe you just aren't familiar with what "Window Manager" means. I want to code an application for OS X that would allow me to very quickly resize the active window to take up the right half of my screen by pressing command+<right arrow> (or something similar). The only shortcuts similar to what I want (that I use) are command+m (minimize) and command+<down arrow> (open current selection using the default app). Three existing window managers that I know of that seem promising and have nice feature sets are SizeUp, Cinch, and Optimal Layout.  But as I mentioned earlier I want to code it myself. As an exercise. To learn.   

    You are correct.  I'm way more familiar with MS Visual Studio and Eclipse than I am with XCode. Another reason I'd like to do more with it, to learn how to use it more effieciently. 

     

    Again, thank you for the time and effort you took responding to my post.  Next time could you be a little less smug (and a lot more helpful) when replying to an obviously new member to the forums? 

     

    "Otherwise, you are just wasting your time."

  • 3. Re: (Mountain)Lion Window Manager Questions
    K T Level 7 Level 7 (23,700 points)

    Type this into a Terminal window and hit return:

     

    man wm

  • 4. Re: (Mountain)Lion Window Manager Questions
    Roguish Level 1 Level 1 (0 points)

    @K T

     

    Are you serious? I can just create a macro to do what I want for 80% of this.

     

    0_0

     

    Well that's certainly a step in the right direction, Thanks!

  • 5. Re: (Mountain)Lion Window Manager Questions
    Roguish Level 1 Level 1 (0 points)

    So to help anyone else that ever wants to simulate Windows Snap, here is a simple script that reproduces Window+left functionality. The script is not very robust as it uses "magic numbers" for screen size instead of figuring them out dynamically, but whatever. Here you go:

     

    (Note: you may need to enable the "Enable access for assistive devices" checkbox in the Accessibility System Preference window to avoid geting an error when you run it...)

     

         1. Run Automator.

         2. Create a Service to Run an AppleScript

         3. Enter this into the Script Editor:

    tell application "System Events"

         set _everyProcess to every process

         repeat with n from 1 to count of _everyProcess

              set _frontMost to frontmost of item n of _everyProcess

              if _frontMost is true then set _frontMostApp to process n

          end repeat

     

          set _window to window 1 of _frontMostApp

          set position of _window to {0, 0}

          set size of _window to {960, 1280}

    end tell

     

         4. Set "Service recieves" to 'no input'

         5. Save the service.

         6. Launch the Keyboard System Preference window.

         7. Under Keyboard Shortcuts > General, assign command+left to your service.

         8. Repeat with minor modifications to the script code in step 3 to simulate the other Snap features.

     

    Disclaimer: doesn't work for every app. For instance XCode and Finder ignore it, but it works fine for Chrome and Terminal. I think its a window focus issue, but I could easilty be wrong. I'll update this when I figure it out.

  • 6. Re: (Mountain)Lion Window Manager Questions
    Michael Superczynski Level 5 Level 5 (7,455 points)

    Mission Control does all that and more.

  • 7. Re: (Mountain)Lion Window Manager Questions
    etresoft Level 7 Level 7 (24,270 points)

     

    Roguish wrote:

     

    Why not? I know tons of stuff applicable to Windows, I'd like to know more about Mac OS.  And the best teacher is experience in my opinion.

     

    But writing something like a window manager is hard. Wouldn't you rather start off slowly?


    "Snap" is a rather convienient window resizing feature of Windows 7.

    I have Windows 7 for running IE 9 to test web sites. It is dog-slow to I avoid it whenever possible.

     

    XCode isn't my problem, the minimalistic window controls in Mac OS X are my problem.  But I only have to deal with them in an irritating fashion when I'm coding in XCode

    Xcode is pretty-much an all-encompassing environment. You should only have one Xcode window open. Source files are in the editing pane.

     

    I just didn't want to start a flame war over operating systems.  I personally don't have an OS preference; if an application I need is only on Mac OS then I'll use Mac OS, if I need to write a document I'll use Word in Win7, if I need to rapidly prototype a script for research purposes I'll use Ubuntu.

    This is not Ars or Slashdot. This is Apple-land. Macs rule - end of story. If you try some Mac apps, you might find that Pages does anything Word does three times faster and OS X does anything Ubuntu does, only better.

     

    It's a free country.  Could you suggest a better one besides the developer tutorials in the Mac Developer Library?  I've written a couple drivers using it, but I can't seem to find the correct wording to locate the current topic in there.

    No, it isn't. As I said above, this is Apple-land. You asked about a good project to get your feet wet in the Apple OS development arena. Anything involving X11 would be a very poor project for that purpose because it would not teach you one thing about Apple OS development. If you want to learn about X11, then do something in X11. If you want to write a Mac application, then do that.

     

    Really? What would you call Mission Control then (I finally succeeded with Google)?

    You are talking X11-isms. You aren't going to replace Mission Control.

     

    How about Inkscape, the free SVG editor?  Which is still in active development.  And as of this post requires Quartz to create an X11 window to run in.  I'm sure they'll get to updating it eventually, but until then I'd rather not shell out for Illustrator just to make SVG's quickly.

    Adobe is not really a Mac development house anymore. They just churn out ugly, expensive cross-platform bloatware. Adobe's idea of an icon is a square with an "A" in it.

     

    If you are looking for quick and easy to use vector drawing tools, the Developer forum might not be the right place to ask. I use Logoist. It's not free but I can create documents faster than you can download and launch Inkscape.

     

    Or maybe you just aren't familiar with what "Window Manager" means.

    I know what a "Window Manager" is. If you want to ask something specific, please do so.

     

    I want to code an application for OS X that would allow me to very quickly resize the active window to take up the right half of my screen by pressing command+<right arrow> (or something similar).

    Was that so hard?

     

    The only shortcuts similar to what I want (that I use) are command+m (minimize) and command+<down arrow> (open current selection using the default app). Three existing window managers that I know of that seem promising and have nice feature sets are SizeUp, Cinch, and Optimal Layout.  But as I mentioned earlier I want to code it myself. As an exercise. To learn.

    You could cobble together some AppleScript such as you have already posted. However, that isn't going to teach you anything about OS X development either.

     

    Next time could you be a little less smug (and a lot more helpful) when replying to an obviously new member to the forums?

    Only if you meet me halfway. What kind of welcome would I get if I showed up in a Windows forum asking how I could learn about .NET by writing a Linux device driver? And then, for good measure, I call Visual Studio painful because it doesn't support some Mac features that Windows users have never heard of.

     

    This is a different world. There are no window managers and there never have been. Asking about X11 in OS X is like asking about DOS development in Windows. Sure, there are some people who still do that stuff, but I would never suggest anyone start there. X11 is just part of the UNIX compatibility layer - a foreign add-on. Most of the open source is in that layer too. If by "open source" you mean "free software", you should know that free software is pretty much incompatible with the Apple ecosystem and not by Apple's decision.

     

    I suggest you start by writing some applications. Use the Xcode project templates in File > New > Project > Cocoa Application. If you want to start on the command line, do File > New > Project > Command Line Tool > Foundation. Get used to Cocoa and Objective-C.

  • 8. Re: (Mountain)Lion Window Manager Questions
    Roguish Level 1 Level 1 (0 points)

    @Michael Superczynski

     

    Yes, Mission Control was what I was looking for at question 1.

    Thanks.