Jump to content
You must now use your email address to sign in [click for more info] ×

Shortcut to rename selected layer. (Sorry, but it's getting embarrassing)


Recommended Posts

Users have been asking for this very simple features for years. (Literally! there are 6 years old posts on this topic!)

-- Shortcut to rename selected layer --

That's it.

It's such a basic feature in ALL graphic software, it's SO important for productivity and workflow and it's so easy to implement, that's really insulting that we've been ignored so far.

Could please a developer take 10 minutes time to implement this? Please. Please. Please.

Link to comment
Share on other sites

Of course also basic navigation shortcuts would be nice. (Collapse and expand, for example...)
But rename is the very minimum.

Because I noticed that other users are reading this post, I want to share the fix I used so far:

I use Autohotkey to move the mouse up and down of a fixed amount of pixels and also to double click when on the right layer. It's still a bit annoying, because I have to position the mouse first and then I have to scroll and reset the mouse position manually after I renamed all the layers that were visible at a given time... but it's better than clicking on EVERY single layer.

The code is pretty simple:

;page up and down to move the mouse, then "End" for double click

PgDn::MouseMove, 0, 29, 0, R
PgUp::MouseMove, 0, -29, 0, R
End:: Click, 2
return

"29" is the distance in pixels on my main screen, it could be different on yours. Also: I set the thumbnail to "small" because otherwise layers have different heights so it doesn't work correctly.

Edited by AlessioFB
Link to comment
Share on other sites

I want to second, third and forth the request! They don't need to even assign a default keyboard shortcut, just let us do it! 

At my shop, seriously,  all that we wanted from v2 was a keyboard shortcut to rename the layer. We have to do this countless times a day. Especially renaming artboards for social media ads, digital ads, not to mention web assets.

However, I am very thankful to the as v2 they go rid of the "rotate canvas with command and mouse scroll". ;)

Link to comment
Share on other sites

42 minutes ago, T. Payton said:

I take it back, they still have the command-key rotate canvas "feature". :(

Which you can turn off, just as in V1.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

  • 4 weeks later...
4 hours ago, kjsdesign said:

Pretty Please! A hotkey option to rename a layer would be extremely helpful to my team as we have to name thousands of layers in each of our files.

Have you tried out my Autohotkey trick? Feel free to ask if you have any questions about it.

Link to comment
Share on other sites

13 hours ago, AlessioFB said:

Autohotkey trick

Yeah, last year I've experimented with Mac UI scripting macros:

Not that I'd actually need it but it works as a proof of concept, see my video.
Keyboard Maestro as a macro utility is extremely flexible, so the basic macro as seen there can be expanded at will.

MacBookAir 15": MacOS Ventura > Affinity v1, v2, v2 beta // MacBookPro 15" mid-2012: MacOS El Capitan > Affinity v1 / MacOS Catalina > Affinity v1, v2, v2 beta // iPad 8th: iPadOS 16 > Affinity v2

Link to comment
Share on other sites

@kjsdesign

On 11/11/2022 at 8:38 PM, AlessioFB said:

Because I noticed that other users are reading this post, I want to share the fix I used so far:

I use Autohotkey to move the mouse up and down of a fixed amount of pixels and also to double click when on the right layer. It's still a bit annoying, because I have to position the mouse first and then I have to scroll and reset the mouse position manually after I renamed all the layers that were visible at a given time... but it's better than clicking on EVERY single layer.

The code is pretty simple:

;page up and down to move the mouse, then "End" for double click

PgDn::MouseMove, 0, 29, 0, R
PgUp::MouseMove, 0, -29, 0, R
End:: Click, 2
return

"29" is the distance in pixels on my main screen, it could be different on yours. Also: I set the thumbnail to "small" because otherwise layers have different heights so it doesn't work correctly.

This allows me to use the keys to navigate the *visible* part of the layer hierarchy and rename layers without using the mouse. Once I finish the visible part, I have to use the mouse to scroll further and reposition the pointer. This is a small hack and not comparable with an actual shortcut... but still a great time saver.

Link to comment
Share on other sites

1 minute ago, AlessioFB said:

@kjsdesign

This allows me to use the keys to navigate the *visible* part of the layer hierarchy and rename layers without using the mouse. Once I finish the visible part, I have to use the mouse to scroll further and reposition the pointer. This is a small hack and not comparable with an actual shortcut... but still a great time saver.

That makes sense, what a hassle haha, every small hack helps

Link to comment
Share on other sites

I don't know what key combination would excite me. Simple hacks will not make us happy.


On a Mac, the only one that would really come into question for layer renaming would be the Enter key.

My vision: there is a hotkey that enables/disables a keyboard focus on the Layers panel. As a user of vim, ESC seems to make sense to me. Now I can walk through the hierarchy of layers with the cursor keys like in Finder's list view, collapsing and expanding with ← and →,   select a layer for renaming with Enter. On this basis Serif can then implement further conveniences (toggle Lock/Unlock, Hide/Show) for keyboard lovers.

Link to comment
Share on other sites

Alright folks, I'm not a very skilled AppleScripter, but with the help of a bunch of nifty UI scripting tools eventually I've figured out which parts of the UI to address.
Here is an example AppleScript that "clicks" the layer name of the topmost selected object on the canvas:

-- “CLICK AFFINITY LAYER NAME” AppleScript
-- © 2022 loukash.com
-- v1.0 2022-12-06
tell application "System Events"
	-- where are we?
	set applicationName to name of first application process whose frontmost is true
	if applicationName contains "Affinity" then
		-- else the script will simply silently quit:
		try
			tell process applicationName
				-- ATTENTION: no other panel with a scroll area should be open above the Layers panel!
				-- the topmost selected object on canvas = topmost selected layer in Layers panel:
				set myRow to first row of table 1 of scroll area 1 of splitter group 1 of window 1 whose selected is true -- (to do: how to get scroll area with identifier "_NS:239"?! I have no idea…)
				-- every layer object has a text field:
				set myField to text field 1 of UI element 1 of myRow
				-- as if we would double-click the text field:
				set focused of myField to true
			end tell
		end try
	end if
end tell

Caveats:

  • Tested in Affinity v1 on El Capitan: it works.
  • Have not tested in v2 yet: use it at your own risk! 
  • The Layers panel must be docked in the non-separated app window ("window 1")
  • No other panel that potentially has a "scroll area" (e.g. History, Text Styles) must be open above the Layers panel – or in the Left Studio if Layers is in the Right Studio, – otherwise Layers would become "scroll area n>1". fixed in v1.0.1 below
  • No other window must be open (Snapping/Guides managers etc.) otherwise "window 1" becomes "window n>1".
  • No panel must float.
  • If multiple objects are selected, the topmost gets focus.

Works as an AppleScript macro in Keyboard Maestro.
(I'm using ctrl-shift-L as a shortcut because I'm already using ctrl-L to show/hide the Layers panel.)
Should also work as an Automator Service executing the script, with a shortcut added via System Preferences.

Feel free to modify if you have more ideas.
I'd be particularly interested how to read the scroll area property identifier "_NS:239" which seems to be unique to the Layers panel in all Affinity v1 apps. I haven't found a way to talk to it yet. Standart properties like name or title show "missing value". The standard "scroll area n" numbering is unfortunately dynamic in order of appearance from left to right, top to bottom. fixed in v1.0.1 below

As a side note:
It should be possible to fetch the type name of each object (Curve, Rectangle, Artboard, Layer, etc.) and paste it as plain text into the text field. That would solve the v2 issue where the object type is only identifiable by the small icon as soon as you name a layer/object. I'll look into it, and eventually post it in a thread where a corresponding issue was discussed.

Have fun!

Edited by loukash
see v1.0.1 below

MacBookAir 15": MacOS Ventura > Affinity v1, v2, v2 beta // MacBookPro 15" mid-2012: MacOS El Capitan > Affinity v1 / MacOS Catalina > Affinity v1, v2, v2 beta // iPad 8th: iPadOS 16 > Affinity v2

Link to comment
Share on other sites

@R C-R this is the conversation we were referring to.

About your question: "How would it work?"
I image it as simple as that:
when I click "F2" (windows standard, but it can be any key combination, whatever you set it to be), IF an object or layer is selected, then the "rename" is triggered (as if I were clicking on it again). Otherwise nothing happens.

Link to comment
Share on other sites

1 minute ago, AlessioFB said:

I image it as simple as that:
when I click "F2" (windows standard, but it can be any key combination, whatever you set it to be), IF an object or layer is selected, then the "rename" is triggered (as if I were clicking on it again). Otherwise nothing happens.

OK, but don't you still have to have a layer selected to begin with? How much harder & more time consuming is it just to double-click on the layer in the Panel to select it, then name, rename, or append an existing layer name as you can do now?

Just guessing but I think what you want to avoid is having to use the mouse or other pointing device to select the layer so you can do everything with the keyboard, but since this only would be possible if the layer is already selected, I'm not sure how often it would be something many users would use.

Maybe that's why they have never considered adding that feature?

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

58 minutes ago, loukash said:

I'd be particularly interested how to read the scroll area property identifier "_NS:239" which seems to be unique to the Layers panel in all Affinity v1 apps. I haven't found a way to talk to it yet. Standart properties like name or title show "missing value". The standard "scroll area n" numbering is unfortunately dynamic in order of appearance from left to right, top to bottom.

Haha, when everything else fails, use the duckduck-duckin' web search!
stackoverflow.com/questions/12524161/using-axidentifier-in-ui-scripting-for-applescript

So, v1.0.1 of the script now recognizes the Layers panel by its AXIdentifier:

-- “CLICK AFFINITY LAYER NAME” AppleScript
-- © 2022 loukash.com
-- v1.0.1 2022-12-07
tell application "System Events"
	-- where are we?
	set applicationName to name of first application process whose frontmost is true
	if applicationName contains "Affinity" then
		-- else the script will simply silently quit:
		try
			tell process applicationName
				tell window 1
					-- identifying the Layers panel with ID "_NS:239"
					set myScrollArea to first scroll area of splitter group 1 whose value of attribute "AXIdentifier" is "_NS:239"
					-- the topmost selected object on canvas = topmost selected layer in Layers panel:
					set myRow to first row of table 1 of myScrollArea whose selected is true
					-- every layer object has a text field:
					set myField to text field 1 of UI element 1 of myRow
					-- as if we would double-click the text field:
					set focused of myField to true
				end tell
			end tell
		end try
	end if
end tell

All panels can be open but everything still must be docked in the main app window.

Next up would be: using a similar trick to scan all open application windows for AXIdentifier "_NS:239". That may slow down the script though.

Also, as noted, I still haven't tested it on v2. It could be that the Layers panel's AXIdentifier has changed.

To do:

  • If AXIdentifier "_NS:239" is unavailable, either because the panel is collapsed or hidden, activate it via menu scripting
Edited by loukash
added "to do"

MacBookAir 15": MacOS Ventura > Affinity v1, v2, v2 beta // MacBookPro 15" mid-2012: MacOS El Capitan > Affinity v1 / MacOS Catalina > Affinity v1, v2, v2 beta // iPad 8th: iPadOS 16 > Affinity v2

Link to comment
Share on other sites

1 minute ago, R C-R said:

don't you still have to have a layer selected to begin with?

You can select a layer by several means. Not just by selecting an object on canvas, but also by traveling through the stack via keyboard shortcuts. In v1 that was possible only in ADe, in v2 it's in all apps. Many users prefer to work with keyboard shortcuts rather than with a pointing device. Personally, I'm somewhere in the middle, but that's also because I'm using MacBook (and previously PowerBook) trackpads almost exclusively since almost 20 years. Both keyboard and the trackpad are literally always at hand. Often a shortcut is faster. (And less painful if your carpal tunnel syndrom begins to hurt again…)

Now consider users who have multiple large screens where they have to move the mouse pointer half a meter to even reach the Layers panel, and find the target they want to click.

Wanting a keyboard shortcut for everything is a valid request. Nobody will force you to ever use it. ;) 

MacBookAir 15": MacOS Ventura > Affinity v1, v2, v2 beta // MacBookPro 15" mid-2012: MacOS El Capitan > Affinity v1 / MacOS Catalina > Affinity v1, v2, v2 beta // iPad 8th: iPadOS 16 > Affinity v2

Link to comment
Share on other sites

38 minutes ago, R C-R said:

OK, but don't you still have to have a layer selected to begin with? How much harder & more time consuming is it just to double-click on the layer in the Panel to select it, then name, rename, or append an existing layer name as you can do now?

Just guessing but I think what you want to avoid is having to use the mouse or other pointing device to select the layer so you can do everything with the keyboard, but since this only would be possible if the layer is already selected, I'm not sure how often it would be something many users would use.

Maybe that's why they have never considered adding that feature?

You can select next/previous using shortcuts.

You an also "select parent". Sadly enough they forgot "select first child" 😂 Sometimes I really wonder what they were thinking when they decided what to implement. (And of course: once you have one functionality, to implement the other is EXTREMELY simple).

So you can already navigate the hierarchy (to a certain degree) just using the keyboard. But it's missing a shortcut for "rename".

Link to comment
Share on other sites

18 minutes ago, loukash said:

Not just by selecting an object on canvas, but also by traveling through the stack via keyboard shortcuts.

OK, but assuming I had a project with 20 or 50 layers, I doubt I would find using those shortcuts very useful. And IIRC, they will not navigate into groups or other container layers, & won't work if no layer is currently selected so at some point don't we still have to fall back on clicking with the pointing device to select layers?

20 minutes ago, loukash said:

Wanting a keyboard shortcut for everything is a valid request. Nobody will force you to ever use it. ;) 

I am not disputing that it is a valid request. It is just that there are hundreds of them so I doubt that a keyboard shortcut for entering layer name edit mode is very high on their list, in large part because I doubt it would be something many users would find useful in typical workflows in most projects. 

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

4 minutes ago, AlessioFB said:

You can select next/previous using shortcuts.

Try it when no layer is currently selected. ☹️

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

49 minutes ago, loukash said:

So, v1.0.1 of the script now recognizes the Layers panel by its AXIdentifier:

If you could adapt that script to running through the list of all layers to find names matching specified criteria & replace/amend those names with specified replacements, it could be very useful!

All 3 1.10.8, & all 3 V2.4.1 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
Affinity Photo 
1.10.8; Affinity Designer 1.108; & all 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.