Skip to content

screenmapper: Remember activity ID in screen mapping

This commit adds an extra string to screenmapper to remember the activity ID corresponding to the screen ID. Now screenmapper can correctly handle different activites, and desktops of different activities can correctly show their items.

The problem

When the user sets "Files linked to the current activity" on one activity (A) and switches to any other activity (B), though the desktop on activity B is set to "Show Desktop folder", there is nothing on the desktop until the user restarts plasmashell.

The cause

In screenmapper.cpp, removeScreen() only checkes for the screen ID, but two activities can share the same screen ID. Then if both the two activities are set to "Show desktop folder", then in setUrl()

  1. After the user changes the desktop folder option on one of the two activities, removeScreen() will remove all item records related to the screen ID and the old URL (desktop:/).
  2. But addScreen() will only add back item records for the current activity because addScreen() will directly return if m_availableScreens already contains the screen ID (which is added from the current activity).
  3. Thus items on the desktop of the other activity incorrectly disappear.

The fix

  1. When calling addScreen() or removeScreen() from FolderModel, also consider the activity corresponding to the FolderModel, which is the current activity when the FolderModel is initialized.
  2. Provide a migrator for the old configuration entries because an extra record is added.

BUG: 447558

  • Add tests to make sure screenmapper works correctly.
  • Add a migrator to migrate old configs.
  • Add tests to make sure the migrator works correctly.

2022-01-01_17-28-00

Edited by Fushan Wen

Merge request reports