mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-20 15:17:41 +00:00
Follow desktop file naming specification
This is required for GApplication to enable all the features https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#file-naming
This commit is contained in:
parent
b4d310fd1e
commit
b9b6a9e747
@ -1681,8 +1681,8 @@ endif()
|
||||
|
||||
if (LINUX AND DESKTOP_APP_USE_PACKAGED)
|
||||
include(GNUInstallDirs)
|
||||
configure_file("../lib/xdg/telegramdesktop.metainfo.xml" "${CMAKE_CURRENT_BINARY_DIR}/telegramdesktop.metainfo.xml" @ONLY)
|
||||
generate_appdata_changelog(Telegram "${CMAKE_SOURCE_DIR}/changelog.txt" "${CMAKE_CURRENT_BINARY_DIR}/telegramdesktop.metainfo.xml")
|
||||
configure_file("../lib/xdg/org.telegram.desktop.metainfo.xml" "${CMAKE_CURRENT_BINARY_DIR}/org.telegram.desktop.metainfo.xml" @ONLY)
|
||||
generate_appdata_changelog(Telegram "${CMAKE_SOURCE_DIR}/changelog.txt" "${CMAKE_CURRENT_BINARY_DIR}/org.telegram.desktop.metainfo.xml")
|
||||
install(TARGETS Telegram RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
install(FILES "Resources/art/icon16.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps" RENAME "telegram.png")
|
||||
install(FILES "Resources/art/icon32.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps" RENAME "telegram.png")
|
||||
@ -1691,6 +1691,6 @@ if (LINUX AND DESKTOP_APP_USE_PACKAGED)
|
||||
install(FILES "Resources/art/icon128.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps" RENAME "telegram.png")
|
||||
install(FILES "Resources/art/icon256.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps" RENAME "telegram.png")
|
||||
install(FILES "Resources/art/icon512.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/512x512/apps" RENAME "telegram.png")
|
||||
install(FILES "../lib/xdg/telegramdesktop.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/telegramdesktop.metainfo.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo")
|
||||
install(FILES "../lib/xdg/org.telegram.desktop.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/org.telegram.desktop.metainfo.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo")
|
||||
endif()
|
||||
|
@ -53,6 +53,6 @@
|
||||
</qresource>
|
||||
<qresource prefix="/misc">
|
||||
<file alias="default_shortcuts-custom.json">../../default_shortcuts-custom.json</file>
|
||||
<file alias="telegramdesktop.desktop">../../../../lib/xdg/telegramdesktop.desktop</file>
|
||||
<file alias="org.telegram.desktop.desktop">../../../../lib/xdg/org.telegram.desktop.desktop</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -114,7 +114,7 @@ static void t_desktop_application_init(TDesktopApplication *application) {
|
||||
namespace Platform {
|
||||
namespace {
|
||||
|
||||
constexpr auto kDesktopFile = ":/misc/telegramdesktop.desktop"_cs;
|
||||
constexpr auto kDesktopFile = ":/misc/org.telegram.desktop.desktop"_cs;
|
||||
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
void PortalAutostart(bool start, bool silent) {
|
||||
@ -481,6 +481,21 @@ bool GenerateDesktopFile(
|
||||
DEBUG_LOG(("App Info: removing old .desktop files"));
|
||||
QFile::remove(qsl("%1telegram.desktop").arg(targetPath));
|
||||
QFile::remove(qsl("%1telegramdesktop.desktop").arg(targetPath));
|
||||
|
||||
const auto appimagePath = qsl("file://%1%2").arg(
|
||||
cExeDir(),
|
||||
cExeName()).toUtf8();
|
||||
|
||||
char md5Hash[33] = { 0 };
|
||||
hashMd5Hex(
|
||||
appimagePath.constData(),
|
||||
appimagePath.size(),
|
||||
md5Hash);
|
||||
|
||||
QFile::remove(qsl("%1appimagekit_%2-%3.desktop").arg(
|
||||
targetPath,
|
||||
md5Hash,
|
||||
AppName.utf16().replace(' ', '_')));
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -647,7 +662,11 @@ int psFixPrevious() {
|
||||
namespace Platform {
|
||||
|
||||
void start() {
|
||||
QGuiApplication::setDesktopFileName([] {
|
||||
const auto d = QFile::encodeName(QDir(cWorkingDir()).absolutePath());
|
||||
char h[33] = { 0 };
|
||||
hashMd5Hex(d.constData(), d.size(), h);
|
||||
|
||||
QGuiApplication::setDesktopFileName([&] {
|
||||
if (KSandbox::isFlatpak()) {
|
||||
return qEnvironmentVariable("FLATPAK_ID") + qsl(".desktop");
|
||||
}
|
||||
@ -659,23 +678,11 @@ void start() {
|
||||
+ qsl(".desktop");
|
||||
}
|
||||
|
||||
if (!Core::UpdaterDisabled() && !cExeName().isEmpty()) {
|
||||
const auto appimagePath = qsl("file://%1%2").arg(
|
||||
cExeDir(),
|
||||
cExeName()).toUtf8();
|
||||
|
||||
char md5Hash[33] = { 0 };
|
||||
hashMd5Hex(
|
||||
appimagePath.constData(),
|
||||
appimagePath.size(),
|
||||
md5Hash);
|
||||
|
||||
return qsl("appimagekit_%1-%2.desktop").arg(
|
||||
md5Hash,
|
||||
AppName.utf16().replace(' ', '_'));
|
||||
if (!Core::UpdaterDisabled()) {
|
||||
return qsl("org.telegram.desktop.%1.desktop").arg(h);
|
||||
}
|
||||
|
||||
return qsl("telegramdesktop.desktop");
|
||||
return qsl("org.telegram.desktop.desktop");
|
||||
}());
|
||||
|
||||
LOG(("Launcher filename: %1").arg(QGuiApplication::desktopFileName()));
|
||||
@ -703,10 +710,6 @@ void start() {
|
||||
#endif // DESKTOP_APP_USE_PACKAGED_FONTS
|
||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
|
||||
const auto d = QFile::encodeName(QDir(cWorkingDir()).absolutePath());
|
||||
char h[33] = { 0 };
|
||||
hashMd5Hex(d.constData(), d.size(), h);
|
||||
|
||||
Webview::WebKit2Gtk::SetSocketPath(qsl("%1/%2-%3-webview-%4").arg(
|
||||
QDir::tempPath(),
|
||||
h,
|
||||
|
@ -66,7 +66,7 @@ def update_appdata(appdata_path, changelog, max_items=None):
|
||||
def main():
|
||||
ap = argparse.ArgumentParser("Parse Telegram changelog")
|
||||
ap.add_argument("-c", "--changelog-path", default="changelog.txt")
|
||||
ap.add_argument("-a", "--appdata-path", default="lib/xdg/telegramdesktop.metainfo.xml")
|
||||
ap.add_argument("-a", "--appdata-path", default="lib/xdg/org.telegram.desktop.metainfo.xml")
|
||||
ap.add_argument("-n", "--num-releases", type=int, default=None)
|
||||
args = ap.parse_args()
|
||||
update_appdata(args.appdata_path,
|
||||
|
@ -17,7 +17,7 @@ apps:
|
||||
telegram-desktop:
|
||||
command: bin/desktop-launch telegram-desktop
|
||||
common-id: org.telegram.desktop
|
||||
desktop: usr/share/applications/telegramdesktop.desktop
|
||||
desktop: usr/share/applications/org.telegram.desktop.desktop
|
||||
environment:
|
||||
# Tell glib to use portals on file associations handling.
|
||||
GTK_USE_PORTAL: 1
|
||||
@ -86,7 +86,7 @@ parts:
|
||||
plugin: cmake
|
||||
source: .
|
||||
source-type: git
|
||||
parse-info: [usr/share/metainfo/telegramdesktop.metainfo.xml]
|
||||
parse-info: [usr/share/metainfo/org.telegram.desktop.metainfo.xml]
|
||||
build-environment:
|
||||
- LD_LIBRARY_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
|
||||
build-packages:
|
||||
@ -142,7 +142,7 @@ parts:
|
||||
|
||||
craftctl set version="$version"
|
||||
|
||||
sed -i 's|^Icon=telegram$|Icon=${SNAP}/meta/gui/icon.png|g' lib/xdg/telegramdesktop.desktop
|
||||
sed -i 's|^Icon=telegram$|Icon=${SNAP}/meta/gui/icon.png|g' lib/xdg/org.telegram.desktop.desktop
|
||||
override-build: |
|
||||
craftctl default
|
||||
rm -rf "$CRAFT_PART_INSTALL/usr/share/icons"
|
||||
|
Loading…
Reference in New Issue
Block a user