[MAC] XBMC won't give up focus to third party apps called within XBMC - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111) +---- Forum: Mac OS X (https://forum.kodi.tv/forumdisplay.php?fid=56) +---- Thread: [MAC] XBMC won't give up focus to third party apps called within XBMC (/showthread.php?tid=94757) |
[MAC] XBMC won't give up focus to third party apps called within XBMC - winestock - 2011-02-20 I have setup a program launcher to call Hulu Desktop which is tied to a button on the home screen. What I am running into is the issue where after a few times calling Hulu Desktop, with program lanucher, XBMC will trap the Apple Remote buttons. This gives the effect as if Hulu Desktop does not respond to the Apple Remote buttons. I have verified this by turning off full screen mode on Hulu Desktop (via the menu at the top left) and I can see XBMC processing the Apple Remote buttons. It even gets worse after continuous use where I can see the OS volume control operating (volume goes up when pressing +, volume goes down when pressing -) while tranversing the XBMC home screen buttons. When this happens I have to go into Settings -> SYSTEM -> Input Devices -> Apple Remote, Disable and then Standard. Is this an issue with XBMC where it won't give up window focus? I searched for a bug report on this but could not find anything. I know that there is a XBMC Hulu plugin and I have played around with it. I perfer to use Hulu Desktop. OSX Version 10.6.6 Platform 2008 24" 3.06GHz iMac with 4GB RAM Install Method dmg SVN Revision 35648 Skin Transparency! - winestock - 2011-02-20 I tried an alternate idea where I created a shell script that would kill XBMC, start Hulu Desktop and when Hulu Desktop exited restart XBMC. I ran into two problems with this. First, when I restarted XBMC after Hulu Desktop exited, I lost the use if the Apple remote operation in XBMC. The other problem I ran into was that after several executions of the script I lost use of the Apple remote even for Hulu Desktop. The only way I could correct his was to exit XBMC and kill off XBMCHelper. This behavior is the same no matter if I use the Confluence or Transparency skin. This is the script I was using: Code: #!/bin/bash I even tried killing off XBMCHelper before calling Hulu Desktop: Code: #!/bin/bash Has anybody managed to get something like this to work continuously? Maybe one of the developers could add there wisdom to this situation. Found partial solution - winestock - 2011-02-21 I was doing some research and it seems XBMCHelper is the program which handles the IR processing. So what occurred to me was if I killed off the XBMCHelper and then restarted it this might solve the problem which it does. Unfortunately, this created a new problem. If I have "Allow start of XBMC using remote" enabled and I exit XBMC, when I restart XBMC with the apple remote, XBMC will restart but I can't use the remote any longer. I have to manually kill XBMCHelper, exit XBMC and then manually restart XBMC before I can use the Apple remote again. jmarshall or davilla thoughts on this issue? Here is the script: Code: #!/bin/sh Finally got it to work - winestock - 2011-02-22 Okay, after thinking about the problem a bit more I decided to take a bit of a different approach to finding a work around. What I ended up doing is breaking the solution into two parts, a portion that runs in the background and a portion that runs in the forground. After a lot of testing I found out that I could not restart the XBMCHelper as part of the XBMC execution. If I restarted the XBMCHelper outside of XBMC I was able to solve the issue of getting XBMC to respond to the Apple remote after Hulu exited. This meant I had to created an independent background task outside of XBMC that I could control within XBMC. The foreground task was responsible for killing the XBMCHelper, starting Hulu and then restarting XBMCHelper again. Foreground StartHulu.sh called from the XBMC program launcher: Code: #!/bin/bash Background StartXBMCHelper.sh called from the user .profile: Code: #!/bin/bash Add to the user .profile: Code: "${HOME}/Library/Application Support/XBMC/scripts/StartXBMCHelper.sh" & Keep in mind that I consider this to be a work around until the issue is actually fixed in XBMC. I create this ticket for the issue. Update: I have modified the StartXBMCHelper.sh script so that it checks if it is already running, this prevents multiple copies from being executed. Also, according to ticket 11238 this solution will need to be done as the design of XBMCHelper is not designed for releasing focus. Update 2: I have modified StartXBMCHelper.sh script so that it restarts XBMCHelper so that it is detached from the StartXBMCHelper.sh script running in the background. What I found is when I kill XBMCHelper in the foreground and restart it in the background, when XBMC exits XBMCHelper is left as a zombie process. This creates the issue where XBMC thinks XBMCHelper is running and will not start it again. - winestock - 2011-02-23 As it turns out, .profile is only executed when a terminal is started which does not work so well for the intended use of the StartXBMCHelper.sh script. What needs to happen is the StartXBMCHelper.sh script get executed when the user logins. So to do this I created an apple script. Open the apple script editor and enter the following: Code: do shell script "${HOME}/Library/Application\\ Support/XBMC/scripts/StartXBMCHelper.sh >/dev/null 2>&1 &" Next click on File->Save As... Select Application for "File Format:" and name it StartXBMCHelper in the directory where the StartXBMCHelper.sh script resides. Exit the apple script editor. Open Accounts in System Preferences. Drag the StartXBMCHelper app to the Login Items. Now logout and log back in. Execute XBMC as usual. Update: I have simplified the apple script so that it fires off the shell script and then exits. Version 2 - winestock - 2011-02-26 Been playing around a little bit more. I have managed to simplify the scripts down to one script, no need for the background script or the apple script. What I ended up with is this: StartHulu.sh: Code: #!/bin/bash I simply point the program launcher to the above script and now I am able to execute Hulu Desktop, exit Hulu Desktop and return to XBMC and have the remote respond. Breaks if I exit XBMC - wardjame - 2011-06-23 Thanks for the script. It's almost perfect but I'm running into problems if I exit XBMC for anything other than Hulu. Again thanks for all the hard work on this it's still very useful for me but I occasionally will drop out of XBMC to open a web browser or some other program and afterwords my remote no longer works. Mac Mini running 10.5 Leopard with XBMC 10.1 dmg install Allow start of XBMC using the remote: On To reproduce: I boot the machine and launch XBMC with the menu button I exit XBMC I relaunch XBMC with the menu button Result: Everything is still working fine. I can do this repeatedly. I launch StartHulu.sh via Launcher inside XBMC I exit Hulu I exit XBMC I relaunch XBMC with the menu button XBMC is no longer responsive to remote commands. A reboot is required to fix the issue. xbmc.log: http://pastebin.com/PS4nBFC4 - winestock - 2011-06-25 wardjame Wrote:I launch StartHulu.sh via Launcher inside XBMC Hi wardjame, I was also able to reproduce the problem. I have no idea why the remote stops working after exiting and re-start XBMC from the remote. I am not sure if XBMC Helper was designed to be killed off and restarted while XBMC is running. Maybe one of the developers can chime in on this. Instead of rebooting the Mac-Mini do this when the remote stops working: 1) Open the terminal command. 2) At the terminal prompt enter: ps -a -U `whoami` | grep "osx/XBMCHelper" | grep -v grep 3) Observe the second number displayed on the far left, this is the UID number. You will use that the number in the next step. 4) At the terminal prompt enter: kill -9 <UID # observed in step 3> 5) Manually restart XBMC. - winestock - 2012-02-06 I wanted to revive this thread because I came up with a way to recover the use of the Apple remote when you exit and then restart XBMC after using Hulu Desktop. What I came up with was a script that runs at the user login and monitors when XBMC starts running and after it has exited it will restart the XBMCHelper if "Allow start of XBMC using the remote" as been enabled. Create a UNIX shell script called Monitor_XBMC.sh: Code: #!/bin/bash I wrote Monitor_XBMC.sh script so that it could work for XBMC 10 and XBMC 11. The location where XBMCHelper resides is different in XBMC 10 and XBMC 11. Set the following line in the shell script (to either 10 or 11) depending on what version of XBMC you are using: Code: # Which XBMC version is being used Open terminal and "cd" to where the Monitor_XBMC.sh resides. Execute the following from command: Code: chmod 755 Monitor_XBMC.sh Open the AppleScript editor and enter the following: Code: do shell script "cd ~; \"Library/Application Support/XBMC/scripts/Monitor_XBMC.sh\"" I place all my scripts pretaining to XBMC in ~/Library/Application Support/XBMC/scripts. This is where I placed the Monitor_XBMC.sh and Monitor_XBMC AppleScript. If you place Monitor_XBMC.sh in a different location make sure to change the Monitor_XBMC AppleScript to reflect that location. From the AppleScript editor select File -> Save As... Enter Monitor_XBMC as the Save As name and select Application as the File Format. This now creates a application that can be run stand alone. Open the folder where you created the Monitor_XBMC AppleScript application select Monitor_XBMC, Control-mouse-click and then select "Show Package Contents". Navigate to the Contents folder and open the info.plist with a text editor. Tranverse to the end of the info.plist file and add the following lines just before the last </dict> line: Code: <key>NSUIElement</key> Save the info.plist. What you have just now is modified the Monitor_XBMC application so that when you run it it will be hidden from the dock. The last thing that needs to be done is open System Preferences and add the AppleScript Monitor_XBMC application to login items. The Monitor_XBMC.sh script will be automatically run when you login. Let me know if there are any issues with using the script. No luck... - RodriguezF - 2012-02-25 My setup is simple: Safari is lauched via Advanced Launcher opens up. Even if the script is running XBMC won't quit. Can you help? - winestock - 2012-02-25 RodriguezF, The StartHulu script I wrote simply exits XBMCHelper when Hulu Desktop is executed. It does not exit XBMC. You can take my StartHulu.sh script and modify it so that it kills off XBMC and XBMCHelper and the executes /Applications/Safari.app/Contents/MacOS/Safari. It will also have to restart XBMC when Safari exits. StartHulu.sh Version 3 - winestock - 2012-03-04 I have simplifed the StartHulu.sh script further and made it XBMC version independent. This script will work for XBMC 10.1 and 11 without modifications: Code: #!/bin/bash Monitor_XBMC Version 2 - winestock - 2012-03-04 One of the things that I have changed with the XBMC_Monitor AppleScript is that it will execute the Monitor_XBMC.sh script in the background and then exit. The previous version of the AppleScript will wait for a reply back from the Montior_XBMC.sh shell script. This is version 2 of the Monitor_XBMC AppleScript: Code: do shell script "cd ~; \"Library/Application Support/XBMC/scripts/Monitor_XBMC.sh\" >/dev/null 2>&1 &" The changes that I have made to version 2 of the Monitor_XBMC.sh shell script is that I have simplified it and it will now work for XBMC 10.1 and 11 without modifications: Code: #!/bin/bash |