From dfa486e19d56aca93c049e9ab1b3395c91b80e62 Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Sun, 11 Sep 2022 05:15:46 +0300 Subject: [PATCH] [Improvement] Show working dir in tray icon description --- Telegram/SourceFiles/platform/linux/tray_linux.cpp | 4 +++- Telegram/SourceFiles/platform/mac/tray_mac.mm | 5 ++++- Telegram/SourceFiles/platform/win/tray_win.cpp | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/platform/linux/tray_linux.cpp b/Telegram/SourceFiles/platform/linux/tray_linux.cpp index 12df8c079..4c6acf90b 100644 --- a/Telegram/SourceFiles/platform/linux/tray_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/tray_linux.cpp @@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "styles/style_window.h" #include +#include #include #include @@ -328,6 +329,7 @@ void Tray::createIcon() { const auto monochrome = Core::App().settings().trayIconMonochrome(); const auto counter = Core::App().unreadBadge(); const auto muted = Core::App().unreadBadgeMuted(); + static const auto workdir = QDir::toNativeSeparators(QDir::cleanPath(cWorkingDir())); _icon = base::make_unique_q(nullptr); _icon->setIcon(_iconGraphic->trayIcon( @@ -340,7 +342,7 @@ void Tray::createIcon() { monochrome, counter, muted)); - _icon->setToolTip(AppName.utf16()); + _icon->setToolTip(AppName.utf16()+"\n"+workdir); using Reason = QSystemTrayIcon::ActivationReason; base::qt_signal_producer( diff --git a/Telegram/SourceFiles/platform/mac/tray_mac.mm b/Telegram/SourceFiles/platform/mac/tray_mac.mm index cb6c4b8e7..c9818ba9e 100644 --- a/Telegram/SourceFiles/platform/mac/tray_mac.mm +++ b/Telegram/SourceFiles/platform/mac/tray_mac.mm @@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/painter.h" #include "styles/style_window.h" +#include #include #import @@ -314,9 +315,11 @@ NativeIcon::NativeIcon() [buttonCallback release]; }); + static const auto workdir = QDir::toNativeSeparators(QDir::cleanPath(cWorkingDir())); + _status.button.target = buttonCallback; _status.button.action = @selector(invoke); - _status.button.toolTip = Q2NSString(AppName.utf16()); + _status.button.toolTip = Q2NSString(AppName.utf16()+"\n"+workdir); } NativeIcon::~NativeIcon() { diff --git a/Telegram/SourceFiles/platform/win/tray_win.cpp b/Telegram/SourceFiles/platform/win/tray_win.cpp index 7e51356cc..5a545e605 100644 --- a/Telegram/SourceFiles/platform/win/tray_win.cpp +++ b/Telegram/SourceFiles/platform/win/tray_win.cpp @@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include #include +#include namespace Platform { @@ -196,7 +197,8 @@ void Tray::createIcon() { } _icon->init(); updateIcon(); - _icon->updateToolTip(AppName.utf16()); + static const auto tooltip = AppName.utf16()+"\n"+QDir::toNativeSeparators(QDir::cleanPath(cWorkingDir())); + _icon->updateToolTip(tooltip); using Reason = QPlatformSystemTrayIcon::ActivationReason; base::qt_signal_producer(