DeepQt icon indicating copy to clipboard operation
DeepQt copied to clipboard

Using shortcut to translate

Open GrgMdmn opened this issue 2 years ago • 10 comments

Hi ! I woud like to know if DeepQT is conceived for translating with a keyboard shortcut as it is on deepl windows app (ctrl + C + C --> translation appears on a Deepl window)

Thanks a lot for answering :)

GrgMdmn avatar Oct 01 '23 11:10 GrgMdmn

You can do that all on your own by creating a custom hotkey to open deepqt (using whatever means you like). Since deepqt doesn't support direct translation of clipboard contents, there isn't any further integration I could meaningfully provide.

The closest I think I could manage would be to add a launch option telling deepqt to grab whatever file paths are on the clipboard and immediately translate them. So the workflow being:

  • Look for a file in your file browser
  • Select the file and copy it to clipboard (this stores the file path in your clipboard)
  • press whatever hotkey your have configured to execute deepqt --from-clipboard
  • deepqt immediately opens with that file in the table and starts translating.

Does that sound useful to you? If so, I can see if adding the launch option is feasible. I'll be working on a minor deepqt overhaul once I release the gui for PanelCleaner, whoch has some extra quality of life features (like a theme switcher, if you don't have Qt theming set up on your system already).

VoxelCubes avatar Oct 02 '23 06:10 VoxelCubes

Thank you for your answer. I think that solution could work but is less practical than just being able to support clipboard content. In my day use, I practically only use deepl shortcut to translate a sentence or a paragraph, rarely to translate files.

GrgMdmn avatar Oct 02 '23 20:10 GrgMdmn

I'm not sure I understand then, do you want DeepQt to offer the same features that the official deepl app does? Because in that case, what's wrong with the deepl app that you're already using? DeepQt uses the same deepl api to translate, so the quality will be no different, unless you want to make use of the DeepQt glossaries in a way that the official glossary system does not allow.

VoxelCubes avatar Oct 05 '23 00:10 VoxelCubes

The problem is that I am using Linux, so deepl app does not exist for Linux 😅

GrgMdmn avatar Oct 06 '23 16:10 GrgMdmn

Oh, that's cool. In your previous comment you said you used it all the time, so I figured you had it working.

Unfortunately that's kinda out of scope for my project, but I did find projects that provide essentially the same.

There is https://github.com/Freed-Wu/translate-shell as the backend and, if you're on Plasma, you can use this gui as the front end: https://store.kde.org/p/1395666 It looks just like the deepl app. Hope that works for you :)

VoxelCubes avatar Oct 07 '23 11:10 VoxelCubes

Thank you sir, I will try this and keep you updated :)

GrgMdmn avatar Oct 09 '23 18:10 GrgMdmn

Hey, I'm still in the middle of working on a massive overhaul of deepqt, but part of that will be this interactive mode that's like the deepl app. So when that's all done (which is still a few months off) I'll actually be able to fulfill your request...should you still be interested and not already perfectly happy with a different solution :) The main goal of the refactor though is to support many more APIs, including local models.

VoxelCubes avatar May 26 '24 00:05 VoxelCubes

Hi! Of course, I am interested! I did not find any solution that suits me. The biggest problem is that the other solutions are not Wayland compatible so all the proposed shortcuts are not working and the devs are not wanting to move from x11 to Wayland

GrgMdmn avatar May 26 '24 02:05 GrgMdmn

Well, luckily for you I'm on Wayland so I'll be sure to find a solution. But I think the issue has to do with the security model, where apps can't listen for keybinds unless they are in focus. I think KDE has a solution for this with their global hotkey portal or something, haven't looked into it much. Although, that depends on how you'd want deepqt to behave when pressing the shortcut while it's already open. It'd be easiest to spawn a new window for the new clipboard content, but that does seem very silly, so it should instead intercept that and update the input on the current instance of deepqt.

I'll be working on this, but with how busy this semester is it'll take a long time.

VoxelCubes avatar May 26 '24 11:05 VoxelCubes

No problem, I will be patient. And thank you :)

GrgMdmn avatar May 26 '24 14:05 GrgMdmn