Bug 362657 - Device Notifier stealing keyboard focus when notification is displayed.
Summary: Device Notifier stealing keyboard focus when notification is displayed.
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Disks & Devices (show other bugs)
Version: 5.6.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-04 10:54 UTC by Tim LePés
Modified: 2016-11-04 11:32 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 Tim LePés 2016-05-04 10:54:03 UTC
This is pretty simple to understand; showing the device notification seems to be grabbing keyboard focus from the active application.  Tested this with Konsole and HexChat.  Noticed it becasue my cell pohone's USB connection is wonky and sensitive... kept disconnectiong / reconnecting while I was trying to type into a shell via Konsole or do uber awesome IRC thingys with HexChat. 

Reproducible: Always

Steps to Reproduce:
1. Use program such as konsole; hexchat
2. Attach a USB device such as a cell phone
3. Try to keep typing into application after Device Notifier is triggered

Actual Results:  
You can no longer type into your application as Device Notifier has snuck up and stolen your precious keyboard focus.

Expected Results:  
Handy device notification is shown on screen but does not rudely disrupt your ability to keep typing into your active application.

Tested with Konsole and HexChat; Plasma version 5.6.3
I tried to use the "Focus stealing prevention" feature in the System Settings / Window Management KCM under "Window Behaviour".  It was set to "Low" so I bumped it to "Medium" with no effect.  Setting it to "High" suppressed the notificaitons from opening up on the Device Manager.  Not what I wanted... I do want the Device Notiifier to show me a "notice" but NOT steal my keyboard focus.  The icon briefly changed, though.  I also noticed that with the focus stealing prevention set to "high", the Device Notifier was acting quirky.  If Konsole was active when the phone is attached, the notification is suppressed... and you can't go click on the icon in the system tray to make it show.  First, you have to click on the desktop or panel.  Then you could click on the icon to manually show the Device Notifier  "notice".  Strange and also annoying.   Short story is that the Focus Stealing Prevention settings were no help to me.
Comment 1 Sudhir Khanger 2016-05-12 18:03:22 UTC
I think this might be a design choice. Plasma triggers the device notifier which triggers another design paradigm of keeping widgets open unless they are forcibly closed by the user.

You or system opens a widget and it won't close on its own even if it has fulfilled its purpose. Clipboard manager also suffers from it.

There should be an easier way to close open widgets like hitting Esc should close the widget and bring back focus to the thing a user were already doing.
Comment 2 Tim LePés 2016-06-16 09:46:07 UTC
Although I like your idea of a standard keyboard-centric way to close the dialog (such as ESC), and would be in favor of such an enhancement/feature addition.

Having said that, I am willing to withdraw my bug report.  Seems it is really more of a problem because of my wonky mini-USB connector on the phone than it is a "design problem" with the dialog.  Thinking about it, if it weren't for the connector being dicey I would only see the dialog when I physically connect the phone... which means my hands aren't busy typing in another window.  The sudden loss of focus annoyed me, but the fault is not with KDE's device notifier.
Comment 3 Kai Uwe Broulik 2016-06-16 09:56:21 UTC
In Plasma 5.7 you'll be able to disable automatic popup when a device is plugged in.
Also, does pressing Escape close the dialog and return focus to the previous application at least?
Comment 4 Tim LePés 2016-06-16 10:07:30 UTC
No, the ESC key does not close the device notifier pop-up.  That would be a nice enhancement, and I am in favor of adding the functionality.  But in my last comment I withdraw this as a "bug" proper.  If you want to change it to an enhancement-request for the ESC key functionality, that is fine with me.  Otherwise I have no objection to the report being closed.  Thanks very much for looking at it, in any case.  Cheers!
Comment 5 Sudhir Khanger 2016-06-16 10:58:30 UTC
Tim LePés you are not the only one with a faulty usb device. KDE doesn't have to bombard you with pop-ups because you have faulty usb derive. I regularly connect/disconnect my Android phone several times in a hour for my Android dev work that doesn't mean I want to see usb connected pop-up 10-20 times a day. Maybe a non-persistent notification which goes away in a few seconds would suffice.
Comment 6 David Edmundson 2016-11-04 11:11:59 UTC
Git commit 02674a356340665148f80f5ef972cea6a0314ac5 by David Edmundson.
Committed on 04/11/2016 at 11:11.
Pushed by davidedmundson into branch 'master'.

Close popups on escape

Summary:
A lot of applets have independent handling making escape close the
expanded representation. However not all of them do.

This leads to both duplicated code and inconsistencies, so we should
tackle this at the source.

If an applet was already using escape internally it will be accepting
the event, and so this code will not cause any regressions.

Test Plan: Opened a bunch of popups. Pressed escape

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D3256

M  +7    -1    desktoppackage/contents/applet/CompactApplet.qml

http://commits.kde.org/plasma-desktop/02674a356340665148f80f5ef972cea6a0314ac5
Comment 7 David Edmundson 2016-11-04 11:32:01 UTC
Git commit 926a7f71df80bdcc0f2816a03658342a3f4e8f32 by David Edmundson.
Committed on 04/11/2016 at 11:31.
Pushed by davidedmundson into branch 'master'.

Close the system tray on escape - system tray

Summary:
A lot of applets have independent handling making escape close the
expanded representation. However not all of them do.

This leads to both duplicated code and inconsistencies, so we should
tackle this at the source.

If an applet was already using escape internally it will be accepting
the event, and so this code will not cause any regressions.

This patch also removes the stackview forwarding events to the active
child as this doesn't make sense - the active child will already have
focus and get the key event first, so this just created a recursive
chain (which Qt was thankfully fixing for us). Removing it is needed for
this to work.

Test Plan:
Pressed escape on various applets (e.g plasma-pa)
Pressed escape on the expander applet list view

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D3257

M  +0    -1    applets/systemtray/package/contents/ui/PlasmoidPopupsContainer.qml
M  +6    -0    applets/systemtray/package/contents/ui/main.qml

http://commits.kde.org/plasma-workspace/926a7f71df80bdcc0f2816a03658342a3f4e8f32