diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 6759e5b27..fba7096bf 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -118,7 +118,7 @@ If you already have multiple commits, you can add the commits together (squash t
1. Open `Git Bash` (or `Git Shell`)
2. Enter following command to squash the recent {N} commits: `git reset --soft HEAD~{N} && git commit` (replace `{N}` with the number of commits you want to squash)
3. Press i to get into Insert-mode
-4. Enter the commit message of the new commit (and add the [signature](#sign-your-work) at the and)
+4. Enter the commit message of the new commit (and add the [signature](#sign-your-work) at the end)
5. After adding the message, press ESC to get out of the Insert-mode
6. Write `:wq` and press Enter to save the new message or write `:q!` to discard your changes
7. Enter `git push --force` to push the new commit to the remote repository
@@ -154,4 +154,4 @@ Don't forget to [sign your patch](#sign-your-work) to put it in the public domai
[help_change_commit_message]: https://help.github.com/articles/changing-a-commit-message/
[commit_message]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[pr]: https://github.com/telegramdesktop/tdesktop/compare
-[build_instructions]: https://github.com/telegramdesktop/tdesktop/blob/master/README.md#build-instructions
\ No newline at end of file
+[build_instructions]: https://github.com/telegramdesktop/tdesktop/blob/master/README.md#build-instructions
diff --git a/Telegram/SourceFiles/pspecific_win.cpp b/Telegram/SourceFiles/pspecific_win.cpp
index a1c24375c..3d31f4881 100644
--- a/Telegram/SourceFiles/pspecific_win.cpp
+++ b/Telegram/SourceFiles/pspecific_win.cpp
@@ -813,6 +813,7 @@ void RegisterCustomScheme() {
HKEY rkey;
QString exe = QDir::toNativeSeparators(cExeDir() + cExeName());
+ // Legacy URI scheme registration
if (!_psOpenRegKey(L"Software\\Classes\\tg", &rkey)) return;
if (!_psSetKeyValue(rkey, L"URL Protocol", QString())) return;
if (!_psSetKeyValue(rkey, 0, qsl("URL:Telegram Link"))) return;
@@ -824,6 +825,26 @@ void RegisterCustomScheme() {
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open", &rkey)) return;
if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open\\command", &rkey)) return;
if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl("\" -workdir \"") + cWorkingDir() + qsl("\" -- \"%1\""))) return;
+
+ // URI scheme registration as Default Program - Windows Vista and above
+ if (!_psOpenRegKey(L"Software\\Classes\\tdesktop.tg", &rkey)) return;
+ if (!_psOpenRegKey(L"Software\\Classes\\tdesktop.tg\\DefaultIcon", &rkey)) return;
+ if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl(",1\""))) return;
+
+ if (!_psOpenRegKey(L"Software\\Classes\\tdesktop.tg\\shell", &rkey)) return;
+ if (!_psOpenRegKey(L"Software\\Classes\\tdesktop.tg\\shell\\open", &rkey)) return;
+ if (!_psOpenRegKey(L"Software\\Classes\\tdesktop.tg\\shell\\open\\command", &rkey)) return;
+ if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl("\" -workdir \"") + cWorkingDir() + qsl("\" -- \"%1\""))) return;
+
+ if (!_psOpenRegKey(L"Software\\TelegramDesktop", &rkey)) return;
+ if (!_psOpenRegKey(L"Software\\TelegramDesktop\\Capabilities", &rkey)) return;
+ if (!_psSetKeyValue(rkey, L"ApplicationName", qls("Telegram Desktop"))) return;
+ if (!_psSetKeyValue(rkey, L"ApplicationDescription", qls("Telegram Desktop"))) return;
+ if (!_psOpenRegKey(L"Software\\TelegramDesktop\\Capabilities\\UrlAssociations", &rkey)) return;
+ if (!_psSetKeyValue(rkey, L"tg", qls("tdesktop.tg"))) return;
+
+ if (!_psOpenRegKey(L"Software\\RegisteredApplications", &rkey)) return;
+ if (!_psSetKeyValue(key, L"Telegram Desktop", qls("SOFTWARE\\TelegramDesktop\\Capabilities"))) return;
#endif // !TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
}