Skip to content

Commit 5d7a8fc

Browse files
committed
Add Linux + BSD support
Finally got my motivation to do that again.
1 parent 29a576e commit 5d7a8fc

9 files changed

+114
-129
lines changed

Telegram/CMakeLists.txt

+15-15
Original file line numberDiff line numberDiff line change
@@ -1666,7 +1666,7 @@ else()
16661666
endif()
16671667

16681668
if (build_macstore)
1669-
set(bundle_identifier "org.telegram.desktop")
1669+
set(bundle_identifier "rabbitgram.desktop.desktop")
16701670
set(bundle_entitlements "Telegram Lite.entitlements")
16711671
set(output_name "Telegram Lite")
16721672
set_target_properties(Telegram PROPERTIES
@@ -1860,19 +1860,19 @@ endif()
18601860

18611861
if (LINUX AND DESKTOP_APP_USE_PACKAGED)
18621862
include(GNUInstallDirs)
1863-
configure_file("../lib/xdg/org.telegram.desktop.service" "${CMAKE_CURRENT_BINARY_DIR}/org.telegram.desktop.service" @ONLY)
1864-
configure_file("../lib/xdg/org.telegram.desktop.metainfo.xml" "${CMAKE_CURRENT_BINARY_DIR}/org.telegram.desktop.metainfo.xml" @ONLY)
1865-
generate_appdata_changelog(Telegram "${CMAKE_SOURCE_DIR}/changelog.txt" "${CMAKE_CURRENT_BINARY_DIR}/org.telegram.desktop.metainfo.xml")
1863+
configure_file("../lib/xdg/rabbitgram.desktop.service" "${CMAKE_CURRENT_BINARY_DIR}/rabbitgram.desktop.service" @ONLY)
1864+
configure_file("../lib/xdg/rabbitgram.desktop.metainfo.xml" "${CMAKE_CURRENT_BINARY_DIR}/rabbitgram.desktop.metainfo.xml" @ONLY)
1865+
generate_appdata_changelog(Telegram "${CMAKE_SOURCE_DIR}/changelog.txt" "${CMAKE_CURRENT_BINARY_DIR}/rabbitgram.desktop.metainfo.xml")
18661866
install(TARGETS Telegram RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}")
1867-
install(FILES "Resources/art/icon16.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps" RENAME "telegram.png")
1868-
install(FILES "Resources/art/icon32.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps" RENAME "telegram.png")
1869-
install(FILES "Resources/art/icon48.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps" RENAME "telegram.png")
1870-
install(FILES "Resources/art/icon64.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/64x64/apps" RENAME "telegram.png")
1871-
install(FILES "Resources/art/icon128.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps" RENAME "telegram.png")
1872-
install(FILES "Resources/art/icon256.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps" RENAME "telegram.png")
1873-
install(FILES "Resources/art/icon512.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/512x512/apps" RENAME "telegram.png")
1874-
install(FILES "Resources/icons/tray_monochrome.svg" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/symbolic/apps" RENAME "telegram-symbolic.svg")
1875-
install(FILES "../lib/xdg/org.telegram.desktop.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
1876-
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/org.telegram.desktop.service" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/dbus-1/services")
1877-
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/org.telegram.desktop.metainfo.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo")
1867+
install(FILES "Resources/art/icon16.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps" RENAME "rabbitgram.png")
1868+
install(FILES "Resources/art/icon32.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps" RENAME "rabbitgram.png")
1869+
install(FILES "Resources/art/icon48.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps" RENAME "rabbitgram.png")
1870+
install(FILES "Resources/art/icon64.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/64x64/apps" RENAME "rabbitgram.png")
1871+
install(FILES "Resources/art/icon128.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps" RENAME "rabbitgram.png")
1872+
install(FILES "Resources/art/icon256.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps" RENAME "rabbitgram.png")
1873+
install(FILES "Resources/art/icon512.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/512x512/apps" RENAME "rabbitgram.png")
1874+
install(FILES "Resources/icons/tray_monochrome.svg" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/symbolic/apps" RENAME "rabbitgram-symbolic.svg")
1875+
install(FILES "../lib/xdg/rabbitgram.desktop.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
1876+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/rabbitgram.desktop.service" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/dbus-1/services")
1877+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/rabbitgram.desktop.metainfo.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo")
18781878
endif()

Telegram/Resources/qrc/telegram/telegram.qrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<qresource prefix="/misc">
5757
<file alias="default_shortcuts-custom.json">../../default_shortcuts-custom.json</file>
5858
<file alias="default_-settings-custom.json">../../default_rabbit-settings-custom.json</file>
59-
<file alias="org.telegram.desktop.desktop">../../../../lib/xdg/org.telegram.desktop.desktop</file>
59+
<file alias="rabbitgram.desktop.desktop">../../../../lib/xdg/rabbitgram.desktop.desktop</file>
6060
</qresource>
6161
<qresource prefix="/rtg_lang">
6262
<file alias="alttg.json">../../langs/rabbit/alttg.json</file>

Telegram/SourceFiles/platform/linux/specific_linux.cpp

+6-11
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ bool GenerateDesktopFile(
198198
DEBUG_LOG(("App Info: placing .desktop file to %1").arg(targetPath));
199199
if (!QDir(targetPath).exists()) QDir().mkpath(targetPath);
200200

201-
const auto sourceFile = u":/misc/org.telegram.desktop.desktop"_q;
201+
const auto sourceFile = u":/misc/rabbitgram.desktop.desktop"_q;
202202
const auto targetFile = targetPath
203203
+ QGuiApplication::desktopFileName()
204204
+ u".desktop"_q;
@@ -295,11 +295,6 @@ bool GenerateDesktopFile(
295295
| QFileDevice::ExeGroup
296296
| QFileDevice::ExeOther);
297297

298-
if (!Core::UpdaterDisabled()) {
299-
DEBUG_LOG(("App Info: removing old .desktop files"));
300-
QFile::remove(u"%1telegram.desktop"_q.arg(targetPath));
301-
QFile::remove(u"%1telegramdesktop.desktop"_q.arg(targetPath));
302-
303298
const auto appimagePath = u"file://%1%2"_q.arg(
304299
cExeDir(),
305300
cExeName()).toUtf8();
@@ -319,7 +314,7 @@ bool GenerateDesktopFile(
319314
hashMd5Hex(d.constData(), d.size(), md5Hash);
320315

321316
if (!Core::Launcher::Instance().customWorkingDir()) {
322-
QFile::remove(u"%1org.telegram.desktop._%2.desktop"_q.arg(
317+
QFile::remove(u"%1rabbitgram.desktop._%2.desktop"_q.arg(
323318
targetPath,
324319
md5Hash));
325320

@@ -328,7 +323,7 @@ bool GenerateDesktopFile(
328323
hashMd5Hex(exePath.constData(), exePath.size(), md5Hash);
329324
}
330325

331-
QFile::remove(u"%1org.telegram.desktop.%2.desktop"_q.arg(
326+
QFile::remove(u"%1rabbitgram.desktop.%2.desktop"_q.arg(
332327
targetPath,
333328
md5Hash));
334329
}
@@ -387,7 +382,7 @@ bool GenerateServiceFile(bool silent = false) {
387382
const auto d = QFile::encodeName(QDir(cWorkingDir()).absolutePath());
388383
hashMd5Hex(d.constData(), d.size(), md5Hash);
389384

390-
QFile::remove(u"%1org.telegram.desktop._%2.service"_q.arg(
385+
QFile::remove(u"%1rabbitgram.desktop.desktop._%2.service"_q.arg(
391386
targetPath,
392387
md5Hash));
393388
}
@@ -623,10 +618,10 @@ void start() {
623618
md5Hash.data());
624619
}
625620

626-
return u"org.telegram.desktop._%1"_q.arg(md5Hash.constData());
621+
return u"rabbitgram.desktop.desktop._%1"_q.arg(md5Hash.constData());
627622
}
628623

629-
return u"org.telegram.desktop"_q;
624+
return u"rabbitgram.desktop.desktop"_q;
630625
}());
631626

632627
LOG(("App ID: %1").arg(QGuiApplication::desktopFileName()));

Telegram/build/changelog2appdata.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def update_appdata(appdata_path, changelog, max_items=None):
6666
def main():
6767
ap = argparse.ArgumentParser("Parse Telegram changelog")
6868
ap.add_argument("-c", "--changelog-path", default="changelog.txt")
69-
ap.add_argument("-a", "--appdata-path", default="lib/xdg/org.telegram.desktop.metainfo.xml")
69+
ap.add_argument("-a", "--appdata-path", default="lib/xdg/rabbitgram.desktop.metainfo.xml")
7070
ap.add_argument("-n", "--num-releases", type=int, default=None)
7171
args = ap.parse_args()
7272
update_appdata(args.appdata_path,

lib/xdg/org.telegram.desktop.metainfo.xml

-90
This file was deleted.

lib/xdg/org.telegram.desktop.service

-3
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[Desktop Entry]
2-
Name=Telegram Desktop
3-
Comment=Official desktop version of Telegram messaging app
4-
TryExec=telegram-desktop
5-
Exec=telegram-desktop -- %u
6-
Icon=telegram
2+
Name=rabbitGram Desktop
3+
Comment=Unofficial Telegram Desktop messaging app
4+
TryExec=rabbitgram-desktop
5+
Exec=DESKTOPINTEGRATION=1 rabbitgram-desktop -- %u
6+
Icon=rabbitgram
77
Terminal=false
8-
StartupWMClass=TelegramDesktop
8+
StartupWMClass=rabbitGram
99
Type=Application
1010
Categories=Chat;Network;InstantMessaging;Qt;
1111
MimeType=x-scheme-handler/tg;
@@ -17,6 +17,6 @@ X-GNOME-UsesNotifications=true
1717
X-GNOME-SingleWindow=true
1818

1919
[Desktop Action quit]
20-
Exec=telegram-desktop -quit
21-
Name=Quit Telegram
20+
Exec=rabbitgram-desktop -quit
21+
Name=Quit rabbitGram
2222
Icon=application-exit
+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<component type="desktop">
3+
<id>rabbitgram.desktop</id>
4+
<metadata_license>CC0-1.0</metadata_license>
5+
<project_license>GPL-3.0</project_license>
6+
<name>rabbitGram Desktop</name>
7+
<summary>Unofficial Telegram Desktop messaging app</summary>
8+
<description>
9+
<p>rabbitGram Desktop – Telegram Desktop based messenger with special features</p>
10+
</description>
11+
<categories>
12+
<category>Network</category>
13+
<category>InstantMessaging</category>
14+
</categories>
15+
<update_contact>smcartix_at_gmail.com</update_contact>
16+
<developer_name>xmdnusr</developer_name>
17+
<url type="homepage">https://github.com/rabbitGramDesktop/rabbitGramDesktop</url>
18+
<url type="bugtracker">https://t.me/rabbitGramDesktop/23</url>
19+
<url type="contribute">https://github.com/rabbitGramDesktop/rabbitGramDesktop/blob/dev/.github/CONTRIBUTING.md</url>
20+
<screenshots>
21+
<screenshot type="default">
22+
<image>https://user-images.githubusercontent.com/72883689/252349223-082fe7d6-eeba-4198-83ab-843d08ac909c.png</image>
23+
</screenshot>
24+
</screenshots>
25+
<keywords>
26+
<keyword>tg</keyword>
27+
<keyword>telegram</keyword>
28+
<keyword>tdesktop</keyword>
29+
<keyword>messaging</keyword>
30+
<keyword>messenger</keyword>
31+
<keyword>chat</keyword>
32+
<keyword>sms</keyword>
33+
<keyword>im</keyword>
34+
<keyword>exteragram</keyword>
35+
<keyword>rabbitgram</keyword>
36+
</keywords>
37+
<requires>
38+
<display_length compare="ge">medium</display_length>
39+
<internet>always</internet>
40+
</requires>
41+
<supports>
42+
<control>pointing</control>
43+
<control>keyboard</control>
44+
<control>touch</control>
45+
</supports>
46+
<content_rating type="oars-1.1">
47+
<content_attribute id="violence-cartoon">none</content_attribute>
48+
<content_attribute id="violence-fantasy">none</content_attribute>
49+
<content_attribute id="violence-realistic">none</content_attribute>
50+
<content_attribute id="violence-bloodshed">none</content_attribute>
51+
<content_attribute id="violence-sexual">none</content_attribute>
52+
<content_attribute id="violence-desecration">none</content_attribute>
53+
<content_attribute id="violence-slavery">none</content_attribute>
54+
<content_attribute id="violence-worship">none</content_attribute>
55+
<content_attribute id="drugs-alcohol">none</content_attribute>
56+
<content_attribute id="drugs-narcotics">none</content_attribute>
57+
<content_attribute id="drugs-tobacco">none</content_attribute>
58+
<content_attribute id="sex-nudity">none</content_attribute>
59+
<content_attribute id="sex-themes">none</content_attribute>
60+
<content_attribute id="sex-homosexuality">none</content_attribute>
61+
<content_attribute id="sex-prostitution">none</content_attribute>
62+
<content_attribute id="sex-adultery">none</content_attribute>
63+
<content_attribute id="sex-appearance">none</content_attribute>
64+
<content_attribute id="language-profanity">none</content_attribute>
65+
<content_attribute id="language-humor">none</content_attribute>
66+
<content_attribute id="language-discrimination">none</content_attribute>
67+
<content_attribute id="social-chat">intense</content_attribute>
68+
<content_attribute id="social-info">none</content_attribute>
69+
<content_attribute id="social-audio">intense</content_attribute>
70+
<content_attribute id="social-location">none</content_attribute>
71+
<content_attribute id="social-contacts">intense</content_attribute>
72+
<content_attribute id="money-purchasing">intense</content_attribute>
73+
<content_attribute id="money-gambling">none</content_attribute>
74+
<content_attribute id="money-advertising">moderate</content_attribute>
75+
</content_rating>
76+
<launchable type="desktop-id">rabbitgram.desktop.desktop</launchable>
77+
<provides>
78+
<binary>rabbitgram-desktop</binary>
79+
</provides>
80+
</component>

lib/xdg/rabbitgram.desktop.service

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[D-BUS Service]
2+
Name=rabbitgram.desktop
3+
Exec=@CMAKE_INSTALL_FULL_BINDIR@/rabbitgram-desktop

0 commit comments

Comments
 (0)