jhsrennie / MCERemote

XBMC add-on to configure eHome remote controls
GNU General Public License v3.0
4 stars 2 forks source link

Focus Kodi? #3

Open viking2 opened 3 years ago

viking2 commented 3 years ago

Is there some way that I can assign a key to bring Kodi in Focus?

I am using Kodi in a room far away from my computer where Kodi is installed. Sometimes a message or something pops up on this computer and Kodi is no longer in focus. The remote therefore stops working until I run up to my computer to bring Kodi in focus again.

p.s. With OpenPHT I used LM Remote Key map to bring OpenPHT in focus. However, I can not use this program with Kodi as some keys interfere.

viking2 commented 3 years ago

I assigned the "0" number to the path of Kodi (e.g. C:\xxx\kodi.exe). I started Kodi as adminstrator and applied the setting. I was told to restart windows (which I did).

However, nothing happens when I press "0". I checked the registry, and it appears that the assignment was not written:

jhsrennie commented 3 years ago

What I do configure a button the remote to generate some convenient hotkey, e.g. ctrl-shift-K, and then assign this as the hotkey for the Kodi shortcut on the desktop. If you don't have a Kodi shortcut on the desktop you can create one and assign the hotkey. Then check that pressing ctrl-shift-K runs Kodi, and finally confirm that pressing the button on the remote runs Kodi.

The point of this is that if Kodi is already running then starting it again will shift the focus to the already running instance rather than starting a new copy.

viking2 commented 3 years ago

Good idea! I works great. (However, I first used ctrl-shift-K as you suggested and that didn't work so well because that is the shortcut key for the Browser console)

viking2 commented 3 years ago

I am having problems with the hotkey. Sometimes it doesn't work (not sure why). I seems to work better if I just execute Kodi.exe again. Can I put in some command to directly start Kodi.exe instead of using a hot-key? I tried to use: System.Exec(exec) where exec is the path to Kodi.exe but that didn't work :-(.
(Why not?)

jhsrennie commented 3 years ago

If you run Kodi again e.g. from the Start menu this always works. That is after all just what the hotkey is doing.

I'm not sure where you are using System.Exec(). In a Python program?

viking2 commented 3 years ago

Yes, it usually works when I run it from the start menu using my PC. However, for unknown reasons, when I use the remote with the hotkey it often fails. I am in a different room from the PC when it fails, so it is difficult to troubleshoot. I just wanted to try to run Kodi.exe directly w/o the hotkey to see if that could be an issue. (Sometimes with the PC, the hotkey fails. If I reboot the PC it starts working again. I don't think that there is a conflict with another program that uses the same hotkey) .

I tried to use System.Exec() because it was listed here: https://kodi.wiki/view/Keymap#Universal_Remotes (see 6.18 System built-in's). I was hoping it would work even though it states it is used to run shell commands. I also tried to run a batch file: System.Exec(batch.bat) but that also didn't work.....

viking2 commented 3 years ago

I did some more troubleshooting. I appears that the (three) manually programmed MCERemote buttons*, e.g. the hotkey to start Kodi, often stops working. I can still start Kodi using the hotkey with the keyboard, but not with the Remote. I don't understand why the remote stops working for the (three) manually programmed MCERemote buttons. The regular buttons still work. This time I had to reprogram the buttons and reboot the PC to fix it.

BTW, I can not find the Windows Media Center button. I would like to reprogram that one to start Kodi. Is that possible?

jhsrennie commented 3 years ago

That's odd. It looks like a problem with the way the remote is working with Windows then.

viking2 commented 3 years ago

BTW, I can not find the Windows Media Center button. I would like to reprogram that one to start Kodi. Is that possible?

jhsrennie commented 3 years ago

The MCERemote addon for Kodi maps the Windows button (the green button) to control-shift-W. If you set this as the shortcut key for the Kodi icon then the Windows button will launch Kodi.

jhsrennie commented 2 months ago

Hi again (3 years later :-)

  1. Yes, the add-on modifies a Windows registry entry not a Kodi file. It makes the MCE remote emulate a keyboard i.e. when you press a button it has the same effect as pressing keys on the keyboard.

  2. Kodi no longer allows me to include executables in the add-on, so you need to download the keymap editor separately.

  3. I haven't tested the add-on with Windows 10 or 11 as I no longer use Kodi, though as far as I know it should still work. However it will require administrator access to modify the registry key. I'm a bit surprised running Kodi as administrator doesn't work. You could enable the administrator account and log in as administrator then run Kodi. That should definitely work.

viking2 commented 2 months ago

I just saw your response. I had deleted my post because I figured out how to solve it; I needed to click on "Open" after configuring (it wasn't intuitive but I must have done this a few years ago on my WIN7 machine).

BTW, why would I need to download the keymap editor? Wouldn't your Addon let me modify everything without it? I didn't download it but it works fine now...

jhsrennie commented 2 months ago

The add-on does not need the keymap editor. It's just an optional way of editing the Kodi keymap files.