Add copyFilesLocalPath keybind

This commit is contained in:
miruka 2020-07-20 23:28:07 -04:00
parent 67b7821fae
commit 3435dbc2f8
2 changed files with 21 additions and 0 deletions

View File

@ -367,6 +367,7 @@ class UISettings(JSONDataFile):
"debugFocusedMessage": ["Ctrl+Shift+D"], "debugFocusedMessage": ["Ctrl+Shift+D"],
"openMessagesLinksOrFiles": ["Ctrl+O"], "openMessagesLinksOrFiles": ["Ctrl+O"],
"openMessagesLinksOrFilesExternally": ["Ctrl+Shift+O"], "openMessagesLinksOrFilesExternally": ["Ctrl+Shift+O"],
"copyFilesLocalPath": ["Ctrl+Shift+C"],
"clearRoomMessages": ["Ctrl+L"], "clearRoomMessages": ["Ctrl+L"],
"sendFile": ["Alt+S"], "sendFile": ["Alt+S"],

View File

@ -170,6 +170,26 @@ Rectangle {
} }
} }
HShortcut {
sequences: window.settings.keys.copyFilesLocalPath
onActivated: {
const paths = []
const indice =
eventList.getFocusedOrSelectedOrLastMediaEvents(false)
for (const i of Array.from(indice).sort().reverse()) {
const event = eventList.model.get(i)
if (event.media_local_path)
paths.push(
event.media_local_path.replace(/^file:\/\//, ""),
)
}
if (paths.length > 0) Clipboard.text = paths.join("\n")
}
}
HShortcut { HShortcut {
active: eventList.currentItem active: eventList.currentItem
sequences: window.settings.keys.debugFocusedMessage sequences: window.settings.keys.debugFocusedMessage