2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 14:17:45 +00:00

[Improvement] Show working dir in tray icon description

This commit is contained in:
RadRussianRus 2022-09-11 05:15:46 +03:00 committed by Eric Kotato
parent eec6f0dd11
commit dfa486e19d
3 changed files with 10 additions and 3 deletions

View File

@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_window.h" #include "styles/style_window.h"
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
#include <QtCore/QDir>
#include <QtWidgets/QMenu> #include <QtWidgets/QMenu>
#include <QtWidgets/QSystemTrayIcon> #include <QtWidgets/QSystemTrayIcon>
@ -328,6 +329,7 @@ void Tray::createIcon() {
const auto monochrome = Core::App().settings().trayIconMonochrome(); const auto monochrome = Core::App().settings().trayIconMonochrome();
const auto counter = Core::App().unreadBadge(); const auto counter = Core::App().unreadBadge();
const auto muted = Core::App().unreadBadgeMuted(); const auto muted = Core::App().unreadBadgeMuted();
static const auto workdir = QDir::toNativeSeparators(QDir::cleanPath(cWorkingDir()));
_icon = base::make_unique_q<QSystemTrayIcon>(nullptr); _icon = base::make_unique_q<QSystemTrayIcon>(nullptr);
_icon->setIcon(_iconGraphic->trayIcon( _icon->setIcon(_iconGraphic->trayIcon(
@ -340,7 +342,7 @@ void Tray::createIcon() {
monochrome, monochrome,
counter, counter,
muted)); muted));
_icon->setToolTip(AppName.utf16()); _icon->setToolTip(AppName.utf16()+"\n"+workdir);
using Reason = QSystemTrayIcon::ActivationReason; using Reason = QSystemTrayIcon::ActivationReason;
base::qt_signal_producer( base::qt_signal_producer(

View File

@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/painter.h" #include "ui/painter.h"
#include "styles/style_window.h" #include "styles/style_window.h"
#include <QtCore/QDir>
#include <QtWidgets/QMenu> #include <QtWidgets/QMenu>
#import <AppKit/NSMenu.h> #import <AppKit/NSMenu.h>
@ -314,9 +315,11 @@ NativeIcon::NativeIcon()
[buttonCallback release]; [buttonCallback release];
}); });
static const auto workdir = QDir::toNativeSeparators(QDir::cleanPath(cWorkingDir()));
_status.button.target = buttonCallback; _status.button.target = buttonCallback;
_status.button.action = @selector(invoke); _status.button.action = @selector(invoke);
_status.button.toolTip = Q2NSString(AppName.utf16()); _status.button.toolTip = Q2NSString(AppName.utf16()+"\n"+workdir);
} }
NativeIcon::~NativeIcon() { NativeIcon::~NativeIcon() {

View File

@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <private/qhighdpiscaling_p.h> #include <private/qhighdpiscaling_p.h>
#include <QSvgRenderer> #include <QSvgRenderer>
#include <QBuffer> #include <QBuffer>
#include <QtCore/QDir>
namespace Platform { namespace Platform {
@ -196,7 +197,8 @@ void Tray::createIcon() {
} }
_icon->init(); _icon->init();
updateIcon(); updateIcon();
_icon->updateToolTip(AppName.utf16()); static const auto tooltip = AppName.utf16()+"\n"+QDir::toNativeSeparators(QDir::cleanPath(cWorkingDir()));
_icon->updateToolTip(tooltip);
using Reason = QPlatformSystemTrayIcon::ActivationReason; using Reason = QPlatformSystemTrayIcon::ActivationReason;
base::qt_signal_producer( base::qt_signal_producer(