Skip to main content
bluespeck
Participant
November 21, 2024
Answered

How to create new layer at top of stack

  • November 21, 2024
  • 6 replies
  • 1112 views

Is there a shortcut to create a new Photoshop layer and have it automatically go to the top of the layer stack? Thanks.

This topic has been closed for replies.
Correct answer Bojan Živković11378569

Select the topmost layer, then create a new one. It should be on top unless the layer group (expanded) is the topmost.

Alt + (.) then Ctrl + Alt + Shift + N on Windows.

6 replies

Bojan Živković11378569
Community Expert
Community Expert
November 22, 2024

Select the topmost layer, then create a new one. It should be on top unless the layer group (expanded) is the topmost.

Alt + (.) then Ctrl + Alt + Shift + N on Windows.

Stephen Marsh
Community Expert
Community Expert
November 21, 2024

OK, with further testing there appears to be a fundamental difference in how ExtendScript DOM scripting adds a new layer vs. regular Photoshop use...

 

All one needs to do is use:

 

app.activeDocument.artLayers.add();

 

And the new layer will always be created at the top of the stack, regardless of whether an expanded layer group is at the top of the stack or not.

 

I believe that this is what @r-bin may have been hinting at! :]

bluespeck
bluespeckAuthor
Participant
November 21, 2024
Stephen Marsh
Community Expert
Community Expert
November 21, 2024
quote

@Conrad_C @r-bin @Stephen Marsh  Thanks all.


By @bluespeck

 

You're welcome. It all comes down to how robust or "bulletproof" this is needed to be... Should it work gracefully in all circumstances, when might it fail and lead to unexpected results (like an open group at the top of the stack) etc.

Stephen Marsh
Community Expert
Community Expert
November 21, 2024

Select all layers in the target document. If the new layer is duplicated from a separate source document, then it does go to the top of the layer stack, even if there is an expanded/open layer group at the top of the stack!

Stephen Marsh
Community Expert
Community Expert
November 21, 2024

I can't think of one offhand, but there are shortcuts to create a new layer and move it to the top of the stack (depending on layer structure, groups may get the way) - this can be recorded into an action for F-key shortcut playback:

 

Cmd/Ctrl + Opt/Alt + Shift + N
Cmd/Ctrl + Shift + ]

 

Otherwise, a script would offer more precise control and can be made into a custom keyboard shortcut or recorded as an action for an F-key shortcut.

 

EDIT: I see that @Conrad_C replied with some great options while I was typing!

Legend
November 21, 2024

del

Stephen Marsh
Community Expert
Community Expert
November 21, 2024

@r-bin – Yes, I meant that a script has more control vs. actions when moving the layer to the top of the stack, not creating at the top of the stack with a single command.

 

EDIT: It would take multiple steps in either an action or script to be "bullet-proof".

 

Testing the suggestion from @Conrad_C by first deselecting all layers and then adding a new one seems to work well, apart from open/expanded layer groups at the top, as you mentioned.

 

I haven't tested with artboards, I would expect that things would be isolated to the artboard, but who knows, they can be a PITA for automation!

 

I was thinking of selecting all layers/groups, creating a smart object as a single layer "wrapper" to isolate the original layers, adding a new layer which would then default to the top, then selecting the smart object and converting it back to layers (deleting the group). This would work around having an open/expanded layer group at the top of the stack.

 

There is an "collapse all groups" command but not "collapse selected group".

Conrad_C
Community Expert
Community Expert
November 21, 2024

I’m not sure if there is a direct shortcut. But there are some indirect ways based on how layer selection affects where a new layer appears.

 

If a layer is selected in the Layers panel, a new layer is created above it.

If no layers are selected in the Layers panel, a new layer is created at the top of the layer stack.

 

Knowing that, you could get there using a workaround with the mouse, a menu, or two keyboard shortcuts.

  • Mouse method: Make sure the Layers panel is tall enough to show an empty area under the layer stack, so you can click there to deselect all layers. 
  • Menu method: Choose Select > Deselect All Layers.  
  • Keyboard method: The default set of Photoshop keyboard shortcuts does not define a shortcut for Deselect All Layers, but you can add your own by choosing Edit > Keyboard Shortcuts. (That’s what I did.) After you set that up, press your shortcut for the Deselect All Layers command. Now you can press the shortcut for Deselect All Layers followed by the shortcut for Layer > New > Layer. 

 

After you use any method to deselect all layers, the next layer you create will be at the top of the layer stack.

 

If you wanted to get it down to one step, use the Actions panel to create an action that combines the two commands. Add an action step that applies the command Select > Deselect All Layers, and another step that applies the command Layer > New > Layer. After you set that up, you can run the action either with the mouse, or by assigning a function key shortcut to the action.

bluespeck
bluespeckAuthor
Participant
November 21, 2024

Excellent. This works  great. Thanks 🙂