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.EditedOct 22 2019, 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.EditedOct 23 2019, 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.EditedOct 23 2019, 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.EditedOct 23 2019, 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.

The-Feren-OS-Dev added a comment.EditedNov 17 2019, 2:13 AM

I'll get back to this later, with https://phabricator.kde.org/D23117, but for now this idea is on the backburner (kind of) while I release Feren OS Next. I will get back to this though and start working on making the import Latte Layout call be integrated into the aforementioned patch once I'm done with releasing Feren OS Next officially, though.

@The-Feren-OS-Dev I read an article that in order to handle the panel desktop icons going underneath Latte panels/docks you are adding a plasma panel underneath Latte. I am doing the same and in order to improve things and make them easier I have created a qml plasma applet that enables/disables full transparency for plasma panels without touching the plasma theme. This applet works with mainstream plasma desktop>=5.17.3. In the coming days I will publish it and also demonstrate how to use it easily...

@The-Feren-OS-Dev this is the applet https://store.kde.org/p/1338479/ that can give you fully transparent plasma panels easily when used in plasma desktop>=5.17.3

zachus added a subscriber: zachus.Dec 16 2019, 4:04 PM

next to no one uses Latte for good reasons, I believe.

@zachus that's a bit rude. You happen to be talking to the developer of Latte Dock in this thread. Let's try to keep the comments constructive. :)

next to no one uses Latte for good reasons, I believe.

yeah, you are probably right, except two three distros that are already using it by default in their plasma environment... I suppose that they also do not have any good reasons... Thank you very much for your creative comments... (to catch you up, yeah the previous sentence is an ironic statement). You are totally out of place, if you want to criticize Latte and its usefulness feel free to do so but not here... In an article review, in a new Task saying your arguments that Latte should not be used etc. etc...

The-Feren-OS-Dev added a comment.EditedDec 31 2019, 12:08 AM

Alright, I'm going to try and implement this now Feren OS Dec 2019 is done.

Already I can see one hurdle: Non-running Latte Dock. How would we go about doing the import command best: Would we go about running latte-dock's command through the C++ system thing (usually regarded as being insecure) so it works if Latte Dock isn't running? Is there another, more secure, C++ equivalent to its "system" code to launch Latte Dock?

I mean, we could also have the import DBus Signal sending for when Latte Dock is running, but that'd mean that if Latte Dock isn't running the layout would've then never applied.

I suppose that when Latte when not running you can keep the current implementation or you can use the Latte importing command,

latte-dock --import-layout <filepath>

That command will load and run that specific layout.

Concerning security I have no idea.

Does the command work when Latte Dock is already running in the background? Just asking now so I don't accidentally cause the import to happen twice if Latte Dock is running.

Does the command work when Latte Dock is already running in the background? Just asking now so I don't accidentally cause the import to happen twice if Latte Dock is running.

I think a message appears saying that an instance is already running. Personally as a code style I always make checks in order to avoid such situations.

But would it still carry out the operation if that message displayed or not?

But would it still carry out the operation if that message displayed or not?

It should not

Already I can see one hurdle: Non-running Latte Dock. How would we go about doing the import command best: Would we go about running latte-dock's command through the C++ system thing (usually regarded as being insecure) so it works if Latte Dock isn't running? Is there another, more secure, C++ equivalent to its "system" code to launch Latte Dock?

If Latte supports D-Bus activation, calling the D-Bus method should autostart Latte, assuming it is installed. It might be worth investigating doing that, since that removes the need for separate code paths.

@mvourlakos Is there currently a D-Bus method for starting Latte that can be used? Asking to save myself looking around for it when I work on the Global Theme KCM Code once more.

@mvourlakos Is there currently a D-Bus method for starting Latte that can be used? Asking to save myself looking around for it when I work on the Global Theme KCM Code once more.

I have no idea, it is the first time I hear this is even possible.

Alternatively, we could make use of the tech Plasma uses to launch Latte if a Global Theme specifies Latte as a startup service.

Alternatively, we could make use of the tech Plasma uses to launch Latte if a Global Theme specifies Latte as a startup service.

But that'd mean we'd then have to rely on Latte almost immediately being able to respond to DBus Signals properly for applying an imported layout.

@mvourlakos Is there currently a D-Bus method for starting Latte that can be used? Asking to save myself looking around for it when I work on the Global Theme KCM Code once more.

You don't need a specific method for starting Latte, you can just call the method to import the layout. The D-Bus daemon will autostart Latte, then pass on the method call once it has started. See https://techbase.kde.org/Development/Tutorials/D-Bus/Autostart_Services for some details (it claims to be outdated but the information is mostly still accurate).