mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02: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
7 changed files with 33 additions and 30 deletions
|
@ -1681,8 +1681,8 @@ endif()
|
||||||
|
|
||||||
if (LINUX AND DESKTOP_APP_USE_PACKAGED)
|
if (LINUX AND DESKTOP_APP_USE_PACKAGED)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
configure_file("../lib/xdg/telegramdesktop.metainfo.xml" "${CMAKE_CURRENT_BINARY_DIR}/telegramdesktop.metainfo.xml" @ONLY)
|
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}/telegramdesktop.metainfo.xml")
|
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(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/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")
|
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/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/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 "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 "../lib/xdg/org.telegram.desktop.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications")
|
||||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/telegramdesktop.metainfo.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo")
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/org.telegram.desktop.metainfo.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -53,6 +53,6 @@
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/misc">
|
<qresource prefix="/misc">
|
||||||
<file alias="default_shortcuts-custom.json">../../default_shortcuts-custom.json</file>
|
<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>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -114,7 +114,7 @@ static void t_desktop_application_init(TDesktopApplication *application) {
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
constexpr auto kDesktopFile = ":/misc/telegramdesktop.desktop"_cs;
|
constexpr auto kDesktopFile = ":/misc/org.telegram.desktop.desktop"_cs;
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
void PortalAutostart(bool start, bool silent) {
|
void PortalAutostart(bool start, bool silent) {
|
||||||
|
@ -481,6 +481,21 @@ bool GenerateDesktopFile(
|
||||||
DEBUG_LOG(("App Info: removing old .desktop files"));
|
DEBUG_LOG(("App Info: removing old .desktop files"));
|
||||||
QFile::remove(qsl("%1telegram.desktop").arg(targetPath));
|
QFile::remove(qsl("%1telegram.desktop").arg(targetPath));
|
||||||
QFile::remove(qsl("%1telegramdesktop.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;
|
return true;
|
||||||
|
@ -647,7 +662,11 @@ int psFixPrevious() {
|
||||||
namespace Platform {
|
namespace Platform {
|
||||||
|
|
||||||
void start() {
|
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()) {
|
if (KSandbox::isFlatpak()) {
|
||||||
return qEnvironmentVariable("FLATPAK_ID") + qsl(".desktop");
|
return qEnvironmentVariable("FLATPAK_ID") + qsl(".desktop");
|
||||||
}
|
}
|
||||||
|
@ -659,23 +678,11 @@ void start() {
|
||||||
+ qsl(".desktop");
|
+ qsl(".desktop");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Core::UpdaterDisabled() && !cExeName().isEmpty()) {
|
if (!Core::UpdaterDisabled()) {
|
||||||
const auto appimagePath = qsl("file://%1%2").arg(
|
return qsl("org.telegram.desktop.%1.desktop").arg(h);
|
||||||
cExeDir(),
|
|
||||||
cExeName()).toUtf8();
|
|
||||||
|
|
||||||
char md5Hash[33] = { 0 };
|
|
||||||
hashMd5Hex(
|
|
||||||
appimagePath.constData(),
|
|
||||||
appimagePath.size(),
|
|
||||||
md5Hash);
|
|
||||||
|
|
||||||
return qsl("appimagekit_%1-%2.desktop").arg(
|
|
||||||
md5Hash,
|
|
||||||
AppName.utf16().replace(' ', '_'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return qsl("telegramdesktop.desktop");
|
return qsl("org.telegram.desktop.desktop");
|
||||||
}());
|
}());
|
||||||
|
|
||||||
LOG(("Launcher filename: %1").arg(QGuiApplication::desktopFileName()));
|
LOG(("Launcher filename: %1").arg(QGuiApplication::desktopFileName()));
|
||||||
|
@ -703,10 +710,6 @@ void start() {
|
||||||
#endif // DESKTOP_APP_USE_PACKAGED_FONTS
|
#endif // DESKTOP_APP_USE_PACKAGED_FONTS
|
||||||
#endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#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(
|
Webview::WebKit2Gtk::SetSocketPath(qsl("%1/%2-%3-webview-%4").arg(
|
||||||
QDir::tempPath(),
|
QDir::tempPath(),
|
||||||
h,
|
h,
|
||||||
|
|
|
@ -66,7 +66,7 @@ def update_appdata(appdata_path, changelog, max_items=None):
|
||||||
def main():
|
def main():
|
||||||
ap = argparse.ArgumentParser("Parse Telegram changelog")
|
ap = argparse.ArgumentParser("Parse Telegram changelog")
|
||||||
ap.add_argument("-c", "--changelog-path", default="changelog.txt")
|
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)
|
ap.add_argument("-n", "--num-releases", type=int, default=None)
|
||||||
args = ap.parse_args()
|
args = ap.parse_args()
|
||||||
update_appdata(args.appdata_path,
|
update_appdata(args.appdata_path,
|
||||||
|
|
|
@ -17,7 +17,7 @@ apps:
|
||||||
telegram-desktop:
|
telegram-desktop:
|
||||||
command: bin/desktop-launch telegram-desktop
|
command: bin/desktop-launch telegram-desktop
|
||||||
common-id: org.telegram.desktop
|
common-id: org.telegram.desktop
|
||||||
desktop: usr/share/applications/telegramdesktop.desktop
|
desktop: usr/share/applications/org.telegram.desktop.desktop
|
||||||
environment:
|
environment:
|
||||||
# Tell glib to use portals on file associations handling.
|
# Tell glib to use portals on file associations handling.
|
||||||
GTK_USE_PORTAL: 1
|
GTK_USE_PORTAL: 1
|
||||||
|
@ -86,7 +86,7 @@ parts:
|
||||||
plugin: cmake
|
plugin: cmake
|
||||||
source: .
|
source: .
|
||||||
source-type: git
|
source-type: git
|
||||||
parse-info: [usr/share/metainfo/telegramdesktop.metainfo.xml]
|
parse-info: [usr/share/metainfo/org.telegram.desktop.metainfo.xml]
|
||||||
build-environment:
|
build-environment:
|
||||||
- LD_LIBRARY_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
|
- LD_LIBRARY_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
|
||||||
build-packages:
|
build-packages:
|
||||||
|
@ -142,7 +142,7 @@ parts:
|
||||||
|
|
||||||
craftctl set version="$version"
|
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: |
|
override-build: |
|
||||||
craftctl default
|
craftctl default
|
||||||
rm -rf "$CRAFT_PART_INSTALL/usr/share/icons"
|
rm -rf "$CRAFT_PART_INSTALL/usr/share/icons"
|
||||||
|
|
Loading…
Add table
Reference in a new issue