Support Latte Dock layout in Look N' Feel packages
Open, Needs TriagePublic

Description

Theoretically a Look N' Feel package can contain a Latte layout file that is loaded automatically when the user chooses that Look N' Feel.

@mart based on a discussion we had for autostarting external apps through Look N' Feel packages (e.g. Latte Dock) can we provide here the info what is needed on Plasma side and what on Latte in order to make this possible?

Additional Info:
Latte is able in master version to import and load a layout through command line when it isnt running through command line:

latte-dock --import-layout <filename>

and of course dynamically can import and switch to any of its loaded layouts.

the latte layout file is just a text file ending with .layout.latte and it is very similar to plasma's appletsrc file.

@The-Feren-OS-Dev hello I read at a new article at https://medium.com/feren-os/a-whole-slew-of-updates-got-released-for-feren-os-next-6c880d6eedda that you are playing with Latte and more specific:

lattedockrc: UniversalSettings: currentLayout

I suppose you are using it in order to swich at a Latte layout. I would like to ask if you are using the dbus way or manually(1. close Latte, change the currentLayout and reload Latte afterwards)

The-Feren-OS-Dev added a comment.EditedTue, Oct 22, 9:38 AM

@The-Feren-OS-Dev hello I read at a new article at https://medium.com/feren-os/a-whole-slew-of-updates-got-released-for-feren-os-next-6c880d6eedda that you are playing with Latte and more specific:

lattedockrc: UniversalSettings: currentLayout

I suppose you are using it in order to swich at a Latte layout. I would like to ask if you are using the dbus way or manually(1. close Latte, change the currentLayout and reload Latte afterwards)

I use the KConfigWrite code that Look & Feel uses to write certain values to RC values in order to change the Latte theme. I also use manual scripting to close Latte, apply the new layout and then open Latte again.

PS: If you want to see the code changes I did to Look & Feel, etc, check https://github.com/feren-os/plasma-desktop-kcms
(stuff that calls feren-theme-tool-plasma can be code checked by opening up the feren-theme-tool-plasma file on the main folder of the repo, also feren-latte-launch can be assumed as loading Latte and killing it's process depending on the argument after it)

@The-Feren-OS-Dev hello I read at a new article at https://medium.com/feren-os/a-whole-slew-of-updates-got-released-for-feren-os-next-6c880d6eedda that you are playing with Latte and more specific:

I use the KConfigWrite code that Look & Feel uses to write certain values to RC values in order to change the Latte theme. I also use manual scripting to close Latte, apply the new layout and then open Latte again.

Ok, some info, Latte is already providing a dbus call to switch layout. For example from command line to switch to Unity layout we can use:

qdbus org.kde.lattedock /Latte switchToLayout "Unity"

I was thinking that might be a good idea to enhance the above method into an Import&Switch we could use:

qdbus org.kde.lattedock /Latte switchToLayout "file:///<absolute path>/PlasmaEnhanced.layout.latte"

so if the layout starts with "file:/" it means that layout must be imported first and switch to it afterwards. In that way you wouldnt need to close Latte and restart it afterwards. All the procedure would be placed through Latte. What do you think?

The downside of course is that if Latte is not running then you would need the current implementation to take place.

The-Feren-OS-Dev added a comment.EditedWed, Oct 23, 1:07 PM

That is a pretty good idea. Also for Latte not running we can use KWriteConfig for the layout changing part too so it always changes no matter what, though Import will be another pain of its own, potentially.

That is a pretty good idea. Also for Latte not running we can use KWriteConfig for the layout changing part too so it always changes no matter what, though Import will be another pain of its own, potentially.

Ok I will prepare the latte running case and I just remembered that when Latte is not running this is already supported. By checking out latte-dock -h in v0.9 you can use:

latte-dock --import-layout <file_name>

and that layout will be imported and loaded automatically... Latte takes all the burden around it.

The-Feren-OS-Dev added a comment.EditedWed, Oct 23, 1:48 PM

Started working on a patch for the Latte Dock layout specifying part at least. Is there a DBus Signal I can use for cleanly quitting Latte so that Look & Feels can also specify to not have Latte running at all?

davidre added a subscriber: davidre.EditedWed, Oct 23, 1:59 PM

Started working on a patch for the Latte Dock layout specifying part at least. Is there a DBus Signal I can use for cleanly quitting Latte so that Look & Feels can also specify to not have Latte running at all?

There should be /MainApplication org.qtproject.Qt.QCoreApplication.quit

That is a pretty good idea. Also for Latte not running we can use KWriteConfig for the layout changing part too so it always changes no matter what, though Import will be another pain of its own, potentially.

ok... landed for upcoming v0.9.4 and master version of course through commit: https://cgit.kde.org/latte-dock.git/commit/?id=904cdfe2af60e64b28218544392900faf9f91530

so what you can do:

When Latte is NOT RUNNING:

latte-dock --import-layout <file_name>

When Latte is RUNNING any of the following syntaxes:

qdbus org.kde.lattedock /Latte switchToLayout "file:///<absolute path>/PlasmaEnhanced.layout.latte"
qdbus org.kde.lattedock /Latte switchToLayout "file://<absolute path>/PlasmaEnhanced.layout.latte"
qdbus org.kde.lattedock /Latte switchToLayout "/<absolute path>/PlasmaEnhanced.layout.latte"

Started working on a patch for the Latte Dock layout specifying part at least. Is there a DBus Signal I can use for cleanly quitting Latte so that Look & Feels can also specify to not have Latte running at all?

There should be /MainApplication org.qtproject.Qt.QCoreApplication.quit

Just checked! Didnt know it existed but it works just fine, full syntax would be:

qdbus org.kde.lattedock /MainApplication org.qtproject.Qt.QCoreApplication.quit

Added in the Latte Dock changing to patch D23117, however direct layout importing is not yet implemented into this patch (I think that should come in a later patch at a later time as you're still working on getting the code completely done on Latte's side at this point in time anyway).

I think that should come in a later patch at a later time as you're still working on getting the code completely done on Latte's side at this point in time anyway

The Latte side code has already landed and it is ready to test it out if you want. The commit https://cgit.kde.org/latte-dock.git/commit/?id=904cdfe2af60e64b28218544392900faf9f91530 is part of Latte v0.9 and master branches. No more code is needed because all the latte back-end functionality was already in place. I will try to release Latte v0.9.4 this weekend and that commit will be part of it.