3 Replies
      Latest reply: Jan 5, 2017 2:59 AM by eskimo RSS
      Mallikarjuna Reddy Punuru Level 1 Level 1 (0 points)

        We have failed to get window title from daemon service, please help us to resolve this issue.

        • Re: How to get Window Title from Daemon Service?
          eskimo Apple Staff Apple Staff (6,665 points)

          We have failed to get window title from daemon service …

          In general a daemon is not allowed to connect to the window server and thus cannot get information about windows.  In many cases there are reasonable ways to work around issues like this.  If you can explain more about your high-level goạl, I should be able to advise you from there.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

            • Re: How to get Window Title from Daemon Service?
              Mallikarjuna Reddy Punuru Level 1 Level 1 (0 points)

              Hi Eskimo,

               

                   Our task is to get Active Window Title for one of the Current Running Application on the System from the Daemon Service. Yes, daemon service not allowed to connect Graphic Devices. So could you please provide some work arround to get Active Window Title on the particular system.

                • Re: How to get Window Title from Daemon Service?
                  eskimo Apple Staff Apple Staff (6,665 points)

                  Our task is to get Active Window Title for one of the Current Running Application on the System from the Daemon Service.

                  There’s no supported way to do this from a daemon.  You will need to create a GUI launchd agent that does this work from within the GUI login session and reports the results to your daemon via IPC.

                  IMPORTANT There can be multiple GUI login sessions (via both fast user switching and simultaneously login over screen sharing), so you’ll need to decide on a policy for handling that.

                  Your GUI launchd agent can get some information about the window list from the window server (see <CoreGraphics/CGWindow.h>) but that’s rather limited.  The only way to get detailed information about each window is via the accessibility API (starting with AXUIElementCreateApplication).

                  Share and Enjoy

                  Quinn “The Eskimo!”
                  Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                  let myEmail = "eskimo" + "1" + "@apple.com"