Helper tools and scripts I wrote to help me while working on KDE QML Plasmoids (widgets).
By design all the tools are "location agnostic" and can be invoked from any directory. they will try to determine proper root directory of QML plasmoid if needed, based on your current working directory (traversing up if needed). This means that your working directory must be one of plasmoid's directories. You currently cannot manually specify where plasmoid is manually, but that's mostly because I do not work that way and it was not needed by my workflow (adding support for that is trivial though).
When you invoke i.e. test.sh
script, it will try to determine root folder of the plasmoid.
This is done by looking for metadata.desktop
file in current directory. If file is not
present, the parent dir is checked and so on.
Available tools:
test.sh
: runs your plasmoid inplasmaviewer
. When invoked without arguments, will try to useCompactRepresentation
by enforcing smaller widget area, which mimics docking plasmoid in the Panel. When invoked with any argument (literaly any will work, i.e.test.sh foo
), will run you plasmoid as it is installed as desktop widget (soFullRepresentation
should kick in).meta.sh
: This is my work around for Plasma API not exposing metadata file content in any other way. It parses project'smetadata.desktop
and creates/contents/js/meta.js
containing extracted information, that can be later imported and used in your JavaScript code. Currently exposes metadata'sX-KDE-PluginInfo-Version
asversion
,Name
asname
,X-KDE-PluginInfo-Website
asurl
,X-KDE-PluginInfo-Author
asauthorName
. It also looks for additional, non-standard fields:X-KDE-PluginInfo-Author-Url
(exported asauthorUrl
),X-KDE-PluginInfo-UpdateChecker-Url
(exported asupdateCheckerUrl
) andX-KDE-PluginInfo-FirstReleaseYear
exported asfirstReleaseYear
.install.sh
: installs/upgrades your plasmoid in~/.local/share/plasma/plasmoids/
folderm then restarts plasmashell. Please note it will upgrade existing installation without any confirmation. Note: it automatically updatesmeta.js
file.release.sh
: packs plasmoid sources and creates release file. Target file name is going to bePACKAGE-VERSION.plasmoid
and constructed usingmetadata.desktop
information. Note: it automatically updatesmeta.js
file.
As mentioned, scripts are "location agnostic" and can be invoked from any directory.
You can add it to your $PATH
. I personally use Fish shell
and added following aliases to my ~/.config/fish/config.fish
:
alias otest "<TOOLS_DIR>/bin/test.sh"
alias oinstall "<TOOLS_DIR>/bin/install.sh"
alias orelease "<TOOLS_DIR>/bin/release.sh"
alias ometa "<TOOLS_DIR>/bin/meta.sh"
- If your plasmoid misbehave, you may want to run it using "desktop" mode (
test.sh foo
). That will make any syntax error related messages nicely visible in plasmaviewer window. - You can easily customize QT log entries (thrown by
console.xxx()
calls) and i.e. add file name or line number to it by settingQT_MESSAGE_PATTERN
. Seetest.sh
souces for details and additional links.
- Written and copyrighted ©2020-2023 by Marcin Orlowski <mail (#) marcinorlowski (.) com>
- Plasmoid Tools is open-sourced software licensed under the MIT license.