<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[KDEOK - Medium]]></title>
        <description><![CDATA[KDE and all things related - Medium]]></description>
        <link>https://medium.com/kdeok?source=rss----182eeba4443e---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>KDEOK - Medium</title>
            <link>https://medium.com/kdeok?source=rss----182eeba4443e---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 21:04:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/kdeok" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to create a theme that looks and feels like Unity using Plasma’s Desktop Scripting API]]></title>
            <link>https://medium.com/kdeok/how-to-create-a-theme-that-looks-and-feels-like-unity-using-plasmas-desktop-scripting-api-efe33d36bec6?source=rss----182eeba4443e---4</link>
            <guid isPermaLink="false">https://medium.com/p/efe33d36bec6</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[kde]]></category>
            <category><![CDATA[plasma]]></category>
            <dc:creator><![CDATA[Łukasz Sawicki]]></dc:creator>
            <pubDate>Thu, 12 Apr 2018 13:20:06 GMT</pubDate>
            <atom:updated>2018-04-12T13:20:06.024Z</atom:updated>
            <content:encoded><![CDATA[<p>How to create a theme that looks and feels like Unity using Plasma’s Desktop Scripting API</p><p>Plasma is probably one of the most configurable desktop environments around. With Plasma 5 developers wanted to make the configurability even easier and more straightforward than ever before by applying the rule “<em>simple by default, powerful when needed</em>”. To make that happen, the concept of Plasma look and feel themes <a href="http://notmart.org/blog/2016/10/choose-your-own-experience-in-plasma-5-8-and-beyond/">was born</a>.</p><p>Plasma look and feel themes (L&amp;F) let you change the look of your Plasma desktop with just a few clicks. The simplest way to create look and feel theme is by using utility called <em>Look and Feel Explorer</em>, as described in the <a href="https://userbase.kde.org/Plasma/Create_a_Look_and_Feel_Package">official documentation</a>. You should also check out this <a href="https://youtu.be/Hac3c6fADQM">video tutorial</a>.</p><p>However if you want to have more granular control over what exactly happens with your theme, especially with the layout you can use <a href="https://userbase.kde.org/KDE_System_Administration/PlasmaDesktopScripting">Plasma desktop scripting</a>. Some time ago I rewrote my L&amp;F theme (United) using desktop scripting API. In this post I am going to describe step by step how you too can create a Unity-like desktop layout by using Plasma’s desktop scripting API.</p><p>Let’s get started.</p><p>In short, desktop scripting lets you control and interact with a Plasma user interface shell via JavaScript like API. You can use an interactive scripting dialog to test your scripts.</p><pre>qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.showInteractiveConsole</pre><p>As you may know, inside your L&amp;F theme (<em>contents/layout</em>) there is a file called <strong>org.kde.plasma.desktop-layout.js</strong> which controls your Plasma setup. If you are using <em>Look and Feel Explorer</em> that file and its content is created automatically.</p><p>First you need to create a proper L&amp;F package structure with all the files you need and save it in:</p><pre>/home/[<em>yourusername</em>]/.local/share/plasma/look-and-feel/</pre><p>You can use <em>Look and Feel Explorer</em> or modify an existing theme like <em>United</em>. Next open <strong>org.kde.plasma.desktop-layout.js </strong>in your favorite text editor. I am using <em>Kate</em> (Plasma’s default text editor). At the beginning of your file you need to add:</p><pre>var plasma = getApiVersion(1)</pre><p>Ok, now let’s create a new plasma panel located at the top of the screen:</p><pre>panel = new plasma.Panel<br>panel.location = “top”</pre><p>Add the height property for the panel (<em>gridUnit * 2 </em>is a default value used in plasma)</p><pre>panel.height = gridUnit * 2</pre><p>Once you have a new shiny panel you can add some widgets.</p><p>To get a list of widgets installed locally (for example from the KDE Store), do this:</p><pre>kpackagetool5 --list --type Plasma/Applet</pre><p>To get a list of all installed widgets (system wide):</p><pre>kpackagetool5 --list --type Plasma/Applet --global</pre><p>Once you have a list of installed widgets, you can use the <em>panel.addWidget</em> method to add them to your top panel.</p><pre>panel.addWidget(“org.kde.plasma.appmenu”)<br>panel.addWidget(“org.kde.plasma.panelspacer”)<br>panel.addWidget(“org.kde.plasma.systemtray”)<br>panel.addWidget(“org.kde.plasma.digitalclock”)</pre><p>And here is the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vnu52KoOhGcjveWcqBWyHg.png" /></figure><p>You need to add another spacer on the left side of the appmenu (otherwise the appmenu will overlap with the left panel). You also need a user switcher applet on the right side of a digital clock. Let’s start with the spacer:</p><pre>var spacer = panel.addWidget(“org.kde.plasma.panelspacer”)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*svzCfhZ3yKptrMKRxT5RYg.png" /></figure><p>Now our global menu is located at center of the panel. This is because the default spacer takes up all available space in a panel. You need to change that by setting the <em>expanding</em> value to <em>false</em>. You use the <em>currentConfigGroup</em> property and <em>writeConfig</em> method to modify config file.</p><p><strong>/home/.config/plasma-org.kde.plasma.desktop-appletsrc</strong>.</p><pre>var spacer = panel.addWidget(“org.kde.plasma.panelspacer”)<br>spacer.currentConfigGroup = [“Configuration”, “General”]<br>spacer.writeConfig(“expanding”, false)</pre><p>Next you will add USwitch (<a href="https://store.kde.org/p/1194339/">https://store.kde.org/p/1194339/</a>), the Unity-like user switcher applet, from the KDE Store.</p><p>You need to add it as a dependency to your L&amp;F theme. If you want to know how to do that, check out this <a href="https://userbase.kde.org/Plasma/Create_a_Look_and_Feel_Package">tutorial</a>. Once added to the panel, USwitch shows full user name by default. However we want to show an icon, just like in Unity. The good news is that USwitch offers such an option: You only need to change it using plasma desktop scripting. While most of the settings (configuration keys) offered by default widgets are <a href="https://userbase.kde.org/KDE_System_Administration/PlasmaDesktopScripting#Configuration_Keys">documented</a>, this is not the case with third party widgets. The simplest way to get such information is to open <strong>plasma-org.kde.plasma.desktop-appletsrc </strong>in Kate, go to <em>USwitcher Settings</em> and change it to <em>Show only icon</em>. Close window settings and you will get something like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aivB8VnQjCwilu55VTW-Ig.png" /></figure><p>Click <em>View Difference</em> to see what configuration keys were changed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NfX8ITHABbZtkUcicSQveg.png" /></figure><pre>var uswitcher= panel.addWidget(“org.kde.plasma.uswitcher”)<br>uswitcher.currentConfigGroup = [“Configuration”, “General”]<br>uswitcher.writeConfig(“showName”, false)<br>uswitcher.writeConfig(“showSett”, true)</pre><p>Now <strong>org.kde.plasma.desktop-layout.js </strong>should looks like this:</p><pre>var plasma = getApiVersion(1)</pre><pre>// Create top panel</pre><pre>panel = new plasma.Panel<br>panel.location = “top”<br>panel.height = gridUnit * 2</pre><pre>// Add widgets to the top panel</pre><pre>var spacer = panel.addWidget(“org.kde.plasma.panelspacer”)<br>// Make first spacer non expandable by default<br>spacer.currentConfigGroup = [“Configuration”, “General”]<br>spacer.writeConfig(“expanding”, false)</pre><pre>// Appmenu<br>panel.addWidget(“org.kde.plasma.appmenu”)<br>// Spacer<br>panel.addWidget(“org.kde.plasma.panelspacer”)<br>// Systemtray<br>panel.addWidget(“org.kde.plasma.systemtray”)<br>// Clock<br>panel.addWidget(“org.kde.plasma.digitalclock”)</pre><pre>// USwitch <a href="https://store.kde.org/p/1194339/">https://store.kde.org/p/1194339/</a><br>var uswitcher = panel.addWidget(“org.kde.plasma.uswitcher”)<br>uswitcher.currentConfigGroup = [“Configuration”, “General”]<br>uswitcher.writeConfig(“showName”, false)<br>uswitcher.writeConfig(“showSett”, true)</pre><p>Let’s create the left panel…</p><pre>var leftpanel = new plasma.Panel<br>leftpanel.location = “left”<br>leftpanel.height = gridUnit * 3.2</pre><p>… And add a fullscreen launcher and default shortcut:</p><pre>var menu = leftpanel.addWidget(“org.kde.plasma.kickerdash”)<br>menu.currentConfigGroup = [“Shortcuts”]<br>menu.writeConfig(“global”, “Alt+F1”)</pre><p>Now you can add an icon-based task manager:</p><pre>leftpanel.addWidget(“org.kde.plasma.icontasks”)</pre><p>Add <em>Present Windows Button</em> widget from KDE Store (<a href="https://store.kde.org/p/1181039/">https://store.kde.org/p/1181039/</a>) and change its settings to show the desktop grid by default:</p><pre>var windows = leftpanel.addWidget(“com.github.zren.presentwindows”)<br>windows.currentConfigGroup = [“Configuration”, “General”]<br>windows.writeConfig(“clickCommand”,”ShowDesktopGrid”)</pre><p>Add a trash can:</p><pre>leftpanel.addWidget(“org.kde.plasma.trash”)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uoLV0OJXUVmT_e-_ZTHXMA.png" /></figure><p>You are almost there and only need to fix overlapping panels…</p><pre>leftpanel.offset=panel.height</pre><p>… And remove the desktop toolbox</p><pre>var activityId = activityIds[0]</pre><pre>var activity = desktopById(activityId)<br>activity.currentConfigGroup = [“General”]<br>activity.writeConfig(“showToolbox”, false)</pre><p>The final <strong>org.kde.plasma.desktop-layout.js </strong>should look like this:</p><pre>var plasma = getApiVersion(1)</pre><pre>var activityId = activityIds[0]</pre><pre>var activity = desktopById(activityId)<br>//Remove desktop toolbox<br>activity.currentConfigGroup = [“General”]<br>activity.writeConfig(“showToolbox”, false)</pre><pre>//Create top panel<br>panel = new plasma.Panel<br>panel.location = “top”<br>panel.alignment = “left”<br>panel.height = gridUnit * 2</pre><pre>//Add widgets to the top panel</pre><pre>var spacer = panel.addWidget(“org.kde.plasma.panelspacer”)<br>//Make first spacer non expandable by default<br>spacer.currentConfigGroup = [“Configuration”, “General”]<br>spacer.writeConfig(“expanding”, false)</pre><pre>//Kickerdash<br>panel.addWidget(“org.kde.plasma.appmenu”)<br>//Spacer<br>panel.addWidget(“org.kde.plasma.panelspacer”)<br>//System tray<br>panel.addWidget(“org.kde.plasma.systemtray”)<br>//Clock<br>panel.addWidget(“org.kde.plasma.digitalclock”)</pre><pre>//USwitch <a href="https://store.kde.org/p/1194339/">https://store.kde.org/p/1194339/</a><br>var uswitcher = panel.addWidget(“org.kde.plasma.uswitcher”)<br>uswitcher.currentConfigGroup = [“Configuration”, “General”]<br>uswitcher.writeConfig(“showName”, false)<br>uswitcher.writeConfig(“showSett”, true)</pre><pre>//Create left panel<br> <br>var leftpanel = new plasma.Panel<br>leftpanel.location = “left”<br>leftpanel.height = gridUnit * 3.2<br>leftpanel.offset=panel.height</pre><pre>//Add widgets to the left panel<br>var menu = leftpanel.addWidget(“org.kde.plasma.kickerdash”)<br>//Add default shortcut to the kickerdash menu<br>menu.currentConfigGroup = [“Shortcuts”]<br>menu.writeConfig(“global”, “Alt+F1”)<br>//Icontasks<br>leftpanel.addWidget(“org.kde.plasma.icontasks”)<br>//Present Windows Button <a href="https://store.kde.org/p/1181039/">https://store.kde.org/p/1181039/</a><br>var windows = leftpanel.addWidget(“com.github.zren.presentwindows”)<br>//Toggle desktop grid<br>windows.currentConfigGroup = [“Configuration”, “General”]<br>windows.writeConfig(“clickCommand”,”ShowDesktopGrid”)<br>//Trash<br>leftpanel.addWidget(“org.kde.plasma.trash”)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RaCwtwNZC-2gt5YsXUU5mA.png" /></figure><p>Are you still there? I hope you weren’t bored too much ;)</p><p>That said, if you want all the work done for you, you can download United from <a href="https://store.kde.org/p/1167950/">KDE Store</a> or from<a href="https://github.com/llucassaw/United"> GitHub</a>. I also added <a href="https://userbase.kde.org/Plasma/How_to_create_a_Unity-like_look_and_feel_theme_using_Plasma%E2%80%99s_Desktop_Scripting_API">documentation </a>to the official KDE wiki.</p><p>This theme also uses:</p><p>-Color Scheme (Ambiance) made by CHICHOVOTO<br><a href="https://store.kde.org/p/1001434/">https://store.kde.org/p/1001434/</a></p><p>-Plasma theme (Unity Ambiance) made by DARKBEASTOFPREY<br><a href="https://store.kde.org/p/998797">https://store.kde.org/p/998797</a></p><p>- Plasmoids <br>Present Windows Button made by ZREN<br><a href="https://store.kde.org/p/1181039/">https://store.kde.org/p/1181039/</a></p><p>USwitch made by DIVINAE<br><a href="https://store.kde.org/p/1194339/">https://store.kde.org/p/1194339/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=efe33d36bec6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kdeok/how-to-create-a-theme-that-looks-and-feels-like-unity-using-plasmas-desktop-scripting-api-efe33d36bec6">How to create a theme that looks and feels like Unity using Plasma’s Desktop Scripting API</a> was originally published in <a href="https://medium.com/kdeok">KDEOK</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>