Bug 257752 - Monitor for Activity option triggers notification regardless of window focus
Summary: Monitor for Activity option triggers notification regardless of window focus
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: monitoring (show other bugs)
Version: 2.8
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-24 03:51 UTC by ietc
Modified: 2016-07-10 16:20 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ietc 2010-11-24 03:51:47 UTC
Version:           2.4.3 (using KDE 4.4.4) 
OS:                Linux

Konsole has an option located at '[Menu Bar] => View => [ ] Monitor for Activity' that is supposed to trigger a notification (as configured under 'Settings => Configure Notifications') when activity happens in that window.  There are two issues with this function.

1: The notification is triggered whether the Konsole window has focus or not, so it will trigger when the user himself types in that window.

2: The notification is triggered ONLY ONCE each time the option is set.  After it has been triggered, the user must deselect the option and reselect it to be alerted to activity one time more, ad nauseum.

Reproducible: Always

Steps to Reproduce:
(For point 1: notification triggered regardless of window focus.)

1. Activate Monitor for Activity by selecting '[Menu Bar] => View => [x] Monitor for Activity'.

2. With the Konsole window on top and given focus, type something at the Bash prompt.

(For point 2: notification is triggered only once.)

3. Deactivate Monitor for Activity to reset its state.

4. Create a GNU Screen session: e.g., $ screen -S test

5. Activate Monitor for Activity.

6. Open another Konsole window so that it has focus and the original loses it; concurrently attach to the created Screen session: $ screen -x test

7. Type something and see the activity notification be triggered.

8. Return focus to the original Konsole window, then back to the new Konsole window.

9. Type something more.

Actual Results:  
At Step 2, the the activity notification is triggered even though the Konsole window has focus and the user, himself, is the source of the activity.

At Step 9, there is no activity notification even though the Monitor for Activity option is set.  You can see that the option is still set by viewing its entry in '[Menu Bar] => View'.

Expected Results:  
At Step 2, there should be no activity notification.

At Step 9, there should be activity notification, and it should trigger activity notification again each time there is activity after the Konsole window gains focus (User: "I have seen the activity that you alerted me to") and then loses focus (User: "I am now paying attention to something else, alert me when there is activity").

In other words, this is how I expected Monitor for Activity to act when set:

Start.

If monitored window has focus: sleep.

If monitored window does not have focus: on activity, trigger notification; then sleep until window has focus again.  Return to start.
Comment 1 Jekyll Wu 2011-10-20 21:53:50 UTC
I think issue #2 is really a bug, or at least a regression compared with KDE3 konsole. The KDE3 konsole does trigger notification for activity more than once, but limits the rate of such notifications. I guess that is to avoid the flooding of such notifications in a short time. 15s seems the minimum interval between two activity notifications. This issue is not hard to fix.

Issue #1 also sounds sensible. However, I think it looks more like improvement than bug and is harder to implement correctly.
Comment 2 Jekyll Wu 2011-10-21 04:42:38 UTC
Git commit 277038478be8d35b82450e9ba5ce584079a0282a by Jekyll Wu.
Committed on 21/10/2011 at 06:36.
Pushed by jekyllwu into branch 'master'.

Allow activity notification to be triggered more than once.

The activity notification is now masked for a while after it is triggered.
That is basically what KDE3 konsole does. The mask interval is intended
to avoid the flooding of notification and is hardcoded as 15 seconds
at the moment. Maybe that interval should be user configurable.

FIXED-IN:4.8
CCBUG: 257752

M  +15   -0    src/Session.cpp
M  +2    -0    src/Session.h

http://commits.kde.org/konsole/277038478be8d35b82450e9ba5ce584079a0282a
Comment 3 ietc 2011-10-22 03:14:39 UTC
Thanks for looking into this.  I look forward to using your fix.

As for issue-1, is it troublesome to check whether the window has focus before triggering; or would doing so break the notification model?
Comment 4 Jekyll Wu 2012-02-25 18:49:12 UTC
changing title, version and severity to reflect the fact that issue #2 has been fixed since KDE SC 4.8
Comment 5 Piotr Dobrogost 2016-01-14 10:46:53 UTC
From comment 2:
"Maybe that interval should be user configurable."
I agree and I raised this in bug 357974.
Comment 6 Martin Sandsmark 2016-07-02 21:10:31 UTC
https://git.reviewboard.kde.org/r/128239/
Comment 7 Martin Sandsmark 2016-07-06 22:12:34 UTC
Git commit 7592e8947fde4842a8fe966ec6b9e3fb2c8ccd3b by Martin T. H. Sandsmark.
Committed on 06/07/2016 at 22:12.
Pushed by sandsmark into branch 'master'.

Don't show activity/silence notifications when the terminal is active

REVIEW: 128239

M  +9    -0    desktop/konsole.notifyrc
M  +27   -7    src/Session.cpp

http://commits.kde.org/konsole/7592e8947fde4842a8fe966ec6b9e3fb2c8ccd3b