Show Desktop state does not toggle when there are no windows

Bug #1079460 reported by Francis Ginther on 2012-11-15
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ayatana Design
John Lea
Fix Released
Brandon Schaefer
unity (Ubuntu)
Brandon Schaefer

Bug Description

Super+Ctrl+d (or whatever show desktop is bound to) does not toggle the state of PluginAdapter._in_show_desktop when there are no windows open. This can be observed with the attached autopilot test,

[Test Case]
0. Copy to $unity_source/tests/autopilot/unity/tests/
1. Open some windows.
2. from a ssh or other remote login:
2.a. export DISPLAY=:0.0
2.b. cd $unity_source/tests/autopilot
2.c. autopilot run -v unity.tests.test_queryshowdesktop

Observe - "showdesktop state" should follow with what is stated in the test log output.

3. Close all windows on the unity display.
4. repeat 2.c.

Observe - the test will fail because it cannot leave showdesktop mode once it's entered. Note, the showdesktop state is initially 0 meaning disabled, meaning that closing all the windows does not enable showdesktop mode.
Expected - showdesktop state should continue to toggle with the show desktop key.

If this is expected behavior, some autopilot tests need some work.

Related branches

Francis Ginther (fginther) wrote :
description: updated
Omer Akram (om26er) on 2012-11-16
Changed in unity:
importance: Undecided → Low
Francis Ginther (fginther) wrote :

I believe this is the root cause of a large number of autopilot failures when run via the ssh method (when there are no windows open on the unity desktop). The failures have stack traces similar to this:
Traceback (most recent call last):
  File "/home/fginther/work/unity/unity/tests/autopilot/unity/tests/", line 109, in check_test_behavior
  File "/home/fginther/work/unity/unity/tests/autopilot/unity/emulators/", line 46, in leave_show_desktop
  File "/usr/lib/python2.7/dist-packages/autopilot/introspection/", line 172, in wait_for
    % (self.parent.__class__.__name__,, failure_msg))
AssertionError: After 10 seconds test on WindowManager.showdesktop_active failed: False != dbus.Boolean(True, variant_level=1)

The log will also show:
13:07:42.891 INFO __init__:83 - Checking system state for badly behaving test...
13:07:53.501 WARNING __init__:108 - Test left the system in show desktop mode, e
xiting it...
13:07:53.580 INFO window_manager:41 - Leaving show desktop mode.
13:07:53.581 DEBUG X11:125 - Pressing keys 'Ctrl+Super+d' with delay 0.200000
13:07:53.581 DEBUG X11:212 - Sending press event for key: Control_L
13:07:53.783 DEBUG X11:212 - Sending press event for key: Super_L
13:07:53.985 DEBUG X11:212 - Sending press event for key: d
13:07:54.187 DEBUG X11:144 - Releasing keys 'Ctrl+Super+d' with delay 0.200000
13:07:54.188 DEBUG X11:215 - Sending release event for key: d
13:07:54.390 DEBUG X11:215 - Sending release event for key: Super_L
13:07:54.593 DEBUG X11:215 - Sending release event for key: Control_L

The general problem is that autopilot checks the state of showdesktop at the end of each test and attempts to leave it if it is set. As this can't be done when there are no windows open, there is a chance of this failure at the end of each test.

Martin Mrazik (mrazik) wrote :

I'm changing the importance of this to High (but I'm even tempted to change it to Critical).

This might not have a huge impact to ordinary users but it has a big impact on the testability of unity. Given that we want to have continuous deployment of unity releases with fully automated testing then testability support is critical. Please talk to me in case you disagree with the importance.

Changed in unity:
importance: Low → High
Francis Ginther (fginther) wrote :

This may not be something that can be easily 'fixed', it may just be the way it is. So, a change to the unity autopilot tests to get back into the desired showdesktop state after running a test is here:

This isn't a 100% solution as a test can still get into a state where it cannot leave showdesktop active mode.

Francis Ginther (fginther) wrote :

We really Ayatana design to provide input on the proper behavior of show desktop mode. Some scenarios and questions to consider:
 - changing showdesktop mode while no windows are open
 - opening the first window
 - closing the last window
 - opening a new window when existing windows are minimized due to show desktop mode being active
 - initial mode after login
 - What actions can alter the state of showdesktop mode?

Changed in unity:
milestone: none → 7.0.0
John Lea (johnlea) on 2012-11-20
Changed in ayatana-design:
status: New → Fix Committed
Changed in unity:
status: New → Triaged
Changed in ayatana-design:
importance: Undecided → High
assignee: nobody → John Lea (johnlea)
John Lea (johnlea) on 2012-11-21
Changed in unity (Ubuntu):
status: New → Triaged
importance: Undecided → High
Łukasz Zemczak (sil2100) wrote :

One of the failing tests because of this problem has the following bug assigned: #1082444 .

Stephen M. Webb (bregma) on 2013-04-04
Changed in unity:
milestone: 7.0.0 → 7.0.1

Manually testing this now, and show desktop toggles fine for me. Must have been fixed with the new changes that went into showdesktop. So ill link that branch as a fix for this.

Im not able to run, but I've a print statement in ::ShowDesktop(), and it is toggling just fine on an empty desktop.

If you have a list of any failing tests that you still see attributed to this, let me know!

The branch where the new show desktop stuff landed:

Related bug:
Bug 966030

Changed in unity (Ubuntu):
assignee: nobody → Brandon Schaefer (brandontschaefer)
Changed in unity:
assignee: nobody → Brandon Schaefer (brandontschaefer)
status: Triaged → Fix Committed
Changed in unity (Ubuntu):
status: Triaged → Fix Committed
Changed in unity:
status: Fix Committed → Fix Released
Changed in unity (Ubuntu):
status: Fix Committed → Fix Released

Also to note, there is new behavior for show desktop. As soon as a new window is mapped, show desktop toggles off. So this can no longer be a problem, unless the tests are waiting for it to be off when no windows are mapped (but that wont be an issue it toggles fine). As when ever a new window is mapped, show desktop is false.

If this is proved to still be a problem, we will need to decide what should happen as there is new behavior now for show desktop.

I also have all the show desktop tests passing locally here.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers