Skip to content

Linux + iPhone Continuity / iMessage / SMS

fix: namespace bundled notification icons, drop M$

Zack Barteldd382af6c47f
diff --git a/src/core/src/bluetooth/ancs/notifications.cpp b/src/core/src/bluetooth/ancs/notifications.cpp
index ff040dd..e61c03a 100644
--- a/src/core/src/bluetooth/ancs/notifications.cpp
+++ b/src/core/src/bluetooth/ancs/notifications.cpp
@@ -144,55 +144,63 @@ namespace tether::bluetooth::ancs {
std::vector<std::string> icon_candidates(const Notification& notification) {
std::vector<std::string> out;
- // App-specific icons bundled with Tether come first; theme icons remain
- // as compatibility fallbacks for the rest of the known app list.
- 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", "chat-message-new-symbolic"},
- {"com.apple.Music", "multimedia-player"},
- {"com.apple.facetime", "camera-web"},
- {"com.apple.mobilecal", "office-calendar"},
- {"com.apple.mobilemail", "mail-unread"},
- {"com.apple.mobilenotes", "accessories-text-editor"},
- {"com.apple.mobilephone", "call-start"},
- {"com.apple.mobileslideshow", "multimedia-photo-viewer"},
- {"com.apple.news", "application-rss+xml"},
- {"com.apple.podcasts", "podcasts"},
- {"com.apple.reminders", "view-task"},
- {"com.atebits.Tweetie2", "twitter"},
- {"com.burbn.instagram", "instagram"},
- {"com.facebook.Facebook", "facebook"},
- {"com.facebook.Messenger", "messenger"},
- {"com.github.github", "github"},
- {"com.github.stormbreaker.prod", "github"},
- {"com.google.Gmail", "gmail"},
- {"com.google.Maps", "google-maps"},
- {"com.google.ios.youtube", "youtube"},
- {"com.hammerandchisel.discord", "discord"},
- {"com.linkedin.LinkedIn", "linkedin"},
- {"com.instructure.ios.CanvasParent", "canvas"},
- {"com.instructure.ios.CanvasStudent", "canvas"},
- {"com.instructure.ios.CanvasTeacher", "canvas"},
- {"com.instructure.icanvas", "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", "snapchat"},
- {"com.ubercab.UberClient", "uber"},
- {"com.zhiliaoapp.musically", "tiktok"},
- {"net.whatsapp.WhatsApp", "whatsapp"},
- {"org.telegram.messenger", "telegram"},
- {"org.whispersystems.signal", "signal"},
- {"ph.telegra.Telegraph", "telegram"},
- {"us.zoom.videomeetings", "zoom"},
+ // Theme names come first so a theme that carries brand logos (Papirus is
+ // the common one) restyles them. Tether's bundled art is namespaced
+ // tether-app-* so it never shadows a real app's launcher icon in hicolor.
+ struct AppIcon {
+ const char* theme;
+ const char* bundled = nullptr;
+ };
+ static const std::map<std::string, AppIcon> by_app_id{
+ {"com.amazon.Amazon", {"amazon"}},
+ {"com.apple.MobileAddressBook", {"x-office-address-book"}},
+ {"com.apple.MobileSMS", {"internet-chat"}},
+ {"com.apple.Music", {"multimedia-player"}},
+ {"com.apple.facetime", {"camera-web"}},
+ {"com.apple.mobilecal", {"office-calendar"}},
+ {"com.apple.mobilemail", {"mail-unread"}},
+ {"com.apple.mobilenotes", {"accessories-text-editor"}},
+ {"com.apple.mobilephone", {"call-start"}},
+ {"com.apple.mobileslideshow", {"multimedia-photo-viewer"}},
+ {"com.apple.news", {"application-rss+xml"}},
+ {"com.apple.podcasts", {"podcasts"}},
+ {"com.apple.reminders", {"view-task"}},
+ {"com.atebits.Tweetie2", {"twitter", "tether-app-x"}},
+ {"com.burbn.instagram", {"instagram", "tether-app-instagram"}},
+ {"com.facebook.Facebook", {"facebook", "tether-app-facebook"}},
+ {"com.facebook.Messenger", {"messenger"}},
+ {"com.github.github", {"github", "tether-app-github"}},
+ {"com.github.stormbreaker.prod", {"github", "tether-app-github"}},
+ {"com.google.Gmail", {"gmail", "tether-app-gmail"}},
+ {"com.google.Maps", {"google-maps"}},
+ {"com.google.ios.youtube", {"youtube", "tether-app-youtube"}},
+ {"com.hammerandchisel.discord", {"discord", "tether-app-discord"}},
+ {"com.linkedin.LinkedIn", {"linkedin"}},
+ {"com.instructure.ios.CanvasParent", {nullptr, "tether-app-canvas"}},
+ {"com.instructure.ios.CanvasStudent", {nullptr, "tether-app-canvas"}},
+ {"com.instructure.ios.CanvasTeacher", {nullptr, "tether-app-canvas"}},
+ {"com.instructure.icanvas", {nullptr, "tether-app-canvas"}},
+ {"com.microsoft.Office.Outlook", {"ms-outlook"}},
+ {"com.reddit.Reddit", {"reddit", "tether-app-reddit"}},
+ {"com.spotify.client", {"spotify", "tether-app-spotify"}},
+ {"com.tinyspeck.chatlyio", {"slack"}},
+ {"com.toyopagroup.picaboo", {"snapchat", "tether-app-snapchat"}},
+ {"com.ubercab.UberClient", {"uber"}},
+ {"com.zhiliaoapp.musically", {"tiktok", "tether-app-tiktok"}},
+ {"net.whatsapp.WhatsApp", {"whatsapp", "tether-app-whatsapp"}},
+ {"org.telegram.messenger", {"telegram", "tether-app-telegram"}},
+ {"org.whispersystems.signal", {"signal-desktop", "tether-app-signal"}},
+ {"ph.telegra.Telegraph", {"telegram", "tether-app-telegram"}},
+ {"us.zoom.videomeetings", {"zoom"}},
};
- if (auto found = by_app_id.find(notification.app_id); found != by_app_id.end())
- out.emplace_back(found->second);
+ // "canvas" is too generic a theme name to trust, so Canvas has no theme entry.
+ if (auto found = by_app_id.find(notification.app_id); found != by_app_id.end()) {
+ if (found->second.theme)
+ out.emplace_back(found->second.theme);
+ if (found->second.bundled)
+ out.emplace_back(found->second.bundled);
+ }
for (const char* name : category_icons(notification.category))
out.emplace_back(name);
diff --git a/src/daemon/notification.cpp b/src/daemon/notification.cpp
index aec67c6..0b66c78 100644
--- a/src/daemon/notification.cpp
+++ b/src/daemon/notification.cpp
@@ -86,14 +86,13 @@ namespace tether {
return {};
}
- // 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.
+ // Identifies the sending application to the notification server. Without
+ // this KDE shows the popup and then forgets it.
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));
+ 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.
+ // Keeps history and configuration grouped under Tether while the
+ // header names the iPhone app the notification came from.
notify_notification_set_hint(
notification, "x-kde-display-appname", g_variant_new_string(app_name.c_str()));
}
diff --git a/src/gtk/icons/notifications/NOTICE.md b/src/gtk/icons/notifications/NOTICE.md
index 5dee237..19a704d 100644
--- a/src/gtk/icons/notifications/NOTICE.md
+++ b/src/gtk/icons/notifications/NOTICE.md
@@ -22,9 +22,4 @@ Pinned Simple Icons revision: `dc7b10662a0a2cfdfc9305e2a2b06c023c30724a`.
| X | https://about.x.com/en/who-we-are/brand-toolkit |
| YouTube | https://www.youtube.com/howyoutubeworks/resources/brand-resources/#logos-icons-and-colors |
-Microsoft Teams and Outlook use the unmodified Microsoft Fluent brand SVGs from the official Microsoft 365 CDN (`fabric-cdn-prod_20240411.001`):
-
-- Teams: https://res-2-sdf.cdn.office.net/files/fabric-cdn-prod_20240411.001/assets/brand-icons/product/svg/teams_32x1.svg
-- Outlook: https://res-2-sdf.cdn.office.net/files/fabric-cdn-prod_20240411.001/assets/brand-icons/product/svg/outlook_32x1.svg
-
-The generic Mail and Messages app IDs use standard GTK icon-theme names instead of bundled brand art. Product names and marks remain the property of their respective owners.
+Files are installed as `tether-app-<name>.svg` so they never shadow an installed app's own icon. Product names and marks remain the property of their respective owners.
diff --git a/src/gtk/icons/notifications/outlook.svg b/src/gtk/icons/notifications/outlook.svg
deleted file mode 100644
index 0cc81fc..0000000
--- a/src/gtk/icons/notifications/outlook.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M27.666 4H11.334A1.325 1.325 0 0 0 10 5.316V7l9.206 3.625L29 7V5.316A1.325 1.325 0 0 0 27.666 4z" fill="#0364b8"/><path d="M29.694 17.288a9.984 9.984 0 0 0 .306-1.23.581.581 0 0 0-.292-.5l-.011-.006-9.486-6.343a1.451 1.451 0 0 0-.128-.072 1.309 1.309 0 0 0-1.166 0 1.433 1.433 0 0 0-.127.072l-9.483 6.336-.011.006a.583.583 0 0 0-.292.5 9.78 9.78 0 0 0 .307 1.23l10.055 7.354z" fill="#0a2767"/><path fill="#28a8ea" d="M19 7h-9v9l9 9h10v-9L19 7z"/><path fill="#50d9ff" d="M19 7h10v9H19z"/><path fill="#0078d4" d="M10 16h9v9h-9z"/><path d="M19.861 23.833L9.542 16.591l.432-.732s9.4 5.154 9.545 5.231a.484.484 0 0 0 .369-.01c.134-.073 9.362-5.372 9.362-5.372l.638.857z" fill="#0a2767" opacity=".5"/><path d="M21.6 26.352l7.893 1.4a1.29 1.29 0 0 0 .479-.787c.006-.012.024-.01.024-.031V16a.581.581 0 0 1-.077.288.607.607 0 0 1-.059.065.559.559 0 0 1-.143.144v.003l-.011.007-9.3 5.4a1.267 1.267 0 0 1-1.254.08z" fill="#1490df"/><path d="M20.551 21.818l-.171.1-.012.006-.1.059a1.676 1.676 0 0 1-1.2.054l3.193 4.282 7.088 1.543a1.264 1.264 0 0 0 .592-.717z" opacity=".1"/><path d="M9.29 16.506V16.5h-.008l-.025-.017A.563.563 0 0 1 9 16v10.714A1.264 1.264 0 0 0 10.244 28h18.521a1.2 1.2 0 0 0 .307-.043.527.527 0 0 0 .149-.051.12.12 0 0 0 .049-.017.854.854 0 0 0 .191-.112c.017-.008.025-.008.033-.026z" fill="#28a8ea"/><path d="M15.951 10H9v14h6.745A1.32 1.32 0 0 0 17 22.839V11a1.028 1.028 0 0 0-1.049-1z" opacity=".5"/><rect x="2" y="9" width="14" height="14" rx="1.167" fill="#0078d4"/><path d="M4.824 13.471a4.176 4.176 0 0 1 1.64-1.811 4.955 4.955 0 0 1 2.606-.653 4.61 4.61 0 0 1 2.411.619 4.136 4.136 0 0 1 1.6 1.731 5.583 5.583 0 0 1 .559 2.545 5.894 5.894 0 0 1-.576 2.664 4.229 4.229 0 0 1-1.643 1.791 4.8 4.8 0 0 1-2.5.636 4.716 4.716 0 0 1-2.464-.626 4.187 4.187 0 0 1-1.616-1.734 5.44 5.44 0 0 1-.566-2.515 6.057 6.057 0 0 1 .549-2.647zm1.748 4.253a2.715 2.715 0 0 0 .922 1.192 2.416 2.416 0 0 0 1.442.434 2.525 2.525 0 0 0 1.538-.448 2.594 2.594 0 0 0 .9-1.2 4.614 4.614 0 0 0 .286-1.663 5.071 5.071 0 0 0-.269-1.684 2.661 2.661 0 0 0-.866-1.239A2.383 2.383 0 0 0 9 12.65a2.489 2.489 0 0 0-1.475.438 2.725 2.725 0 0 0-.942 1.2 4.76 4.76 0 0 0-.007 3.434z" fill="#fff"/></svg>
\ No newline at end of file
diff --git a/src/gtk/icons/notifications/teams.svg b/src/gtk/icons/notifications/teams.svg
deleted file mode 100644
index 1231134..0000000
--- a/src/gtk/icons/notifications/teams.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M28.65 12h-6.788L21 13.1v7.263C21 22.37 23.015 24 25.5 24s4.5-1.63 4.5-3.641V13.1a1.242 1.242 0 0 0-1.35-1.1z" fill="#5059c9"/><circle cx="26" cy="8" r="3" fill="#5059c9"/><path d="M10 22.755v-9.617A1.138 1.138 0 0 1 11.138 12h10.724A1.138 1.138 0 0 1 23 13.138v9.617A6.245 6.245 0 0 1 16.755 29h-.51A6.245 6.245 0 0 1 10 22.755z" fill="#7b83eb"/><circle cx="17" cy="7" r="4" fill="#7b83eb"/><path d="M10.125 24h4.1C15.756 24 17 23.394 17 21.846V12h-5.846C10.517 12 10 14.517 10 15.154v7.6A6.222 6.222 0 0 0 10.125 24zm6.807-13.007A1.4 1.4 0 0 0 15.6 10h-1.22a3.958 3.958 0 0 0 2.552.993z" opacity=".5"/><rect x="2" y="9" width="14" height="14" rx="1.4" fill="#4b53bc"/><path d="M13.49 13.154h-3.111v7.778H8.823v-7.778H5.712V11.6h7.778z" fill="#fff"/></svg>
\ No newline at end of file
diff --git a/src/gtk/icons/notifications/canvas.svg b/src/gtk/icons/notifications/tether-app-canvas.svg
similarity index 100%
rename from src/gtk/icons/notifications/canvas.svg
rename to src/gtk/icons/notifications/tether-app-canvas.svg
diff --git a/src/gtk/icons/notifications/discord.svg b/src/gtk/icons/notifications/tether-app-discord.svg
similarity index 100%
rename from src/gtk/icons/notifications/discord.svg
rename to src/gtk/icons/notifications/tether-app-discord.svg
diff --git a/src/gtk/icons/notifications/facebook.svg b/src/gtk/icons/notifications/tether-app-facebook.svg
similarity index 100%
rename from src/gtk/icons/notifications/facebook.svg
rename to src/gtk/icons/notifications/tether-app-facebook.svg
diff --git a/src/gtk/icons/notifications/github.svg b/src/gtk/icons/notifications/tether-app-github.svg
similarity index 100%
rename from src/gtk/icons/notifications/github.svg
rename to src/gtk/icons/notifications/tether-app-github.svg
diff --git a/src/gtk/icons/notifications/gmail.svg b/src/gtk/icons/notifications/tether-app-gmail.svg
similarity index 100%
rename from src/gtk/icons/notifications/gmail.svg
rename to src/gtk/icons/notifications/tether-app-gmail.svg
diff --git a/src/gtk/icons/notifications/instagram.svg b/src/gtk/icons/notifications/tether-app-instagram.svg
similarity index 100%
rename from src/gtk/icons/notifications/instagram.svg
rename to src/gtk/icons/notifications/tether-app-instagram.svg
diff --git a/src/gtk/icons/notifications/reddit.svg b/src/gtk/icons/notifications/tether-app-reddit.svg
similarity index 100%
rename from src/gtk/icons/notifications/reddit.svg
rename to src/gtk/icons/notifications/tether-app-reddit.svg
diff --git a/src/gtk/icons/notifications/signal.svg b/src/gtk/icons/notifications/tether-app-signal.svg
similarity index 100%
rename from src/gtk/icons/notifications/signal.svg
rename to src/gtk/icons/notifications/tether-app-signal.svg
diff --git a/src/gtk/icons/notifications/snapchat.svg b/src/gtk/icons/notifications/tether-app-snapchat.svg
similarity index 100%
rename from src/gtk/icons/notifications/snapchat.svg
rename to src/gtk/icons/notifications/tether-app-snapchat.svg
diff --git a/src/gtk/icons/notifications/spotify.svg b/src/gtk/icons/notifications/tether-app-spotify.svg
similarity index 100%
rename from src/gtk/icons/notifications/spotify.svg
rename to src/gtk/icons/notifications/tether-app-spotify.svg
diff --git a/src/gtk/icons/notifications/telegram.svg b/src/gtk/icons/notifications/tether-app-telegram.svg
similarity index 100%
rename from src/gtk/icons/notifications/telegram.svg
rename to src/gtk/icons/notifications/tether-app-telegram.svg
diff --git a/src/gtk/icons/notifications/tiktok.svg b/src/gtk/icons/notifications/tether-app-tiktok.svg
similarity index 100%
rename from src/gtk/icons/notifications/tiktok.svg
rename to src/gtk/icons/notifications/tether-app-tiktok.svg
diff --git a/src/gtk/icons/notifications/whatsapp.svg b/src/gtk/icons/notifications/tether-app-whatsapp.svg
similarity index 100%
rename from src/gtk/icons/notifications/whatsapp.svg
rename to src/gtk/icons/notifications/tether-app-whatsapp.svg
diff --git a/src/gtk/icons/notifications/x.svg b/src/gtk/icons/notifications/tether-app-x.svg
similarity index 100%
rename from src/gtk/icons/notifications/x.svg
rename to src/gtk/icons/notifications/tether-app-x.svg
diff --git a/src/gtk/icons/notifications/youtube.svg b/src/gtk/icons/notifications/tether-app-youtube.svg
similarity index 100%
rename from src/gtk/icons/notifications/youtube.svg
rename to src/gtk/icons/notifications/tether-app-youtube.svg
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index d021832..416a76a 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -46,6 +46,9 @@ target_link_libraries(tether_test PRIVATE
tether
GTest::gtest_main
)
+target_compile_definitions(tether_test PRIVATE
+ TETHER_NOTIFICATION_ICONS_DIR="${CMAKE_SOURCE_DIR}/src/gtk/icons/notifications"
+)
include(GoogleTest)
gtest_discover_tests(tether_test)
diff --git a/test/test_ancs_notifications.cpp b/test/test_ancs_notifications.cpp
index 257be2d..4e2c836 100644
--- a/test/test_ancs_notifications.cpp
+++ b/test/test_ancs_notifications.cpp
@@ -1,4 +1,5 @@
#include <algorithm>
+#include <filesystem>
#include <gtest/gtest.h>
#include <tether/bluetooth/ancs/notifications.hpp>
#include <tether/bluetooth/config.hpp>
@@ -36,22 +37,50 @@ TEST(AncsIcons, PrefersTheAppOverItsCategory) {
<< "the category icon stands in for themes without brand logos";
}
-TEST(AncsIcons, UsesBrandAndThemeIconsForCommonNotificationApps) {
- const std::vector<std::pair<std::string, std::string>> expected{
- {"com.apple.MobileSMS", "chat-message-new-symbolic"},
- {"com.apple.mobilemail", "mail-unread"},
- {"com.burbn.instagram", "instagram"},
- {"com.github.stormbreaker.prod", "github"},
- {"com.google.Gmail", "gmail"},
- {"com.hammerandchisel.discord", "discord"},
- {"com.instructure.icanvas", "canvas"},
- {"com.instructure.ios.CanvasStudent", "canvas"},
- {"com.microsoft.Office.Outlook", "outlook"},
- {"com.microsoft.teams", "teams"},
+TEST(AncsIcons, PrefersTheThemeOverBundledArt) {
+ const std::vector<std::pair<std::string, std::vector<std::string>>> expected{
+ {"com.apple.MobileSMS", {"internet-chat"}},
+ {"com.microsoft.Office.Outlook", {"ms-outlook"}},
+ {"com.hammerandchisel.discord", {"discord", "tether-app-discord"}},
+ {"com.atebits.Tweetie2", {"twitter", "tether-app-x"}},
+ {"org.whispersystems.signal", {"signal-desktop", "tether-app-signal"}},
+ {"com.instructure.icanvas", {"tether-app-canvas"}},
};
- for (const auto& [app_id, icon] : expected) {
- EXPECT_EQ(icon_candidates(make(1, app_id)).front(), icon) << app_id;
+ for (const auto& [app_id, icons] : expected) {
+ const auto candidates = icon_candidates(make(1, app_id));
+ ASSERT_GE(candidates.size(), icons.size()) << app_id;
+ EXPECT_TRUE(std::equal(icons.begin(), icons.end(), candidates.begin())) << app_id;
+ }
+}
+
+TEST(AncsIcons, EveryBundledNameHasAnIconFile) {
+ const char* app_ids[] = {
+ "com.atebits.Tweetie2",
+ "com.burbn.instagram",
+ "com.facebook.Facebook",
+ "com.github.github",
+ "com.github.stormbreaker.prod",
+ "com.google.Gmail",
+ "com.google.ios.youtube",
+ "com.hammerandchisel.discord",
+ "com.instructure.icanvas",
+ "com.reddit.Reddit",
+ "com.spotify.client",
+ "com.toyopagroup.picaboo",
+ "com.zhiliaoapp.musically",
+ "net.whatsapp.WhatsApp",
+ "org.telegram.messenger",
+ "org.whispersystems.signal",
+ };
+ const std::filesystem::path dir = TETHER_NOTIFICATION_ICONS_DIR;
+
+ for (const char* app_id : app_ids) {
+ const auto candidates = icon_candidates(make(1, app_id));
+ const auto bundled = std::find_if(
+ candidates.begin(), candidates.end(), [](const std::string& n) { return n.rfind("tether-app-", 0) == 0; });
+ ASSERT_NE(bundled, candidates.end()) << app_id;
+ EXPECT_TRUE(std::filesystem::exists(dir / (*bundled + ".svg"))) << *bundled;
}
}