Can I remove Smooth shortcut key(Ctrl+Shift+S) of imageJ/FIJI?

Hi everyone,

I want to remove one of the built-in-shortcut keys of FIJI or assign it for another function.

Is there any way to remove the Smooth shortcut key(Ctrl+Shift+S) or assign it for ‘Save as PNG’ to prevent Smoothing my image by mistake?

Sometimes out of habit, I press ‘Ctrl+Shift+S’ to save my image in a different name in FIJI, not in Microsoft Office.

Please help. Thank you very much.

I tried as follows to override the built-in shortcut but it does not work.

macro “SaveAsPNG [S]” {
saveAs(“png”);
}

It only works when I press ‘Shift+S’.

‘Ctrl+Shift+S’ still smoothing my image.

Hi,
I’m not sure there is a way to remove a builtin shortcut, but here is a trick you could use to achieve the desired behaviour with a plugin that implements the CommandListener interface and checks if the shift key is pressed, so it is triggered by the shortcut but does not disable the ‘Smooth’ menu command:
See also the full command listener example at https://imagej.nih.gov/ij/plugins/download/misc/Command_Listener.java

Jerome.

import ij.*;
import ij.plugin.*;

public class Remove_Smooth_Shortcut implements PlugIn, CommandListener {

   public void run(String arg) {
      if (IJ.versionLessThan("1.39l")) return;
      Executer.addCommandListener(this);
   }
   public String commandExecuting(String command) {
       if (command.equals("Smooth")&&IJ.shiftKeyDown())
         return("PNG..."); 
      return command;
   }
}
1 Like

Thank you very much, Jerome!!