Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add multiple accounts in Telegram Desktop [Linux | MacOSX | Windows]

How to add multiple accounts to Telegram Desktop

‼️‼️ As of version 2.1.14 Telegram Desktop supports up to 3 multiple accounts inbuilt ‼️‼️

If you have more you can still use this method (3 accounts per instance)

This guide is for the app available here: https://desktop.telegram.org/ not the one in the Mac/Windows App Store. For the Mac App Store app this should work: https://gist.github.com/Nachtalb/ec590dc974f6ba4674972d4937b230be/#gistcomment-3611415

Introduction

ATM of writing this, there is no way inside the Telegram Client to switch accounts (event though this feature exists in the offical mobile clients and there is a long running issue here: telegramdesktop/tdesktop#4261).

The Official Telegram Desktop client however has the feature to set the working directory with a command line argument -workdir. This enables the use of multiple accounts.

In this guide I will show you a way to use this feature on MacOSX, Linux and Windows. We will be working with the -workdir argument to create multiple instances for each Telegram account.

Replace {{...}} thing with what is written in there. So eg. for me and my TG account @Nachtalb I replace {{MyUsername}} with Nachtalb.

Instructions

Linux

  • Create a folder here ~/.local/share/TelegramDesktop/{{MyUsername}}
  • Create a new .desktop file here ~/.local/share/applications/telegramdesktop-{{myusername}}.desktop.
  • Put in your data in here

⚠️ In this example the Telegram binary resides in /opt/Telegram/Telegrm. This might be different in your case. If so then you have to adjust the path to the binary on the lines TryExec and Exec. ⚠️

[Desktop Entry]
Version=1.0
Name=Telegram {{MyUsername}}
Comment=Official desktop version of Telegram messaging service
TryExec=/opt/Telegram/Telegram
Exec=/opt/Telegram/Telegram -workdir /home/{{your_user}}/.local/share/TelegramDesktop/{{MyUsername}} -- %u
Icon=telegram
Terminal=false
StartupWMClass=TelegramDesktop
Type=Application
Categories=Network;InstantMessaging;Qt;
MimeType=x-scheme-handler/tg;
Keywords=tg;chat;im;messaging;messenger;sms;tdesktop;
X-GNOME-UsesNotifications=true
X-Desktop-File-Install-Version=0.23

OSX

  • Create a folder here: ~/.local/share/TelegramDesktop/{{MyUsername}}

  • Open Automator

  • Create a new Application

    https://user-images.githubusercontent.com/9467802/56354968-6875f500-61d5-11e9-9e61-32f87ba5502c.png
  • Add an apple script by drag & drop from the left-hand side

  • Add the following text:

do shell script "Applications/Telegram.app/Contents/MacOS/Telegram -workdir '/Users/{{your_user}}/.local/share/TelegramDesktop/{{MyUsername}}'"

https://user-images.githubusercontent.com/9467802/56354966-657b0480-61d5-11e9-8341-200ee72d1cb2.png

  • Save to /Applications/Telegram {{MyUsername}}.app
  • Now lastly if you want the have the same icon for your new app, open the file info of both apps (the original telegram and yours) with CMD + I and click on the icon in the top left of the original application. Hit copy CMD + C, click on yours and hit past CMD + V.

Windows

  • Create a folder here: C:\Users\{{your_user}}\AppData\Roaming\Telegram Desktop\{{MyUsername}}
  • Rightclick on your desktop and create a new shortcut
  • Put this in the location field
"C:\Users\{{your_user}}\AppData\Roaming\Telegram Desktop\Telegram.exe" -workdir "C:\Users\{{your_user}}\AppData\Roaming\Telegram Desktop\{{MyUsername}}"
  • Click next and type in a name for the shortcut, usually something like Telegram {{MyUsername}}
  • Lastly to find the application via the start menu you have to copy the link in here
@ngocnam544
Copy link

ngocnam544 commented Apr 15, 2021

Work well on windows. Thank you very much.

@ihsansadn
Copy link

ihsansadn commented Jun 25, 2021

Thank you so much. Work well on LM Ulyssa.

@girifir
Copy link

girifir commented Jul 12, 2021

@totalleo the Telegram Desktop app I am talking about above is not written in Swift but in C++: https://github.com/telegramdesktop/tdesktop
The line defining the max accounts per instance is defined here: https://github.com/telegramdesktop/tdesktop/blob/5cc7c2b6c6ecdce1ab4067549c4e7acd299dd5d5/Telegram/SourceFiles/main/main_domain.h#L33
You can find the build instructions for this client at the bottom of its readme: https://github.com/telegramdesktop/tdesktop#build-instructions
The Telegram app written in Swift would be this one https://github.com/overtake/TelegramSwift. I don't know if it supports more than 3 accounts as I have never used it.

Thank for you comment.

I asked developers of Swift version how to use more than three accounts in one application instance. And it is possible!

To add more than three accounts, you need to click five times on the user pic, it will open a secret developer's menu through which you can add as many accounts as you want.

The same works for the iOS version. Enjoy =)

is this still applicable on the latest version of windows?

@Nachtalb
Copy link
Author

Nachtalb commented Jul 12, 2021

The content from the main article at the top still works. And from what i have heard the swift apps and so on also still have the same functionality as described in the comments.
All in all, as far as i know, nothing has changed @ararar13

@AJackTi
Copy link

AJackTi commented Oct 30, 2021

To add more than three accounts, you need to click five times on the user pic, it will open a secret developer's menu through which you can add as many accounts as you want.

THAT IS SO COOL THANKS A LOT!!!!!

Sorry I have a question. Could you please answer me? What is the user pic? Could you please share with me the screenshot?

@AJackTi
Copy link

AJackTi commented Oct 30, 2021

The content from the main article at the top still works. And from what i have heard the swift apps and so on also still have the same functionality as described in the comments. All in all, as far as i know, nothing has changed @ararar13

Sorry I have a question. Could you please answer me? What is the user pic? Could you please share with me the screenshot?

@Nachtalb
Copy link
Author

Nachtalb commented Oct 30, 2021

To add more than three accounts, you need to click five times on the user pic, it will open a secret developer's menu through which you can add as many accounts as you want.

THAT IS SO COOL THANKS A LOT!!!!!

Sorry I have a question. Could you please answer me? What is the user pic? Could you please share with me the screenshot?

I don't have access to a MacBook anymore so I can't test it myself but with "user pic" he probably meant your user profile picture (probably in the settings view). @AJackTi

CC/ @leoblum

@AJackTi
Copy link

AJackTi commented Oct 30, 2021

To add more than three accounts, you need to click five times on the user pic, it will open a secret developer's menu through which you can add as many accounts as you want.

THAT IS SO COOL THANKS A LOT!!!!!

Sorry I have a question. Could you please answer me? What is the user pic? Could you please share with me the screenshot?

I don't have access to a MacBook anymore so I can't test it myself but with "user pic" he probably meant your user profile picture (probably in the settings view). @AJackTi

CC/ @leoblum

Thank you so much for your help, but I can't open dev mode when clicking on the "user pic" as your instructions. Could you please upload the process when you click the image "user pic" in this your telegram by Window version?

@DebugNewWorld
Copy link

DebugNewWorld commented Dec 2, 2021

@Nachtalb @AJackTi
user pic on the bottom right!
click five time!

2021-12-02 11 30 35

Source: https://github.com/overtake/TelegramSwift/blob/fa0bfbe4daa5caa837b48653b73fcd02e85c29c3/Telegram-Mac/AccountViewController.swift

        if let currentEvent = NSApp.currentEvent, currentEvent.clickCount == 5 {
            context.sharedContext.bindings.rootNavigation().push(DeveloperViewController(context: context))
        }
        

@Nachtalb
Copy link
Author

Nachtalb commented Dec 5, 2021

Thanks for the update @DebugNewWorld 👍

@AJackTi
Copy link

AJackTi commented Dec 10, 2021

Thank you so much @DebugNewWorld
But I want to know how many accounts can I add in this development mode?

@AJackTi
Copy link

AJackTi commented Dec 10, 2021

I had a crash before when adding too many accounts (more than 20 accounts), I still don't understand why I got such a crash? And how to fix this situation? @Nachtalb @DebugNewWorld

@Nachtalb
Copy link
Author

Nachtalb commented Dec 22, 2021

@AJackTi

I don't use the swift app myself nor do I have access to a MacBook anymore. The main topic of the instructions on this page is the official desktop app: https://desktop.telegram.org/ / https://github.com/telegramdesktop/tdesktop

For more in-depth questions for the Swift app about the max number of accounts, crashes etc. please refer to its repository here: https://github.com/overtake/TelegramSwift

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment