Create custom functionality on Keyboard Shortcut

Previous topic - Next topic

abi

Hello,

I am trying to write some additional functionality when a user presses "Ctr + s" which is the default keyboard shortcut for saving the file, i want to create a file copy along with it with timestamp

Please let me know if anyone has tried to overwite the default keyboard shortcut functionality

Thank you


AdmFubar

I take it that you find the auto backup feature lacking?
Using Scribus 1.6.1, openSUSE 15.6
Advanced hobbyist

a.l.e

#2
this time too, i'm pretty sure that i've tried it out in the past and failed.
(but i think i wanted to let the scripts define their own shortcuts... which is not really what you are looking for.)

but it's not impossible, and i see why for some setups it might be an interesting feature.

if you're comfortable enough with c++, here an idea how it might be possible to implement it:

- in the "file > preferences > keyboard shortcuts" add a way define custom actions.
- one type of custom action would be "run script...", where you need to define the path to script being run
- then you can attach any shortcut to that specific script.

there some work to be done, but it does not sound like rocket science.
and i would first check with the team if they would accept the feature (if implemented correctly) or if they have hints on how it should be done.

on the other side:
generally speaking, i prefer the approach of adding a list of user's script to the script menu entry and then use the "action search" to trigger specific scripts by (parts of their) name.
(using "normal" shortcuts for launching scripts will mostly lead to weird shortcuts being used...)
but this depends on https://bugs.scribus.net/view.php?id=15579 being accepted.
(it's in my local scribus and works well for me)

following this remark, i think a "simpler" way to implement your feature is to get your computer to track the .sla files in a (list of) given directories and make a backup of it each time they change:

https://superuser.com/questions/226828/how-to-monitor-a-folder-and-trigger-a-command-line-action-when-a-file-is-created

assuming that you're using windows, you will first have to make sure that scribus does not lock for read the files it opens:

https://stackoverflow.com/questions/6167136/how-to-copy-a-file-while-it-is-being-used-by-another-process 

this way, people will not be tempted to define crazy shortcuts and you will get your backups on each save : - )