-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a 'auto-hide' notifications setting #10043
base: dev
Are you sure you want to change the base?
Conversation
Please, use tabs for indentations. |
Thank you, I added and committed the suggested changes |
I always thought that this is a bug with between player's layer and window manager interaction 😮 |
@@ -662,6 +662,14 @@ void Notification::prepareActionsCache() { | |||
|
|||
bool Notification::checkLastInput(bool hasReplyingNotifications) { | |||
if (!_waitingForInput) return true; | |||
if (Core::App().settings().autoHideNotifications()) { | |||
auto now = crl::now(); | |||
if ((now - _started > 2000) && !hasReplyingNotifications) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2000 ms should at least be moved to a separate constexpr auto
constant in the anonymous namespace at the file beginning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I thought about doing that, I was just waiting to see if anyone of you guys thought this should be moved to a user-defined settings. For the moment I moved it to a constexpr auto
constant
c8ccc18
to
1a76cd3
Compare
1772f79
to
ff7104a
Compare
Integrated 23rd suggestions and merged new commits from upstream |
This PR could fix the issue when notification don't disappear when watching a movie or something else in full screen (even outside from TDesktop). |
From what I gathered, this has never been an "issue" (or a bug), but a dev choice. I think it'd be nice to have this setting so the "choice" is moved to the user. |
I propose this: diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp
index cf5a07099..11c859d6c 100644
--- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp
+++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp
@@ -727,6 +727,10 @@ bool SkipFlashBounce() {
return Inhibited();
}
+bool WaitForInput() {
+ return true;
+}
+
bool Supported() {
return ServiceRegistered;
}
diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux_dummy.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux_dummy.cpp
index c51b92fed..cec5fa737 100644
--- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux_dummy.cpp
+++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux_dummy.cpp
@@ -25,6 +25,10 @@ bool SkipFlashBounce() {
return false;
}
+bool WaitForInput() {
+ return true;
+}
+
bool Supported() {
return false;
}
diff --git a/Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm b/Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm
index 310b2829b..1993872a3 100644
--- a/Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm
+++ b/Telegram/SourceFiles/platform/mac/notifications_manager_mac.mm
@@ -159,6 +159,10 @@ bool SkipFlashBounce() {
return SkipAudio();
}
+bool WaitForInput() {
+ return true;
+}
+
bool Supported() {
return Platform::IsMac10_8OrGreater();
}
diff --git a/Telegram/SourceFiles/platform/platform_notifications_manager.h b/Telegram/SourceFiles/platform/platform_notifications_manager.h
index eb3efbddb..4731a97bb 100644
--- a/Telegram/SourceFiles/platform/platform_notifications_manager.h
+++ b/Telegram/SourceFiles/platform/platform_notifications_manager.h
@@ -15,6 +15,7 @@ namespace Notifications {
[[nodiscard]] bool SkipAudio();
[[nodiscard]] bool SkipToast();
[[nodiscard]] bool SkipFlashBounce();
+[[nodiscard]] bool WaitForInput();
[[nodiscard]] bool Supported();
[[nodiscard]] bool Enforced();
diff --git a/Telegram/SourceFiles/platform/win/notifications_manager_win.cpp b/Telegram/SourceFiles/platform/win/notifications_manager_win.cpp
index 9ea6c222b..59b92667b 100644
--- a/Telegram/SourceFiles/platform/win/notifications_manager_win.cpp
+++ b/Telegram/SourceFiles/platform/win/notifications_manager_win.cpp
@@ -730,7 +730,6 @@ bool SkipToast() {
if (UserNotificationState == QUNS_PRESENTATION_MODE
|| UserNotificationState == QUNS_RUNNING_D3D_FULL_SCREEN
- //|| UserNotificationState == QUNS_BUSY
|| QuietHoursEnabled) {
return true;
}
@@ -741,5 +740,14 @@ bool SkipFlashBounce() {
return SkipToast();
}
+bool WaitForInput() {
+ querySystemNotificationSettings();
+
+ if (UserNotificationState == QUNS_BUSY) {
+ return false;
+ }
+ return true;
+}
+
} // namespace Notifications
} // namespace Platform
diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp
index a5ea81f96..d6e216f18 100644
--- a/Telegram/SourceFiles/window/notifications_manager_default.cpp
+++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp
@@ -667,7 +667,9 @@ void Notification::prepareActionsCache() {
bool Notification::checkLastInput(bool hasReplyingNotifications) {
if (!_waitingForInput) return true;
- const auto waitForUserInput = base::Platform::LastUserInputTimeSupported()
+ const auto shouldWaitForUserInput = Platform::Notifications::WaitForInput()
+ && base::Platform::LastUserInputTimeSupported();
+ const auto waitForUserInput = shouldWaitForUserInput
? (Core::App().lastNonIdleTime() <= _started)
: false;
if (!waitForUserInput) { This should hide notifications automatically if something is running fullscreen (like video player). Implemented only for Windows, other platforms need implementations. |
On |
QUNS_BUSY. QUNS_RUNNING_D3D_FULL_SCREEN is checked in SkipToast, so it shouldn't show the toast at all. QUNS_RUNNING_D3D_FULL_SCREEN should prevent showing notifications when some game is running, but it doesn't work with all games for some reason (#2290) |
Yeah, I see. But the function will be more reasonable with the name "SkipNotification()" or something to help debug the codes later. |
|
The idea of current beahaviour is to keep notifications on screen while the user is away from his computer. When he returns he sees the notifications. I'm not against removing notifications completely if the user is busy at the computer without input events. I think if user watches a movie the notifications should not appear, maybe only sound can be played. |
@john-preston won't people from #473 complain again? |
ilya-fedin's code is to solve the issue to detect if users are playing any video in fullscreen. |
Looks like there're still some folks who want notification during watching a movie or something? |
Probably |
Let that be an option though, some of us do want that notification to go away, think the notification count number should be enough for when "the user comes back and realizes he has new messages". Personally I quit the app when it happens to me because it's really annoying. The option to control that behavior should be enough, with a secondary option to execute that method only when there's a video playing in full screen or something would be ideal |
Any update on this? |
It seems @john-preston doesn't want this |
Exactly as @fguille94 said. I really need this feature. It's so annoying to use the app without it |
to this day I still rather close the whole application just to not have the permanent-when-idle notification staring at my AFK face. we seriously need this feature implemented ASAP |
I finally submitted the code from #10043 (comment) as #25570 (I would do that earlier, but no one here expressed the interest, now someone from another place expressed the interest). |
@levnikmyskin do you still need this setting in v4.5? |
honestly yes. To me, permanent notifications are annoying in many more cases, such as watching a youtube video (not in fullscreen) or reading stuff. |
Apparently to avoid feature creep. And the current layout of the notification settings is received from designer's mockups, so it may be that the set of the settings is carved in stone and no community-asked settings could be added there. The only place having less restrictions is the Experimental settings page. |
2 years for so simple and useful feature?? Really? |
@sstyle read the discussion |
would adding the setting to |
Well, this PR seem to mix spaces with tabs and adds new logic for hiding instead of using the pre-existing one, so I guess the answer is no. It also conflicts with the current dev branch. |
Seems like on windows 10 works fine now. Notification disappears after short time while playing something in fullscreen |
@levnikmyskin you may want to join https://t.me/tdesktop_contributions |
Thanks for the invitation @ilya-fedin. It seems to be a mostly russian-speaking telegram group. Despite my nickname, I don't speak any russian though :D |
It's ok to speak English there. Most members understand English just fine and @john-preston is generally more active in Telegram than GitHub. |
Still waiting for this.. |
same |
Hi!
I added an "auto-hide"notification setting (it was requested in a now closed issue #4850).
Motivation
On Telegram Desktop, notification will not hide themselves unless the app detects any user input. This can be annoying when e.g. the user is watching a video/movie and has to move the mouse to make the notification disappear.
What I did
Simply added a "auto-hide" notifications setting, which, when enabled, will make the notifications hide themselves after a few seconds (2 at the moment). I'm attaching a screenshot below of the new setting.
Possible improvements
Greetings,
levnikmyskin