telegramdesktop / tdesktop

Telegram Desktop messaging app
https://desktop.telegram.org/
Other
25.29k stars 5.03k forks source link

Add keyboard shortcut to disable link preview #27696

Open eevmanu opened 3 months ago

eevmanu commented 3 months ago

Is your feature request related to a problem?

opportunity to improve desktop client experience to make interaction faster without the use of mouse

partially related to https://github.com/telegramdesktop/tdesktop/issues/687

related to https://github.com/telegramdesktop/tdesktop/issues/16841

app: telegram desktop version: 4.15.2 distribution: flatpak

Describe the solution you'd like

my c++ knowledge is very limited but trying to understand where this could be placed ...

here are the commands available to use via keyboard shortcuts (on local default_shortcuts-custom.json) https://github.com/telegramdesktop/tdesktop/blob/ae36019ba99131df31a2e7056da720b3bad1b827/Telegram/SourceFiles/core/shortcuts.cpp#L113-L150

here are the default keybindings for keyboard shortcuts https://github.com/telegramdesktop/tdesktop/blob/ae36019ba99131df31a2e7056da720b3bad1b827/Telegram/SourceFiles/core/shortcuts.cpp#L358-L422

so, creating a new command which could be bind to a new keybinding in local default_shortcuts-custom.json https://github.com/telegramdesktop/tdesktop/blob/ae36019ba99131df31a2e7056da720b3bad1b827/Telegram/Resources/default_shortcuts-custom.json#L1-L14

that could trigger (simulate a click):

  1. on this x button, on the link preview pane or

image

  1. on do not preview button once you enter to the link preview settings

image


here are some findings that could be related to render link preview https://github.com/telegramdesktop/tdesktop/blob/ae36019ba99131df31a2e7056da720b3bad1b827/Telegram/SourceFiles/mainwindow.cpp#L437-L455 https://github.com/telegramdesktop/tdesktop/blob/ae36019ba99131df31a2e7056da720b3bad1b827/Telegram/SourceFiles/history/view/controls/history_view_webpage_processor.cpp#L97-L99 https://github.com/telegramdesktop/tdesktop/blob/ae36019ba99131df31a2e7056da720b3bad1b827/Telegram/SourceFiles/mtproto/scheme/api.tl#L1985

Describe alternatives you've considered

doing something similar to what whatsapp web (web.whatsapp.com) does when using esc to remove the link preview

https://github.com/telegramdesktop/tdesktop/assets/2232375/a6bc61ca-069e-4094-b02f-643807583cb6

Additional context

having the option to have what bot api does with link preview options - is_disabled, but in normal human interaction via telegram desktop app

could at least alleviate partially a popular reported bug -> https://bugs.telegram.org/c/3195

eevmanu commented 3 months ago

I tried to create a workaround with xprop and xdotool but failed when finding y position to access link preview settings change based on how big is the content your writing as message or ...

image

image

... y position for do not preview button inside link preview settings change based if link contains an image or not

image

image

so I stop trying for now

rusproject commented 3 weeks ago

Bump. Hate all undisablable features but this one (auto-gerenating links preview) especially annoying. For anyone who use "Saved messages" as cross-platform annotated bookmarks storage, it's a hell to click the X each time after pasting a link.