-
abcdaniel
@Monetus Thanks for the assistance! Your answers have been great, thorough and pedagogical, but in the end I'm too bad a coder to set it up. I couldn't get your last example snippet working, and couldn't mentally parse the example plugins you referred to either. So I have two questions, which is of the really humble "please help me out" variety:
Given the bare bones shortcut plugin I posted above, how would you add a shortcut to (for example) a metro object set to 100ms?
I also really want to have single keypresses (no modifier key) as shortcuts for creating objects. In the bare bones plugin above I assigned "N" to create an empty object. Problem is, as soon as I have my text cursor in an object typing, hitting "N" creates a new object, which is not my intention. How do I check for standing in an object typing, to in that case disable that single keypress shortcut?
As an appendix to that, one of the pd example plugins, quickbinings-plugin.tcl, defaults to "R" creating a recieve , and "O" creating an osc. Trying to create a metro by typing in an empty object thus creates one recieve and one osc! Broken, I would say. That plugin have a couple of checks in place, but none that checks for "already standing in an object typing". I've tried looking through other plugins and the tcl's on pd github, but fail to figure out how to perform such a check. It is a bit disheartening, to be honest,
-
abcdaniel
@jancsika Thanks! Feel free to use any of it. Having the flexibility of shortcuts for empty single objects, object with predefined arguments and for snippets at the same place, I think would be awesome and a one up on sister Max.
Just feel the need to type this out loud, though I'm sure it is way overstated: If you are actively editing an object, any shortcut that is a single letter or number key should be temporarily diabled. That is not the case for the tcl/tk examples for custom shortcuts for vanilla Pd, and that blows my mind as an oversight. Ok, wrote that, hope that's ok.
So, dangling patchcords… is that possible/desireable in Purr Data? The suggested shortcut (cmd/ctrl while clicking) didn't work. I don't really want to hit a modifier to get a dangling cord, either. I feel strongly about those small ergonomics, click-drag-release is suboptimal, especially with a trackpad. The current click-drag-release behaviour could still be there, and is really fast in some cases, but clicking and releasing would get a dangling cord. Hitting esc would stop the dangling cord, but you rarely start a cord and then change your mind, so the escape thing would not be that much in use, and not be that much inconvenient for a die hard click-drag-release user. Click and release would also make it possible to do segmented patchcords down the line.
-
abcdaniel
To elaborate some more, inside a regular pd patch there could be a "Copy as text" option (or is that default? Copy on my mac doesn't transfer to the global pasteboard). Copy as text is useful also for posting stuff on forums. Copy as text, paste in the custom shortcut. Onviously, if all rendering is based on HTML, the custom shortcut boxes could also just render tha actual boxes, but that I guess is down the line, if this custom idea sounds good in any way.
-
abcdaniel
@jancsika said:
@abcdaniel said:
Quick idea for interface to start with: Have a panel/window of some sort listing the menuitems with shortcuts, with an inputbox of some sort next to each, prepopulated with the shortcut. User puts his cursor in the inputbox and type the shortcut. If shortcut is already in use, error message: "This shortcut is in use by item x, do you want to replace that shortcut with this?" Y/N.
That sounds pretty clear. There are some ugly implementation details with the menus that make changing the shortcuts in the running instance hard, but hopefully we can figure out a way around that.
Did a mockup of a such a shortcut interface: http://brynspace.se/demo/custom-shortcuts.html.
I added a "Custom" section, where you could utilize pd's simple text based file format to do any kind of shortcut and even snippets. Some text parsing would be required, to exclude coordinates for single objects. Objects that come with arguments are created as is, objects without arguments are created, and textcurser placed within. Snippets need to have coordinates recalculated relative to their new placement.
Could start implementing the custom part as a new feature, if getting access to the menues is messy, maybe?
Not all css nor js nor html is perfect… -
abcdaniel
Thanks for the tips on the patchcords! Those are great. I would also love to have click output - release mouse button - drag - click input. That click - hold - drag - click is less than ideal ergonomically imho.
Quick idea for interface to start with: Have a panel/window of some sort listing the menuitems with shortcuts, with an inputbox of some sort next to each, prepopulated with the shortcut. User puts his cursor in the inputbox and type the shortcut. If shortcut is already in use, error message: "This shortcut is in use by item x, do you want to replace that shortcut with this?" Y/N.
Special sauce for interface is using the autocompletion engine (which there will beat some point, I guess?) to find objects to make a shortvut for. Have a + button on the bottom of the interface panel/window, that opens a new box, where you can search for objects by typing, next to it an inputbox of some sort to record the shortcut.
-
abcdaniel
Do you have any plans for custom keyboard shortcuts? I am struggling to set something up in vanilla through tlc, but all those handles would disappear I guess in Purr Data? My biggest UI issue is actually having to mouseclick and modifier press so much. It hurts my hands when trying to patch fast! Would really love to have max-style shortcuts for objects, not using a modifier key: n for new object, m for message, b for bang, f for number, c for comment, t for toggle, s for slider. It's fast, and easy to remember.
-
abcdaniel
@youaresound said:
is there a way to use this to put a specific object ?
Yes, but I don't know how! The theory is to fill an empty object with text (through the script), to turn it into another object, for example writing "bng" in an object turns it into a bang. It is done that way in another plugin example, quickbindings, available here. Unfortunately, that plugin doesn't check if you are already in an object writing when you invoke the shortcut, so its is kind of broken. Check it out to get an idea of the theory of filling an empty object wih text through a script.
Someone more knowledgeable should seriously chime in here…
-
abcdaniel
I had the same question as OP, and followed @monetus hints. Disclosure: I am a total copy/paste coder, doing it reluctantly. What I found was simply writing the following and saving it as myplugin-plugin.tcl in a Pd standard path, got it working:
# removes ctrl/cmd+w for closing window bind all <$::modifier-Key-w> {} # adds ctrl/cmd+y for putting a vslider bind all <$::modifier-Key-y> {menu_send %W vslider} # adds pressing "n" for making a new object bind all <Key-n> {menu_send_float %W obj 0}
It felt kind of dirty not defining any proc or namespace (wouldn't know how to do that correctly). Can anyone chime in on this being an ok way of solving the problem, or if there is a more by-the-books way? I guess there are a couple of users ending upp here trying to configure shortcuts/hotkeys.