Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizable keybindings #8

Open
EvanCarroll opened this issue Nov 28, 2018 · 22 comments
Open

Customizable keybindings #8

EvanCarroll opened this issue Nov 28, 2018 · 22 comments

Comments

@EvanCarroll
Copy link

EvanCarroll commented Nov 28, 2018

I know this is somewhat petty, but I would love to have Vim-esque keybindings

  • H previous
  • L next
  • space play/pause (lock)
  • S shuffle
  • F11 maximize
  • I (instead of Ctrl + B)

Ctrl + R, M would be great without Ctrl


Ctrl+S and Ctrl+E make sense to me as is.


I wouldn't push something like this hard, but it just seems like that would make it a lot more natural for those of geeks that use with lot of other stuff. Right now I'm running i3 (vim), tmux (vim), vim (vim), ranger (vim), and vlc (vim).

@iamnkc
Copy link

iamnkc commented Jul 10, 2019

Hello, sir, I want to work on this feature. But, I am new to this. Can you provide some references so that I can start working on this feature.

@ghost
Copy link

ghost commented Jul 20, 2019

Greetings @n-k-chilagani
The first step is building the software in your development environment.
Are you able to build from the master branch?
What operating system are you running?

@Chinmaygoyal
Copy link

Is the issue still up for grab?

@revmischa
Copy link
Contributor

yep!

@Chinmaygoyal
Copy link

I am new to open source so it would be of great help if you could tell me where to start from.

@revmischa
Copy link
Contributor

I would start here https://github.com/projectM-visualizer/projectm/blob/master/src/libprojectM/KeyHandler.cpp
And then look at the specific app you want to play with (-sdl is a good choice)

@shubhamrajeevpunekar
Copy link

If this issue is still up for grabs, can I have a go at it? So far, I have been able to build the master branch code from source and the key bindings for switching to next and previous preset are working in projectMSDL binary. However, the bindings for showing help, fps or stats have not worked, in the code I wasn't able to locate the functions for displaying these either. Could you point me in the right direction?

@ghost
Copy link

ghost commented Oct 15, 2019 via email

@revmischa
Copy link
Contributor

@srp3003 sure go for it. Whatever is in KeyHandler.cpp is what is shared from the core library.

	case PROJECTM_KEYDOWN:

	  switch( keycode )
	    {
	    case PROJECTM_K_UP:
            beatDetect->beat_sensitivity += 0.25;
			if (beatDetect->beat_sensitivity > 5.0) beatDetect->beat_sensitivity = 5.0;
	      break;
	    case PROJECTM_K_DOWN:
            beatDetect->beat_sensitivity -= 0.25;
			if (beatDetect->beat_sensitivity < 0) beatDetect->beat_sensitivity = 0;
	      break;
		case PROJECTM_K_h:
 		  renderer->showhelp = !renderer->showhelp;
	      renderer->showstats= false;
	      renderer->showfps=false;
	    case PROJECTM_K_F1:
	      renderer->showhelp = !renderer->showhelp;
	      renderer->showstats=false;
	      renderer->showfps=false;
	      break;
	    case PROJECTM_K_y:
		this->setShuffleEnabled(!this->isShuffleEnabled());
		 break;

	    case PROJECTM_K_F5:
	      if (!renderer->showhelp)
		      renderer->showfps = !renderer->showfps;
	      break;

etc...

@coast77777777777 sounds great. i think the appveyor build is broken right now tho.

@ghost
Copy link

ghost commented Oct 16, 2019 via email

@shubhamrajeevpunekar
Copy link

@coast77777777777, that sounds great! Especially your point about having unlimited chances really takes the pressure off!

@revmischa, I had the following questions:

  • which of the shortcuts should I try to implement?
  • Are Ctrl + B, Ctrl + R, Crtl + M, Ctrl+S and Ctrl + E assigned for some operation? I couldn't see any feedback on hitting them in projectMSDL binary.
  • Should I reassign "show help" to H instead of h? That will leave h and l free for previous and next.

@revmischa
Copy link
Contributor

My advice is to mostly ignore the original text of this issue and do whatever is most compatible/similar to Milkdrop - http://wiki.winamp.com/wiki/MilkDrop_Unleashed_Guide#Usage

shubhamrajeevpunekar referenced this issue in shubhamrajeevpunekar/projectm Oct 30, 2019
1. Updated keybinding for previous preset to BACKSPACE
2. Updated keybinding for hard cut next preset to H
@shubhamrajeevpunekar
Copy link

I have attempted to update keybindings in PR - (I am creating a PR (Update keybindings similar to MilkDrop projectM-visualizer/projectm#262). Am I on the right track?

  • BACKSPACE: return to previous preset
    (Modified an existing keybinding PROJECTM_K_n)
  • SPACE: transition to next preset
    (No projectMKeycode defined for SPACE)
  • H: instant Hard cut (to next preset)
    (Modified an existing keybinding PROJECTM_K_n)
  • R: toggle random (vs. sequential) preset traversal
    (Already implemented with PROJECTM_K_R and PROJECTM_K_r (hard cut))
  • L: load a specific preset (invokes the 'Load' menu)
    Not sure about how to invoke a menu, refreshing current_interface maybe?
  • +/-: rate current preset (better/worse)
    Already implemented with PROJECTM_K_PLUS and PROJECTM_K_MINUS
  • scroll lock: lock/unlock current preset
    (keyboard light on means preset is locked)
    (prevents random switch to new preset)
    Need to add a projectMKeycode for scr lk
  • A: aggregate preset - loads a random preset,
    steals the warp shader from a different random preset,
    and steals the composite shader from a third random preset.
    TODO
  • D: cycle between various lock-states for the warp and
    composite shaders. When one of these shaders is locked,
    loading a new preset will load everything except the locked shaders, creating a mix between the two presets.
    TODO

@ghost
Copy link

ghost commented Nov 4, 2019

Greetings @srp3003

Can you review to verify that your implementation matches the classic milkdrop keybindings in this image?

image

revmischa referenced this issue in projectM-visualizer/projectm Nov 16, 2019
1. Updated keybinding for previous preset to BACKSPACE
2. Updated keybinding for hard cut next preset to H
@gdstewart
Copy link

Hello, looking into this as something I could potentially contribute to. Is the plan to have a toggle to allow for multiple sets of keybindings? Or was the intention to switch over to the milkdrop keybindings? For example, I noticed that officially the "next" keybinding is still "n", and not "H".

@kblaschke kblaschke added enhancement New feature or request sdl-frontend labels Aug 26, 2021
@theIDinside
Copy link

I don't think necessarily this should be considered a "good first issue" since it's actually pretty involved - but I'll take a dive into it. Just to be clear, what the issue is asking for, is;

  • configurability of the "events" that happen in the switch branch in KeyHandler.cpp right?

@revmischa
Copy link
Contributor

I don't think this is a really needed feature but someone please correct me if they feel strongly otherwise.

@EvanCarroll
Copy link
Author

@theIDinside I believe that's correct.

@revmischa I like staring at pretty lines. I like vim keybindings. =) I'm not sure where need factors in on this project or any feature of it.

@revmischa
Copy link
Contributor

Compared to all the other things that need fixing I would put this at the bottom of the pile of our issues

@revmischa revmischa added bad-first-issue and removed good first issue Good for newcomers labels Oct 25, 2021
@kblaschke
Copy link
Member

I think a better solution would be that the projectM library itself doesn't do any keymapping/handling at all and only provide API calls for each functionality. This would leave the actual input handling - whatever this is - to the integrating application, e.g. projectMSDL. Some frontends may not even have a keyboard, but game controllers, TV remotes or other input devices for example.

I think most of the input actions are already handled by the C API, and KeyHandler is only an additional wrapper around these functions.

I'd give this a try and rework it, but removing the internal key handler will also break any applications using those, requiring a few code changes which IMO would be totally acceptable.

The SDL frontend could then make the keycodes configurable via the config file or any other means, possibly providing a few preconfigured hotkey settings (projectM, Milkdrop, vim) in the documentation/wiki.

The F1 help menu also needs to be updated by the external application, so I'd remove any key bindings from it, forcing the application to fill it in (projectMSDL already does that, so not much of a change here).

@kblaschke kblaschke transferred this issue from projectM-visualizer/projectm Feb 14, 2022
@kblaschke
Copy link
Member

An update to this old issue:

The built-in key handler in the library is soon gone, and the API mostly cleaned up. After the library is released as 4.0, I'll give the frontend a small overhaul and add a better UI, which should then finally allow users to rebind keys via both the UI and the configuration file, as we're only looking at SDL key handling and don't need a translation to projectM's keycodes anymore.

@kblaschke
Copy link
Member

With the key handler in libprojectM gone, the new UI I'm working on will get a key bind settings window. In this window, you'll be able to select from some binding presets (e.g. classic projectM and Milkdrop), but also define your own key bindings as well.
Not sure if this will be in the initial stable release, but it's definitely a feature that will be implemented at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants