Opened 2 years ago
Closed 2 years ago
#20624 closed enhancement (fixed)
keyboard shortcut to copy url to osm element in clipboard
Reported by: | StephaneP | Owned by: | GerdP |
---|---|---|---|
Priority: | normal | Milestone: | 21.04 |
Component: | Core shortcuts | Version: | |
Keywords: | shortcut, url, clipboard | Cc: |
Description
When I edit Osm inside Josm and need to create a discussion on a changeset, I often have to add a link to a node/way/relation/changeset inside the discussion.
To do this I have to select the element then press ctrl+shift+i
, copy the url from the just opened browser tab, and paste it in the discussion.
It would be faster if we can have a keyboard shortcut to copy this url directly to the clipboard, without opening a web browser.
We could make this shortcut available for node, way, relation, changeset, user.
An available shortcut is Ctrl+Alt+l
Attachments (4)
Change History (28)
comment:1 Changed 2 years ago by
Component: | Core → Core shortcuts |
---|
comment:2 follow-up: 3 Changed 2 years ago by
comment:3 follow-up: 7 Changed 2 years ago by
+1, similar to Ctrl+C
copying internally the object ids, this action would add all urls of selected objects. May be shorten as https://www.osm.org/*
.
Found some available shortcuts:
- questionmark:
?
Alt+INSERT
Alt+Ctrl+Shift+Y
Alt+Ctrl+Shift+Z
Replying to GerdP:
I thought about adding the link to the text box shown with Ctrl+I. This would also mean that you mark the line and use copy first but at least it should be much faster.
As the info dialog is non-modal, I would have to open it several times when more than one object is selected without a summary on top. Already, have problems with that when copying the id of several, locally deleted objects where Ctrl+C
does not work.
comment:4 Changed 2 years ago by
Similar to "Copy Coordinates", we could offer a similar action and allow users to assign their favourite shortcut. Not all users will need this action, and shortcuts with four keys are not really easy to memorise.
comment:5 Changed 2 years ago by
Owner: | changed from team to GerdP |
---|---|
Status: | new → assigned |
Changed 2 years ago by
Attachment: | 20624.patch added |
---|
comment:6 follow-up: 8 Changed 2 years ago by
patch implements a new (expert-only) action without predefined shortcut and shows it in the edit menu below "Copy Coordinates".
Please review the new i18n strings:
super(tr("Copy URLs"), "copy", tr("Copy URLs of selected objects to clipboard."), Shortcut.registerShortcut("copy:urls", tr("Edit: {0}", tr("Copy URLs")), KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), false);
Action is enabled when at least one primitive is selected. Should I add a filter so that at least one already uploaded node, way, or relation must be selected?
comment:7 follow-up: 9 Changed 2 years ago by
Replying to skyper:
May be shorten as
https://www.osm.org/*
.
See preference osm-browse.url
which defaults to https://www.openstreetmap.org.
Maybe the default should be changed?
comment:8 Changed 2 years ago by
Replying to GerdP:
Should I add a filter so that at least one already uploaded node, way, or relation must be selected?
I think so.
Changed 2 years ago by
Attachment: | 20624.2.patch added |
---|
enable action only when at least one non-new object is selected
comment:9 follow-up: 10 Changed 2 years ago by
Thanks, does it work with deleted or incomplete objects? Ctrl+C
does not work with them.
Replying to simon04:
Similar to "Copy Coordinates", we could offer a similar action and allow users to assign their favourite shortcut. Not all users will need this action, and shortcuts with four keys are not really easy to memorise.
Fine, I will use ?
or Alt+Insert
Replying to GerdP:
Replying to skyper:
May be shorten as
https://www.osm.org/*
.
Even osm.org
works.
See preference
osm-browse.url
which defaults to https://www.openstreetmap.org.
Maybe the default should be changed?
No, if it is used globally, pointing to redirects, on default, may be not the best solution. Documentation should just mention this option.
comment:10 Changed 2 years ago by
Replying to skyper:
Thanks, does it work with deleted or incomplete objects?
Ctrl+C
does not work with them.
So far it ignores deleted objects. Will change that. I've never noticed that incomplete objects are special. Please double check.
comment:11 Changed 2 years ago by
How about adding "Server" to the description: Copy server URLs of selected objects to clipboard.
comment:12 Changed 2 years ago by
Sorry, you are right, incomplete objects work, so only deleted are special.
Changed 2 years ago by
Attachment: | 20624.3.patch added |
---|
"Copy server url", also use selected deleted objects
comment:13 Changed 2 years ago by
Maybe reuse code from InfoWebAction
(it also supports notes)? I'm trying to think of a more concise name for the menu entry, maybe "Advanced info (copy web URL)"?
comment:14 Changed 2 years ago by
I started with the idea to reuse code from InfoWebAction
but failed to code the constructor. When I extend AbstractInfoAction
instead I'll also end up duplicating the code in InfoWebAction
comment:15 Changed 2 years ago by
I'll try to change InfoWebAction
similar to the code in CreateMultipolygonAction
so that a boolean decides what the action does.
comment:16 Changed 2 years ago by
Nah, code gets too complicated. I give up with this idea.
I also don't think that notes are relevant for this action, but I've noticed that the existing code doesn't check if a note has a positive id.
comment:17 Changed 2 years ago by
@simon04: I don't understand the meaning of the registerInToolbar
parameter. Should it be true or false? What's the criteria?
comment:18 Changed 2 years ago by
Milestone: | → 21.04 |
---|
Patch works as expected. :-)
Ad registerInToolbar
: set it to true
if users should be able to add this entry to the toolbar. If false
, this entry will not show up in the toolbar preferences. https://github.com/openstreetmap/josm/blob/16fb463b5b69df9b710f72f1b928744f20731e2e/src/org/openstreetmap/josm/actions/JosmAction.java#L104-L106
comment:19 Changed 2 years ago by
Keywords: | clipboard added |
---|
comment:20 follow-up: 21 Changed 2 years ago by
What are the toolbar preferences? I think I used parameter false and I was still able to add the action to the toolbar.
comment:21 Changed 2 years ago by
Replying to GerdP:
What are the toolbar preferences? I think I used parameter false and I was still able to add the action to the toolbar.
Actions used in the menu are always available for toolbars. Not 100% sure, but this parameter probably is only needed for actions which aren't available via the main menu. But it nevertheless should be set correctly in any case.
comment:22 Changed 2 years ago by
Sorry for the delay. Which patch should I use? 20624.with-notes.patch or 20624.3.patch
comment:23 Changed 2 years ago by
I'd go with the attachment:20624.with-notes.patch (in order to be consistent with the other "info actions").
I thought about adding the link to the text box shown with Ctrl+I. This would also mean that you mark the line and use copy first but at least it should be much faster.