telegramdesktop / tdesktop

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

Vim navigation (scrolling in chat) #16300

Open Andrew15-5 opened 3 years ago

Andrew15-5 commented 3 years ago

Hi, is it possible to add some shortcuts to navigate Telegram Desktop like in Vim?

I want to be able to scroll through messages using shortcuts:

I suggest using Alt key since Ctrl+k, Ctrl+j, Ctrl+f are already mapped to some actions.

I always open Telegram with Super+2 (Linux), then I use search box to quickly open any chat. And this is a great experience so far in terms of interaction speed, but if I need to scroll a bit higher to remember something or if I want to scroll down while reading the latest news all I have is Page Up and Page Down or a touchpad (scroll wheel) and both are just too far to reach when my fingers are on a home row. Even Alt+↑/Alt+↓ and Ctrl+Shift+↑/Ctrl+Shift+↓ are usable to some extend (with my pinky finger) although that's not a great example. My Neovim experienced hands just can't live without scrolling shortcuts.

So if there any chance of implementing this someday, please let me know, I'd really appreciate that.

Unrelated to this issue: Telegram team, you've done a great job so far and a lot of cool stuff will be rolled out in the future and I appreciate that. You guys made my days happier and easier because I use Telegram constantly (Desktop/Android) and the experience is just unbelievable! I'm so excited for the new video group calls and screen sharing, can't wait to try it out! Well, I just want to say thank you, because you really deserve it. :)

stinger112 commented 3 years ago

Also it would be awesome to have NeoVIM binding to chat input field to speed up typing. Oh dreams... :)

But maybe it can be solved somehow else on Linux?

Andrew15-5 commented 3 years ago

Also it would be awesome to have NeoVIM binding to chat input field to speed up typing. Oh dreams... :)

But maybe it can be solved somehow else on Linux?

I guess the easiest way is the same as with git - launch new instance of Neovim (with all your customizations) and after you quit it will insert all your text in textbox in Telegram. Then you can hit Enter to send the message.

With some extensions you can insert special characters (💚🤌🏻✅) in Neovim, so maybe this is a complete way. But some kind of integration would be interesting to try too.

Andrew15-5 commented 3 years ago

I've just thought about this once again and I think it would be a great idea to add the "Enable VIM-like navigation" checkbox into Advanced settings. Or maybe just let users customize and add new shortcuts and save them just as we can save our own custom themes (which are also cloud synced)

stale[bot] commented 2 years ago

Hey there!

This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

Andrew15-5 commented 2 years ago

No, I'm still interested. I'm really looking forward to seeing this feature implemented.

sarmong commented 2 years ago

It would be nice to expose the functions used for navigation etc., so that anyone can configure shortcuts to their liking in.config/telegram/config or something like this

github-actions[bot] commented 1 year ago

Hey there!

This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

Andrew15-5 commented 1 year ago

I'm still interested.

mo3g666 commented 1 year ago

Up!

kylevon commented 1 year ago

I was just thinking about this feature, it would be amazing!

saymeowpls commented 1 year ago

Its really good idea!

coldrain96 commented 1 year ago

up

Goosegit11 commented 1 year ago

bump

pinbraerts commented 1 year ago

There is shortcuts-custom.json in AppData/Roaming/Telegram Desktop/tdata According to source code, it is intended to put custom shortcuts definitions in this file If you do something like

// This is a list of your own shortcuts for Telegram Desktop
// You can see full list of commands in the 'shortcuts-default.json' file
// Place a null value instead of a command string to switch the shortcut off

[
    // {
    //     "command": "close_telegram",
    //     "keys": "ctrl+f4"
    // },
    // {
    //     "command": "quit_telegram",
    //     "keys": "ctrl+q"
    // }

        {
            "command": "next_chat",
            "keys": "j"
        },

        {
            "command": "previous_chat",
            "keys": "k"
        },

        {
            "command": "search",
            "keys": "/" // use esc to quit search
        }

]

it works like a charm after restaring telegram except the fact that you can't type this symbols how since there is no such thing as edit mode. However, you can bind this commands with modifier keys.

roboalex123 commented 1 year ago

Where is this file in Linux?

guillaumeboehm commented 1 year ago

Where is this file in Linux?

~/.local/share/TelegramDesktop/tdata

corruptmane commented 12 months ago

Where is this file in Linux?

I can't find anything like it with MacOS version of Telegram (from App Store)

kkk-petrov commented 8 months ago

up

katsu-chan commented 8 months ago

bump

tokiory commented 7 months ago

bump

Bsodoge commented 7 months ago

bump

ic-it commented 7 months ago

bump

ricardoprato commented 7 months ago

bump

notaLonelyDay commented 6 months ago

I can't find anything like it with MacOS version of Telegram (from App Store)

Because in appstore there is telegram for mac, that is on swift

Install telegram desktop from telegram.org and then go to ~/Library/Application Support/Telegram Desktop/tdata

xndrpr commented 3 months ago

Up! Please make this a feature!

egnvk commented 3 months ago

up

RealYukiSan commented 2 months ago

Is there any documentation on keybinding accessibility? I'm familiar with a few, such as Tab and Ctrl+F, but it would be great to find comprehensive documentation somewhere.

pinbraerts commented 2 months ago

Would be great to find comprehensive documentation somewhere.

I mentioned the configuration files above. It says

You can see full list of commands in the 'shortcuts-default.json' file

I tried to extend the list of configurable shortcuts, but PgUp and PgDown are hardcoded in the event handler and I can't quite get them to work stably via shortcuts. If someone here knows how to speed up linking of the project, it would substantially speed up the research...

pinbraerts commented 2 months ago

I managed to do it via the shortcuts api. In my branch it is possible to configure custom shortcuts for scrolling the chat via shortcurts-custom.json

  {
    "command": "chat_scroll_up",
    "keys": "ctrl+u"
  },
  {
    "command": "chat_scroll_down",
    "keys": "ctrl+d"
  }

It is totally possible to implement scrolling for fractions of the screen height

BachoSeven commented 1 month ago

I managed to do it via the shortcuts api. In my branch it is possible to configure custom shortcuts for scrolling the chat via shortcurts-custom.json

  {
    "command": "scroll_up_chat",
    "keys": "ctrl+u"
  },
  {
    "command": "scroll_down_chat",
    "keys": "ctrl+d"
  }

It is totally possible to implement scrolling for fractions of the screen height

@ilya-fedin Is this kind of thing PR-able, in your opinion? i've wanted to do this in tg-desktop forever

ilya-fedin commented 1 month ago

Is this kind of thing PR-able, in your opinion?

My opinion doesn't really matter as I'm just a person doing PRs just as well, not the person doing decisions 😅

cloversmith commented 1 month ago

would love to move with hjkl and other vi keys through telegram, so far i was only able to make scrolling through list of chats with ctrl-jk

pinbraerts commented 1 month ago

I don't think my PR will be merged any time soon. Recently I've stumbled upon Theo's video and despite my skepticism, It provides a great solution to the problem of VIM keymaps. Basically, on his mac he set up an autohotkey program which remaps ctrl+hjkl to arrows. I think this is genious not only in practice (don't have to reconfigure each program, update to latest versions and wait for bogus PRs), but also in theory. It's like sematical html elements. Yes, we all praise hjkl, but technically arrows are the buttons with exact purpose of moving around, so it makes sense for any program to implement those. I think I'll implement the same in my configuration by rebinding ctrl+hjkl to arrows, ctrl+ud to PgUp/Down, ctrl+np to Next/Previous, ctrl+w to ctrl+backspace and ctrl+oi to Backwards/Forwards and map corresponding keys back in VIM if it does not handle them correctly.

Andrew15-5 commented 1 month ago

It's time to reveal my secret. I've switched to Glove80 which is a fully programmable ZMK keyboard. And now with the concept of layers I can make 4 home row keys an arrows.

This is generally very useful, but it still tedious to edit text, because you need to hold Ctrl and/or Shift a lot.

For scrolling through the chat I have page up/down keys under my left hand. Since there's a feature of fast scrolling which requires a mouse scroll wheel, it's a bit harder to use, but there is a mouse keys branch which allows me to imitate a mouse with the keyboard. Meaning I can go to mouse layer and scroll with a key. Holding modifiers with change the speed.

And for navigating through "folders" and chats I can use home row modifiers + home row arrows. So, Alt, Ctrl etc. are on the left and arrows are on the right. Only need to switch to a different layer with a thumb. All these layers are from sunaku's Glorious Engrammer config (I also switched to Engrammer from QWERTY).

This have helped me move away from touchpad completely. So I only ever need this keyboard for daily use. And numpad is also on the right half, so I don't need long keyboard with a numpad anymore. But the reason I switched is an RSI that's now gone.

P.S. I just shared my story, I'm not saying that buying a new keyboard is the solution (though it did solve a lot of problems for me), because I still hate navigating through GUIs. But at least it's much easier now.

chrxn1c commented 2 weeks ago

bump

ic-it commented 1 week ago

bump