Run custom action on custom hotkey?
-
@SanyaIV maybe you can find useful info here:
https://retropie.org.uk/docs/Universal-Controller-Calibration-&-Mapping-Using-xboxdrv/There's also an useful thread created by @mediamogul :
https://retropie.org.uk/forum/topic/2861/guide-advanced-controller-mappings -
@meleu
Thank you for answering.The proposed solution seems a bit "much" for the rather simplistic functionality I'm after, but I guess it's harder than it looks.
I have another idea actually, which is listening on whether the screensaver is on, I think that is possible with xscreensaver, does RetroPie use xscreensaver? If not, does it have any equivalent way of doing it?
By the way, where is the Exit action that is a default hotkey defined? I'm thinking that maybe I can write in somethinh myself and recompile something if necessary but I don't really have the knowledge to do so.
-
@SanyaIV said in Run custom action on custom hotkey?:
does RetroPie use xscreensaver?
No. At least not on Raspberry Pi.
If not, does it have any equivalent way of doing it?
I don't know, but since it's Linux I think there are ways to do it.
By the way, where is the Exit action that is a default hotkey defined?
Esc
on keyboard.For joysticks, as you can see here in the docs, this config is defined in the file
/opt/retropie/configs/all/retroarch-joypads/YOUR_JOYSTICK_NAME.cfg
, more precisely in the lineinput_exit_emulator_btn
. But if you mean the "real" default hotkey definition for joysticks (i.e. that which is defined when there's no config for the joystick), there is none.I'm thinking that maybe I can write in somethinh myself and recompile something if necessary but I don't really have the knowledge to do so.
Wow. Do you really think it's simpler than use the xboxdrv? :-)
-
I don't think it's simpler, but xboxdrv would change the normal operations of the controller though, wouldn't it? I like how it works now in moonlight etc and don't want it to change to be an emulation of keyboard and mouse. As I understand it, it would require several different profiles and that seems cumbersome to deal with.
Regarding where exit is defined, I meant more of the lines of: where does RetroPie define what the exit line means? How does it know what to do once it's called? Technically I feel like I should be able to change that definition to do something else, like run a script instead of exiting whatever.
Either way this seems like a lot of work either way just to be able to bind a hotkey to a custom action. RetroPie already has a hotkey > action function, being able to define custom actions would be a very good addition. Is there anywhere I could request that? It would open up a loy of possibilities I think.
-
@SanyaIV said in Run custom action on custom hotkey?:
where does RetroPie define what the exit line means? How does it know what to do once it's called?
Oh... I think we have a misconception here... Actually RetroPie is a bunch of scripts made to easily install/uninstall/configure all the software needed to turn your Raspberry Pi (other platforms too) into a retrogaming station. After that, RetroPie does nothing.
The software that catch the select+start pressing is the emulator, usually RetroArch. If you want to change the behaviour of the "exit", you need to know how to code in C, change the source code on your end, and never upgrade your RetroArch again...
I'm not used to use xboxdrv, but I think you can achieve what you want with it. Let's wait if our fellow @mediamogul can help here, or you can ask this question on his thread.
-
I'll help if I can here. There is in fact a built-in function for xboxdrv that allows a script to be launched by a key command, but unfortunately, It's the one thing that I've never been able to get working. I wanted to use it myself to create a universal screenshot function that would launch raspi2png whenever pressed. Having looked into alternatives, this should still be possible by creating a service that would constantly look for a defined key command and then run a script when it sees that the key command has been pressed.
-
@meleu said in Run custom action on custom hotkey?:
@SanyaIV said in Run custom action on custom hotkey?:
where does RetroPie define what the exit line means? How does it know what to do once it's called?
Oh... I think we have a misconception here... Actually RetroPie is a bunch of scripts made to easily install/uninstall/configure all the software needed to turn your Raspberry Pi (other platforms too) into a retrogaming station. After that, RetroPie does nothing.
The software that catch the select+start pressing is the emulator, usually RetroArch. If you want to change the behaviour of the "exit", you need to know how to code in C, change the source code on your end, and never upgrade your RetroArch again...
I'm not used to use xboxdrv, but I think you can achieve what you want with it. Let's wait if our fellow @mediamogul can help here, or you can ask this question on his thread.
@mediamogul said in Run custom action on custom hotkey?:
I'll help if I can here. There is in fact a built-in function for xboxdrv that allows a script to be launched by a key command, but unfortunately, It's the one thing that I've never been able to get working. I wanted to use it myself to create a universal screenshot function that would launch raspi2png whenever pressed. Having looked into alternatives, this should still be possible by creating a service that would constantly look for a defined key command and then run a script when it sees that the key command has been pressed.
I've pretty much given up on the idea of having the controller launch a command now. Just seems like a bit too much hassle for something that feels like it should have been made already. I mean, binding a hotkey to do a custom thing doesn't seem like it should be that hard, and it's not when it comes to keyboards, but joysticks are different. And like I said, I don't really want my controller to act like a keyboard since it works fine like a joystick in my other applications and I don't want to mess that up.
Basically I want to be able to define what a hotkey does, rather than defining what hotkey an action has, if that makes sense? So if I understand correctly, that would be in RetroArch and it's them that I should be bothering instead. :P I just want to add my custom actions to the list of actions that are available, I just thought that should be possible but apparently not.
My next thought was using a script that checks if the system is idle every x seconds or minutes and if it is then send vcgencmd display_power 0 and if it's not then send vcgencmd display_power 1. But the problem here is that I can't find any actual standard "idle" state in Raspbian, the concept doesn't seem to exist. Instead I find people using their own scripts that generally look for key input and reset a timer(not really sure exactly, didn't spend too much time looking at this one) but that obviously doesn't work since the DualShock is a joystick which I don't know how to do the same for. But then Raspbian apparently has xscreensaver which gets activated after some idle time, and apparently you could check its state and depending on the response you could make a script that does one thing when xscreensaver is active and another when it's not. But apparently that won't work in RetroPie because it doesn't use xscreensaver and I assume it can't because of this "X" thing that I still don't know what it is. But RetroPie (or EmulationStation) obviously have SOME sort of concept of idle since it can dim the screen after some time, so my thought now is: Can >I< query this particular system to ask it if it is dimmed or not? If I can, then my script could be [query every 1 minute, if active > display 0, if inactive > display 1] OR perhaps the creator could add another option besides Dim and a black screen, namely doing the vcgencmd display_power 0/1, but I'm guessing whichever part is taking care of that wasn't made for the RPi specifically so that'd probably be denied.
But I don't even know where to begin asking that question, it seems like I'm actually in a hunt for probably a single person that would know that answer, and the answer would probably be "No, why would I have made that?" So now I'm just feeling very off-put from doing something that just straight-up feels like one of the absolutely most basic things, but apparently it's not. Who knew scheduling something during idle was so damn hard, I didn't, but I do now.. And I've given up. I'm just going to continue walking up to my HMDI switch and manually switch it to my PS4 that properly turns off the screen when it isn't running.
Thank you both for the help.
Edit:
Regarding the dim-route-solution in EmulationStation, I would assume this is a dead end as well. Unless I'm mistaken ES development seems to have halted?
Edit2: Most of the time Kodi will be up and running, and kodi has its own idle thingie, maybe I can find a solution there? It'd be specific to Kodi though.
Edit3: I found an addon called Kodi CallBack or similar which seems to have the functionality I'm after. -
@SanyaIV said in Run custom action on custom hotkey?:
Basically I want to be able to define what a hotkey does, rather than defining what hotkey an action has, if that makes sense? So if I understand correctly, that would be in RetroArch and it's them that I should be bothering instead
Before requesting such thing to RetroArch team, first be aware of what is the scope of RetroArch. ;-)
RetroPie (or EmulationStation) obviously have SOME sort of concept of idle since it can dim the screen after some time
EmulationStation.
I'm guessing whichever part is taking care of that wasn't made for the RPi specifically so that'd probably be denied.
(...)Regarding the dim-route-solution in EmulationStation, I would assume this is a dead end as well. Unless I'm mistaken ES development seems to have halted?The emulationstation version used on RetroPie is hosted here: https://github.com/RetroPie/EmulationStation
And it's receiving some development recently. If you really think it's worth it, you can try to request it...
now I'm just feeling very off-put
You seem very frustrated dude! How about singing a beautiful song with us?
-
@meleu said in Run custom action on custom hotkey?:
@SanyaIV said in Run custom action on custom hotkey?:
Basically I want to be able to define what a hotkey does, rather than defining what hotkey an action has, if that makes sense? So if I understand correctly, that would be in RetroArch and it's them that I should be bothering instead
Before requesting such thing to RetroArch team, first be aware of what is the scope of RetroArch. ;-)
RetroPie (or EmulationStation) obviously have SOME sort of concept of idle since it can dim the screen after some time
EmulationStation.
I'm guessing whichever part is taking care of that wasn't made for the RPi specifically so that'd probably be denied.
(...)Regarding the dim-route-solution in EmulationStation, I would assume this is a dead end as well. Unless I'm mistaken ES development seems to have halted?The emulationstation version used on RetroPie is hosted here: https://github.com/RetroPie/EmulationStation
And it's receiving some development recently. If you really think it's worth it, you can try to request it...
now I'm just feeling very off-put
You seem very frustrated dude! How about singing a beautiful song with us?
I apologize if I came across as rude. Indeed I was, and am frustrated, I've spent most of yesterday and today trying to get this to work with different methods and there was always some sort of roadblock.
The addon Kodi CallBack for Kodi did indeed work nicely. There's another issue though... The monitor will of course get "No signal" after "vcgencmd display_power 0" has been called and it'll enter Power Save Mode, thing is though, for some reason it'll think it got signal after a while, try to connect, fail and enter Power Save Mode.. And it'll repeat this process indefinitely.. so.. yeah, won't work either way so actually giving up now since the base feature doesn't work for my monitor.
-
@SanyaIV said in Run custom action on custom hotkey?:
What I want to do: ADD a hotkey that does a CUSTOM action.
The hotkey: DualShock 4 contoller [Share] + [PS Button]
The action: Run a script (The script will toggle vcgencmd display_power 0 and vcgencmd display_power 1)Hi Sanya,
Maybe you could achieve what you want by using Triggerhappy with configurations like here?:
https://github.com/Vegz78/retro2png#configuring-the-gamepad-and-keyboard-hotkeysBr,
Vegard
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.