Make Plasma Desktop aware about Latte Docks/Panels geometries
Closed, ResolvedPublic

Description

As described in:

It is now possible to use plasma panels that are placed below Latte Docks / Panels in order to make Plasma aware of their geometries. Current requirements of this approach are:

  • Plasma Desktop >= 5.17.3 [provides correct way to enable/disable the panel shadows]
  • Latte Dock >= 0.9.5 [provides a mechanism to ignore plasma panels in dynamic background heuristics]
  • Panel Transparency Button widget that can make a plasma panel truly FULL tranparent at all cases [ https://store.kde.org/p/1338479 ]

As proposed from users it would be really nice if that approach could be made fully automatic from user point of view. As such Latte will take responsibility in order to update all plasma panels that are related to Latte and are used in order to inform Plasma about Latte geometries.

What is needed?

  1. A javascipt script that will be responsible to send to Plasma correctly what panels to create/delete/update
  2. Latte will have to execute the [1] script ONLY whenever needed.

Script

The script must be implemented in a way to support the already provided features of Latte. That means that multi-screen, multi-layouts scenarios should be possible. Best way I can think of is that the script is taking only an array of panels that are just the input and does not return any output.

  • input: an array of panels which are going to be exactly the panels that are needed from Latte in the following form: screen_id : edge : thickness

Hint1: for plasma panels the screen used is found in lastScreen property. lastScreen=0 means always on primary screen, anything else is a reference to spesific screen
Hint2: In each screen-edge there can be only ONE autocreated plasma panel because this is what applies for Latte

  • Autocreated Panels Common Properties:
  • Visibility: Window Go Below
  • Alignment: Center
  • minimum Length and a little bigger maximum length just like the video demonstration
  • a new property should be written in their configs: autocreatedFromLatte = true. This property helps in order to distinguish which plasma panels are user created and must NOT be touched and which are Latte autocreated.
  • the autocreated panels should contain the Panel Transparency Button, and must be ENABLED on first creation

Usage Example

Latte provides the following Array:

  • 0 - Left - 36 [on primary screen at its left edge a panel with thickness: 36px.]
  • 2 - Top - 32 [on screen with id=2 at its top edge a panel with thickness: 32px.]

Algorithm approach for previous example:

  1. The script identifies which plasma panels are tagged as autocreatedFromLatte.
  2. If any of these panels is not found at Primary Screen:Left Edge OR Screen 2:Top Edge then these autocreated panels are DELETED.
  3. If an autocreated plasma panel already exists in Primary Screen:Left Edge OR Screen 2:Top Edge then we make sure to only UPDATE its thickness correctly to the right value
  4. If an autocreated plasma panel does not exist in Primary Screen:Left Edge OR Screen 2:Top Edge then it is added at correct screen and with correct thickness

Latte

Latte must be updated in a way to understand which of its Latte Panels/Dock will need autocreated plasma panels and when the referenced script should be executed. For reference a Latte dock/panel is named Latte::View

  • If the Plasma Transparency Button is not installed or Plasma Desktop is not running then the autocreation mechanism should be TOTALLY inactive.
  • Latte::View must gain a property to tag which views need an autocreated plasma panel
  • Proposed case is for Latte::Views with visibility mode: Always Visible AND Window Go Below
  • The script should be executed only at per CentralLayout level. This way the multi-layouts case in taken into account. If the user cycles through different Activities should not make any difference, ONLY WHEN a Central Layout becomes the current one after 500ms (so the user is probably working in it), the script is executed
  • Latte::View changes from the current Central Layout should also trigger the script:
  • Autocreated Requirement is changed e.g. when a Latte panel is switching from Always Visible to AutoHide and vice versa
  • Normal Thickness is changed [after the animation has ended]
  • Edge is Changed
  • Screen is Changed
  • When Latte is starting, the script should be executed and when Latte is closing, it should also be executed in order to REMOVE ALL autocreated plasma panels

Hint: If Latte crashes then the plasma autocreated panels will remain, restarting Latte should fix the issue because the script will take over to remove any unneeded plasma panels.

trmdi added a comment.Dec 4 2019, 3:09 AM

minimum Length and a little bigger maximum length just like the video demonstration

Why is this needed?

In the video, I see you set max-length = min-length = length.
And I tried setting max-length = min-length = length = 100 as in my script, I don't see any problem.

trmdi added a comment.Dec 4 2019, 4:29 AM

I've modified the script a bit. Please check PlasmaHelper::createPanel again.

Can you explain a bit more about the "screen", "desktop" concepts? I've still not understood them.

minimum Length and a little bigger maximum length just like the video demonstration

Why is this needed?

In the video, I see you set max-length = min-length = length.
And I tried setting max-length = min-length = length = 100 as in my script, I don't see any problem.

In order to be sure that the autocreated panel is always under the Latte one and the user does not notice it with any desktop interaction

I've modified the script a bit. Please check PlasmaHelper::createPanel again.

Can you explain a bit more about the "screen", "desktop" concepts? I've still not understood them.

Plasma panels are assigned on screens and the same applies for Latte panels also. The property of plasma panels that is responsible to define the screen for the plasma panel is the lastScreen[integer] , the screen correct ids is Latte responsibility to provide. For the "desktop" I did not understand what you mean.

trmdi added a comment.Dec 4 2019, 7:51 AM

Ok, please try the script again.

trmdi added a comment.Mar 5 2020, 9:18 AM

Could we close this now?

mvourlakos closed this task as Resolved.Mar 5 2020, 11:30 AM

yep