Linux + iPhone Continuity / iMessage / SMS
fix: use themeable standard notification icon names
Artrixc37cd48afcc5
diff --git a/src/core/src/bluetooth/ancs/notifications.cpp b/src/core/src/bluetooth/ancs/notifications.cppindex 685ae77..2054a57 100644--- a/src/core/src/bluetooth/ancs/notifications.cpp+++ b/src/core/src/bluetooth/ancs/notifications.cpp@@ -149,11 +149,11 @@ namespace tether::bluetooth::ancs {static const std::map<std::string, const char*> by_app_id{{"com.amazon.Amazon", "amazon"},{"com.apple.MobileAddressBook", "x-office-address-book"},- {"com.apple.MobileSMS", "tether-notification-imessage"},+ {"com.apple.MobileSMS", "imessage"},{"com.apple.Music", "multimedia-player"},{"com.apple.facetime", "camera-web"},{"com.apple.mobilecal", "office-calendar"},- {"com.apple.mobilemail", "tether-notification-mail"},+ {"com.apple.mobilemail", "mail"},{"com.apple.mobilenotes", "accessories-text-editor"},{"com.apple.mobilephone", "call-start"},{"com.apple.mobileslideshow", "multimedia-photo-viewer"},@@ -161,32 +161,32 @@ namespace tether::bluetooth::ancs {{"com.apple.podcasts", "podcasts"},{"com.apple.reminders", "view-task"},{"com.atebits.Tweetie2", "twitter"},- {"com.burbn.instagram", "tether-notification-instagram"},- {"com.facebook.Facebook", "tether-notification-facebook"},+ {"com.burbn.instagram", "instagram"},+ {"com.facebook.Facebook", "facebook"},{"com.facebook.Messenger", "messenger"},- {"com.github.github", "tether-notification-github"},- {"com.github.stormbreaker.prod", "tether-notification-github"},- {"com.google.Gmail", "tether-notification-gmail"},+ {"com.github.github", "github"},+ {"com.github.stormbreaker.prod", "github"},+ {"com.google.Gmail", "gmail"},{"com.google.Maps", "google-maps"},- {"com.google.ios.youtube", "tether-notification-youtube"},- {"com.hammerandchisel.discord", "tether-notification-discord"},+ {"com.google.ios.youtube", "youtube"},+ {"com.hammerandchisel.discord", "discord"},{"com.linkedin.LinkedIn", "linkedin"},- {"com.instructure.ios.CanvasParent", "tether-notification-canvas"},- {"com.instructure.ios.CanvasStudent", "tether-notification-canvas"},- {"com.instructure.ios.CanvasTeacher", "tether-notification-canvas"},- {"com.microsoft.Office.Outlook", "tether-notification-outlook"},- {"com.microsoft.skype.teams", "tether-notification-teams"},- {"com.microsoft.teams", "tether-notification-teams"},- {"com.reddit.Reddit", "tether-notification-reddit"},- {"com.spotify.client", "tether-notification-spotify"},+ {"com.instructure.ios.CanvasParent", "canvas"},+ {"com.instructure.ios.CanvasStudent", "canvas"},+ {"com.instructure.ios.CanvasTeacher", "canvas"},+ {"com.microsoft.Office.Outlook", "outlook"},+ {"com.microsoft.skype.teams", "teams"},+ {"com.microsoft.teams", "teams"},+ {"com.reddit.Reddit", "reddit"},+ {"com.spotify.client", "spotify"},{"com.tinyspeck.chatlyio", "slack"},- {"com.toyopagroup.picaboo", "tether-notification-snapchat"},+ {"com.toyopagroup.picaboo", "snapchat"},{"com.ubercab.UberClient", "uber"},- {"com.zhiliaoapp.musically", "tether-notification-tiktok"},- {"net.whatsapp.WhatsApp", "tether-notification-whatsapp"},- {"org.telegram.messenger", "tether-notification-telegram"},- {"org.whispersystems.signal", "tether-notification-signal"},- {"ph.telegra.Telegraph", "tether-notification-telegram"},+ {"com.zhiliaoapp.musically", "tiktok"},+ {"net.whatsapp.WhatsApp", "whatsapp"},+ {"org.telegram.messenger", "telegram"},+ {"org.whispersystems.signal", "signal"},+ {"ph.telegra.Telegraph", "telegram"},{"us.zoom.videomeetings", "zoom"},};diff --git a/src/daemon/notification.cpp b/src/daemon/notification.cppindex e97094c..aec67c6 100644--- a/src/daemon/notification.cpp+++ b/src/daemon/notification.cpp@@ -86,18 +86,12 @@ namespace tether {return {};}- // Identifies the sending app to the notification server. Servers use- // this desktop entry for the app label and may take its icon over the- // icon passed to NotifyNotification.- void set_identity(NotifyNotification* notification,- const std::string& app_name,- const std::string& icon = {}) {- // Notification servers use desktop-entry as the notification's app- // identity and may replace the supplied icon with that entry's icon.- // Give bundled iPhone app icons their own matching identity so the- // server keeps both the app name and its icon instead of showing Tether.- const std::string desktop_entry = icon.starts_with("tether-notification-") ? icon : DESKTOP_ENTRY;- notify_notification_set_hint(notification, "desktop-entry", g_variant_new_string(desktop_entry.c_str()));+ // File-transfer notifications belong to Tether. Forwarded phone+ // notifications carry their own standard icon name; don't identify them+ // as Tether or servers may replace that icon with Tether's app icon.+ void set_identity(NotifyNotification* notification, const std::string& app_name) {+ if (app_name.empty())+ notify_notification_set_hint(notification, "desktop-entry", g_variant_new_string(DESKTOP_ENTRY));if (!app_name.empty()) {// KDE uses this label for the originating iPhone app.notify_notification_set_hint(@@ -302,7 +296,7 @@ namespace tether {if (!notification)return G_SOURCE_REMOVE;- set_identity(notification, spec->app_name, icon);+ set_identity(notification, spec->app_name);notify_notification_set_urgency(notification, spec->quiet ? NOTIFY_URGENCY_LOW : NOTIFY_URGENCY_NORMAL);const AppLauncher launcher = spec->app_id.empty() ? AppLauncher{} : resolve_launcher(spec->app_id);diff --git a/src/gtk/CMakeLists.txt b/src/gtk/CMakeLists.txtindex 8d042e4..f63b522 100644--- a/src/gtk/CMakeLists.txt+++ b/src/gtk/CMakeLists.txt@@ -70,7 +70,3 @@ install(FILES icons/symbolic/tether-symbolic.svgfile(GLOB TETHER_NOTIFICATION_ICONS CONFIGURE_DEPENDS icons/notifications/*.svg)install(FILES ${TETHER_NOTIFICATION_ICONS}DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)--file(GLOB TETHER_NOTIFICATION_DESKTOP_FILES CONFIGURE_DEPENDS icons/notifications/*.desktop)-install(FILES ${TETHER_NOTIFICATION_DESKTOP_FILES}- DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)diff --git a/src/gtk/icons/notifications/tether-notification-canvas.svg b/src/gtk/icons/notifications/canvas.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-canvas.svgrename to src/gtk/icons/notifications/canvas.svgdiff --git a/src/gtk/icons/notifications/tether-notification-discord.svg b/src/gtk/icons/notifications/discord.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-discord.svgrename to src/gtk/icons/notifications/discord.svgdiff --git a/src/gtk/icons/notifications/tether-notification-facebook.svg b/src/gtk/icons/notifications/facebook.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-facebook.svgrename to src/gtk/icons/notifications/facebook.svgdiff --git a/src/gtk/icons/notifications/tether-notification-github.svg b/src/gtk/icons/notifications/github.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-github.svgrename to src/gtk/icons/notifications/github.svgdiff --git a/src/gtk/icons/notifications/tether-notification-gmail.svg b/src/gtk/icons/notifications/gmail.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-gmail.svgrename to src/gtk/icons/notifications/gmail.svgdiff --git a/src/gtk/icons/notifications/tether-notification-imessage.svg b/src/gtk/icons/notifications/imessage.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-imessage.svgrename to src/gtk/icons/notifications/imessage.svgdiff --git a/src/gtk/icons/notifications/tether-notification-instagram.svg b/src/gtk/icons/notifications/instagram.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-instagram.svgrename to src/gtk/icons/notifications/instagram.svgdiff --git a/src/gtk/icons/notifications/tether-notification-mail.svg b/src/gtk/icons/notifications/mail.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-mail.svgrename to src/gtk/icons/notifications/mail.svgdiff --git a/src/gtk/icons/notifications/tether-notification-outlook.svg b/src/gtk/icons/notifications/outlook.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-outlook.svgrename to src/gtk/icons/notifications/outlook.svgdiff --git a/src/gtk/icons/notifications/tether-notification-reddit.svg b/src/gtk/icons/notifications/reddit.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-reddit.svgrename to src/gtk/icons/notifications/reddit.svgdiff --git a/src/gtk/icons/notifications/tether-notification-signal.svg b/src/gtk/icons/notifications/signal.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-signal.svgrename to src/gtk/icons/notifications/signal.svgdiff --git a/src/gtk/icons/notifications/tether-notification-snapchat.svg b/src/gtk/icons/notifications/snapchat.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-snapchat.svgrename to src/gtk/icons/notifications/snapchat.svgdiff --git a/src/gtk/icons/notifications/tether-notification-spotify.svg b/src/gtk/icons/notifications/spotify.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-spotify.svgrename to src/gtk/icons/notifications/spotify.svgdiff --git a/src/gtk/icons/notifications/tether-notification-teams.svg b/src/gtk/icons/notifications/teams.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-teams.svgrename to src/gtk/icons/notifications/teams.svgdiff --git a/src/gtk/icons/notifications/tether-notification-telegram.svg b/src/gtk/icons/notifications/telegram.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-telegram.svgrename to src/gtk/icons/notifications/telegram.svgdiff --git a/src/gtk/icons/notifications/tether-notification-canvas.desktop b/src/gtk/icons/notifications/tether-notification-canvas.desktopdeleted file mode 100644index cf01c07..0000000--- a/src/gtk/icons/notifications/tether-notification-canvas.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=Canvas-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-canvas-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-discord.desktop b/src/gtk/icons/notifications/tether-notification-discord.desktopdeleted file mode 100644index b66bbac..0000000--- a/src/gtk/icons/notifications/tether-notification-discord.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=Discord-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-discord-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-facebook.desktop b/src/gtk/icons/notifications/tether-notification-facebook.desktopdeleted file mode 100644index 5758d64..0000000--- a/src/gtk/icons/notifications/tether-notification-facebook.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=Facebook-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-facebook-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-github.desktop b/src/gtk/icons/notifications/tether-notification-github.desktopdeleted file mode 100644index 824f2fe..0000000--- a/src/gtk/icons/notifications/tether-notification-github.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=GitHub-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-github-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-gmail.desktop b/src/gtk/icons/notifications/tether-notification-gmail.desktopdeleted file mode 100644index 67a5037..0000000--- a/src/gtk/icons/notifications/tether-notification-gmail.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=Gmail-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-gmail-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-imessage.desktop b/src/gtk/icons/notifications/tether-notification-imessage.desktopdeleted file mode 100644index 9826608..0000000--- a/src/gtk/icons/notifications/tether-notification-imessage.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=Messages-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-imessage-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-instagram.desktop b/src/gtk/icons/notifications/tether-notification-instagram.desktopdeleted file mode 100644index 65c58c3..0000000--- a/src/gtk/icons/notifications/tether-notification-instagram.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=Instagram-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-instagram-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-mail.desktop b/src/gtk/icons/notifications/tether-notification-mail.desktopdeleted file mode 100644index 849ee6e..0000000--- a/src/gtk/icons/notifications/tether-notification-mail.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=Mail-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-mail-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-outlook.desktop b/src/gtk/icons/notifications/tether-notification-outlook.desktopdeleted file mode 100644index 424c4ae..0000000--- a/src/gtk/icons/notifications/tether-notification-outlook.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=Outlook-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-outlook-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-reddit.desktop b/src/gtk/icons/notifications/tether-notification-reddit.desktopdeleted file mode 100644index ab553dc..0000000--- a/src/gtk/icons/notifications/tether-notification-reddit.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=Reddit-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-reddit-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-signal.desktop b/src/gtk/icons/notifications/tether-notification-signal.desktopdeleted file mode 100644index ac8272a..0000000--- a/src/gtk/icons/notifications/tether-notification-signal.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=Signal-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-signal-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-snapchat.desktop b/src/gtk/icons/notifications/tether-notification-snapchat.desktopdeleted file mode 100644index d8f6388..0000000--- a/src/gtk/icons/notifications/tether-notification-snapchat.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=Snapchat-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-snapchat-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-spotify.desktop b/src/gtk/icons/notifications/tether-notification-spotify.desktopdeleted file mode 100644index 630a1dd..0000000--- a/src/gtk/icons/notifications/tether-notification-spotify.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=Spotify-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-spotify-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-teams.desktop b/src/gtk/icons/notifications/tether-notification-teams.desktopdeleted file mode 100644index cc93471..0000000--- a/src/gtk/icons/notifications/tether-notification-teams.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=Microsoft Teams-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-teams-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-telegram.desktop b/src/gtk/icons/notifications/tether-notification-telegram.desktopdeleted file mode 100644index 26ea3e0..0000000--- a/src/gtk/icons/notifications/tether-notification-telegram.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=Telegram-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-telegram-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-tiktok.desktop b/src/gtk/icons/notifications/tether-notification-tiktok.desktopdeleted file mode 100644index ce514d2..0000000--- a/src/gtk/icons/notifications/tether-notification-tiktok.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=TikTok-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-tiktok-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-whatsapp.desktop b/src/gtk/icons/notifications/tether-notification-whatsapp.desktopdeleted file mode 100644index 3d7425e..0000000--- a/src/gtk/icons/notifications/tether-notification-whatsapp.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=WhatsApp-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-whatsapp-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-x.desktop b/src/gtk/icons/notifications/tether-notification-x.desktopdeleted file mode 100644index 2baf27d..0000000--- a/src/gtk/icons/notifications/tether-notification-x.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=X-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-x-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-youtube.desktop b/src/gtk/icons/notifications/tether-notification-youtube.desktopdeleted file mode 100644index 6d88388..0000000--- a/src/gtk/icons/notifications/tether-notification-youtube.desktop+++ /dev/null@@ -1,9 +0,0 @@-[Desktop Entry]-Type=Application-Name=YouTube-GenericName=Phone notification-Comment=Notification mirrored from a phone-Icon=tether-notification-youtube-Exec=tether-gtk-Terminal=false-NoDisplay=truediff --git a/src/gtk/icons/notifications/tether-notification-tiktok.svg b/src/gtk/icons/notifications/tiktok.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-tiktok.svgrename to src/gtk/icons/notifications/tiktok.svgdiff --git a/src/gtk/icons/notifications/tether-notification-whatsapp.svg b/src/gtk/icons/notifications/whatsapp.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-whatsapp.svgrename to src/gtk/icons/notifications/whatsapp.svgdiff --git a/src/gtk/icons/notifications/tether-notification-x.svg b/src/gtk/icons/notifications/x.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-x.svgrename to src/gtk/icons/notifications/x.svgdiff --git a/src/gtk/icons/notifications/tether-notification-youtube.svg b/src/gtk/icons/notifications/youtube.svgsimilarity index 100%rename from src/gtk/icons/notifications/tether-notification-youtube.svgrename to src/gtk/icons/notifications/youtube.svgdiff --git a/test/test_ancs_notifications.cpp b/test/test_ancs_notifications.cppindex ffdfe7e..00504d9 100644--- a/test/test_ancs_notifications.cpp+++ b/test/test_ancs_notifications.cpp@@ -31,22 +31,22 @@ TEST(AncsIcons, PrefersTheAppOverItsCategory) {n.category = CategoryId::Social;const auto icons = icon_candidates(n);ASSERT_FALSE(icons.empty());- EXPECT_EQ(icons.front(), "tether-notification-instagram");+ EXPECT_EQ(icons.front(), "instagram");EXPECT_NE(std::find(icons.begin(), icons.end(), "internet-chat"), icons.end())<< "the category icon stands in for themes without brand logos";}TEST(AncsIcons, UsesBundledIconsForCommonNotificationApps) {const std::vector<std::pair<std::string, std::string>> expected{- {"com.apple.MobileSMS", "tether-notification-imessage"},- {"com.apple.mobilemail", "tether-notification-mail"},- {"com.burbn.instagram", "tether-notification-instagram"},- {"com.github.stormbreaker.prod", "tether-notification-github"},- {"com.google.Gmail", "tether-notification-gmail"},- {"com.hammerandchisel.discord", "tether-notification-discord"},- {"com.instructure.ios.CanvasStudent", "tether-notification-canvas"},- {"com.microsoft.Office.Outlook", "tether-notification-outlook"},- {"com.microsoft.teams", "tether-notification-teams"},+ {"com.apple.MobileSMS", "imessage"},+ {"com.apple.mobilemail", "mail"},+ {"com.burbn.instagram", "instagram"},+ {"com.github.stormbreaker.prod", "github"},+ {"com.google.Gmail", "gmail"},+ {"com.hammerandchisel.discord", "discord"},+ {"com.instructure.ios.CanvasStudent", "canvas"},+ {"com.microsoft.Office.Outlook", "outlook"},+ {"com.microsoft.teams", "teams"},};for (const auto& [app_id, icon] : expected) {