Hi, I just got a new macbook pro (apple silicon M1, Big Sur 11.2.3), pd runs just fine, but I have the following issue : when I use shortcuts to create objects, messages, number boxes, whatever, I always have two instead of one, connected. This is quite annoying... Any ideas?
-
shortcuts issue
-
I have the same problem...
You might use a french or german keyboard maybe?The problem is that numeric keys are mapped to Command + Shift + digit key in such systems.
I finally ended by modifying some line of my pd_binding.tcl file long time ago to make them match my local keyboard.For exemple (for french keyboard) for object box "CMD+1", I use "CMD + &":
bind all <$::modifier-ampersand> {menu_send_float %W obj 0}
For CMD+2, I use "CMD + é":
bind all <$::modifier-eacute> {menu_send_float %W msg 0}
This way I don't need to press 3 keys (CM + SHIFT + numeric) and only 2 keys like in us keyboard (CMD + &) and it removes the double box.
But I might be wrong? -
Yes you're right, french keyboard here. I don't know how to do this modification, I guess it implies to compile pd from source code, right? Never done that before...
-
@LucienR you don't have to compile from source, you just have to put tcl commands in a *-plugin.tcl file
you can also unbind the old commands using an empty brace I think:bind all <$::modifier-Key-1> { }
edit: I just learned you can also use #:
bind all <$::modifier-Key-1> {#}
-
Sorry guys i feel a bit stupid, but this is mumbo jumbo to me. I have no clue about what tcl commands are, nor commands in general to be honest...
-
@LucienR A plugin file is a file found by Pd (if it is in one of the Pd search paths) that modifies the tcl/tk commands as Pd starts up.
The Wish app (wish86.exe in windows) is the app that Pd calls as it starts and is basically the Pd terminal window. It runs the tcl/tk commands that tell the OS how to create the Pd windows..... the GUI's...... and communicates with the OS when Pd asks for such things.A plugin file must be named......... something-plugin.tcl
So create a simple text file (it must contain no formatting information) and paste the code from @seb-harmonik.ar into it and save it as eg ...... keyboardmod-plugin.tcl
Put it in the Pd/bin folder and restart Pd and hopefully it will solve the problem.Lots more can be done with plugin files...... search the forum for useful ones.
To stop it taking effect delete it or move it into a folder that is not in a Pd path....... and then restart Pd.
David. -
Thanks David. I tried, and I have this message when I start PD :
UNHANDLED ERROR: invalid command name "
tf1nsinsicpg1252cocoartf2578
cocoatextscaling0cocoaplatform0{onttbl0moderncharset0 Courier;}
{colortbl;
ed255green255lue255;
ed0green0lue0;}
{*expandedcolortbl;;cssrgbc0c0c0;}
paperw11900paperh16840margl1440margr1440ieww11520iewh8400iewkind0
deftab720
pardpardeftab720partightenfactor00s24 cf2 expnd0expndtw0kerning0
outl0strokewidth0 strokec2 bind all <$::modifier-ampersand> {menu_send_float %W obj 0} pardpardeftab720partightenfactor0
cf2 bind all <$::modifier-eacute> {menu_send_float %W msg 0}"
while executing
"{
tf1nsinsicpg1252cocoartf2578
cocoatextscaling0cocoaplatform0{onttbl0moderncharset0 Courier;}
{colortbl;
ed255green255lue255;
e..."
("uplevel" body line 1)
invoked from within
"uplevel #0 $tclcode"
FAILED TO LOAD /Users/lucienrapilly/Documents/Pd/bin/keyboardmod-plugin.tcl
-
@LucienR Sorry.... I hadn't read the whole thread and I don't use shortcuts or a French keyboard so..... ?
The @60Hz examples are good but I think he left out the "Key" after $::modifier (I could be wrong....... it could be a different OS?).
The bind command picks up the key press from the OS ......a combination in this case .........
The variable $::modifier-Key is defined somewhere (I can't remember where or it could be in the wish app itself) as the control key.And {menu_send_float %W ...... puts something into the patch window....... determined by the next bit..... obj 0} ..... which means an empty object box stuck to the cursor.
pd/tcl/pd_bindings.tcl contains the global bindings in the routine..... proc ::pd_bindings::global_bindings .........at line 48
So what you are trying to do is use some other combination "control"+"?" to do the same actions and avoid the number keys that require the shift key as well.
Changing the keyboard map is not an option as that would create havoc when you type something.
A plugin file is good because although you could modify the pd_bindings.tcl file you would have to do so again every time you update Pd.You could copy those global bindings (that are causing problems) into your plugin file and replace every key combination that is causing problems with one of your choice.
Here they are in a windows distribution in case you cannot open the file.......bind_capslock all $::modifier-Key a {menu_send %W selectall} bind_capslock all $::modifier-Key b {menu_helpbrowser} bind_capslock all $::modifier-Key c {menu_send %W copy} bind_capslock all $::modifier-Key d {menu_send %W duplicate} bind_capslock all $::modifier-Key e {menu_toggle_editmode} bind_capslock all $::modifier-Key f {menu_find_dialog} bind_capslock all $::modifier-Key g {menu_send %W findagain} bind_capslock all $::modifier-Key k {menu_send %W connect_selection} bind_capslock all $::modifier-Key n {menu_new} bind_capslock all $::modifier-Key o {menu_open} bind_capslock all $::modifier-Key p {menu_print $::focused_window} bind_capslock all $::modifier-Key r {menu_raise_pdwindow} bind_capslock all $::modifier-Key s {menu_send %W menusave} bind_capslock all $::modifier-Key t {menu_send %W triggerize} bind_capslock all $::modifier-Key v {menu_send %W paste} bind_capslock all $::modifier-Key w {::pd_bindings::window_close %W} bind_capslock all $::modifier-Key x {menu_send %W cut} bind_capslock all $::modifier-Key z {menu_undo} bind all <$::modifier-Key-1> {menu_send_float %W obj 0} bind all <$::modifier-Key-2> {menu_send_float %W msg 0} bind all <$::modifier-Key-3> {menu_send_float %W floatatom 0} bind all <$::modifier-Key-4> {menu_send_float %W symbolatom 0} bind all <$::modifier-Key-5> {menu_send_float %W text 0} bind all <$::modifier-Key-slash> {pdsend "pd dsp 1"} bind all <$::modifier-Key-period> {pdsend "pd dsp 0"}
You probably only need to deal with keys 1 to 5.
tcl is the guts of much of Pd's comms with the OS.
Here is a plugin that adds arrows to the ends of cords in edit mode.... and could wet your appetite......
cordarrows-plugin.tcl
It uses bind..... but to bind to an event rather than a key press...... in this case the window going to editmode.
There is some commented rubbish (of mine) in there as well that is best ignoredP.S>>>.... you could try these... it might work...... maybe...?
AND if it does you can still use the same shortcuts as you are used to.
The existing tcl code can be negated with unbind.bind all <$::modifier-Shift-Key-1> {menu_send_float %W obj 0} bind all <$::modifier-Shift-Key-2> {menu_send_float %W msg 0} bind all <$::modifier-Shift-Key-3> {menu_send_float %W floatatom 0} bind all <$::modifier-Shift-Key-4> {menu_send_float %W symbolatom 0} bind all <$::modifier-Shift-Key-5> {menu_send_float %W text 0}
Here it is as a plugin (with unbind done).......stortcutmod-plugin.tcl
David. -
Thank you so much @whale-av. For some reason your stortcutmod-plugin.tcl file doesn't work with me,
UNHANDLED ERROR: invalid command name "unbind"
while executing
"unbind all <$::modifier-Key-1> {menu_send_float %W obj 0}"
("uplevel" body line 12)
invoked from within
"uplevel #0 $tclcode"
FAILED TO LOAD /Users/lucienrapilly/Documents/Pd/bin/1622149794074-stortcutmod-plugin.tcl
But I did another tcl file with bind commands, in order to use & é " ' ( instead of 1 2 3 4 5, so no need of shift anymore, And it works! Thanks for your explanation, it was a real pain in the ass to patch without shortcuts!
-
@LucienR That's great. I try to explain rather than just giving a solution so I am pleased that it helped.
It looks like I should have set the plugin to unbind within the procedure proc ::pd_bindings::global_bindings
so something like......
proc ::pd_bindings::global_bindings::unbind all <$::modifier-Key-1>But I don't know..... just stabbing in the dark.
I am still struggling with tcl although slightly better at it than I was before I knew it existed...!
David.