2 Replies Latest reply on Feb 20, 2009 8:40 AM by SeeGee

    mac questions - bounce / spaces / dock click

      Hi all,

      I have a few mac questions about an air application i have built using HTML/Javascript (jQuery)

      Firstly, i am using the bounce feature of the dock but although it is set to critical it only bounces once. I have a notifyUser function which is called when i want to do the notification, it looks like this:

      function notifyUser(){
      if(air.NativeApplication.supportsSystemTrayIcon){ // windows
      }else{ // mac
      I have tried air.NotificationType.CRITICAL and "critical" as the argument to bounce but nothing changes, the dock icon bounces once and then stops.

      Next problem, i have set the app up so that in windows there is an icon in the system tray, clicking on this will restore the window is minimised, this does nothing on a Mac. I know this is possible as tweetdeck does it so my code must be wrong but cant find anything in the documentation to say why. Here is the code that deals with adding icons to system tray in windows and dock in mac:

      $(document).ready(function() {
      window.nativeWindow.alwaysInFront = true; // always the top window

      var iconLoad = new air.Loader();
      var iconMenu = new air.NativeMenu();
      var openCommand = iconMenu.addItem(new air.NativeMenuItem("Open"));
      var exitCommand = iconMenu.addItem(new air.NativeMenuItem("Exit"));
      air.NativeApplication.nativeApplication.icon.bitmaps = [];

      var iconLoadComplete = function(event){
      air.NativeApplication.nativeApplication.icon.bitmaps = new runtime.Array(event.target.content.bitmapData);
      var systray = air.NativeApplication.nativeApplication.icon;

      function setIcons(){
      if(air.NativeApplication.supportsSystemTrayIcon) {
      air.NativeApplication.nativeApplication.autoExit = false;
      iconLoad.load(new air.URLRequest("icons/16x16.png"));
      air.NativeApplication.nativeApplication.icon.tooltip = "PX Notifier";
      air.NativeApplication.nativeApplication.icon.menu = iconMenu;
      iconLoad.load(new air.URLRequest("icons/128x128.png"));
      air.NativeApplication.nativeApplication.icon.menu = iconMenu;
      Clicking on icon in system tray in windows when minimised will show the app again, on Mac nothing happens.

      Last problem, on Mac's i cannot view the app inside spaces so combined with the fact that clicking on the icon doesnt jump to it, it becomes easy to lose the app in a window.

      Hope someone can help with some of this, thanks a lot.
        • 1. Re: mac questions - bounce / spaces / dock click
          Joe ... Ward Level 4
          I don't know why you only get one bounce, your code looks correct. It is supposed to bounce until your app becomes active (or not at all if the app is already active).

          Becasue of the way the Mac works, your app doesn't receive a click event when the user clicks on the Dock icon. Instead it receives an InvokeEvent.

          I don't understand what you mean by "i cannot view the app inside spaces."
          • 2. Re: mac questions - bounce / spaces / dock click
            SeeGee Level 1
            thanks for that, i have solved most of this by removing window.nativeWindow.alwaysInFront = true for Mac's only using it inside if(air.NativeApplication.supportsSystemTrayIcon) .. it seems mac's don't placy nicely with always on top. What i meant by spaces is the osx application spaces - basically multiple desktops. Before i removed the always on top code the app would not show inside the spaces preview function but it works now.