Skip to content

Commit

Permalink
Merge pull request #2 from MarcinOrlowski/dev
Browse files Browse the repository at this point in the history
Release 1.1.2
  • Loading branch information
MarcinOrlowski authored Feb 21, 2023
2 parents 606233d + a131a6d commit a7b3843
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 40 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
package/contents/config/main.xml
*.plasmoid
/*.sh
/release
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Changelog

* v1.1.2 (2023-02-21)
* Corrected usage of `tput`.

* v1.1.1 (2022-01-05)
* `meta.sh` now also creates targetd directory.

Expand Down
61 changes: 30 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# KDE QML/Plasma Applet Developer Tools #

Helper tools and scripts I wrote to help me while working on KDE QML Plasmoids.
Helper tools and scripts I wrote to help me while working on KDE QML Plasmoids (widgets).

# Tools #

Expand All @@ -11,42 +11,42 @@ they will try to determine proper root directory of QML plasmoid if needed, base
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 (adding support for that is trivial though).
and it was not needed by my workflow (adding support for that is trivial though).

# Determinig plasmoid root directory #

When you invoke i.e. `test.sh` tool, it will try to determine root folder of the plasmoid.
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.

# Tools #

Available tools:

* `test.sh`: runs your plasmoid in `plasmaviewer`. When invoked without arguments,
will try to use `CompactRepresentation` 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 (so `FullRepresentation` 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's `metadata.desktop` and creates `/contents/js/meta.js`
containing extracted information, that can be later imported and used in your JavaScript
code. Currently exposes metadata's `X-KDE-PluginInfo-Version` as `version`,
`Name` as `name`, `X-KDE-PluginInfo-Website` as `url`, `X-KDE-PluginInfo-Author` as `authorName`.
It also looks for additional, non-standard fields: `X-KDE-PluginInfo-Author-Url` (exported
as `authorUrl`), `X-KDE-PluginInfo-UpdateChecker-Url` (exported as `updateCheckerUrl`) and
`X-KDE-PluginInfo-FirstReleaseYear` exported as `firstReleaseYear`.
* `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 updates `meta.js` file.
* `release.sh`: packs plasmoid sources and creates release file. Target file name is
going to be `PACKAGE-VERSION.plasmoid` and constructed using `metadata.desktop` information.
Note: it automatically updates `meta.js` file.
* `test.sh`: runs your plasmoid in `plasmaviewer`. When invoked without arguments,
will try to use `CompactRepresentation` 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 (so `FullRepresentation` 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's `metadata.desktop` and creates `/contents/js/meta.js`
containing extracted information, that can be later imported and used in your JavaScript
code. Currently exposes metadata's `X-KDE-PluginInfo-Version` as `version`,
`Name` as `name`, `X-KDE-PluginInfo-Website` as `url`, `X-KDE-PluginInfo-Author` as `authorName`.
It also looks for additional, non-standard fields: `X-KDE-PluginInfo-Author-Url` (exported
as `authorUrl`), `X-KDE-PluginInfo-UpdateChecker-Url` (exported as `updateCheckerUrl`) and
`X-KDE-PluginInfo-FirstReleaseYear` exported as `firstReleaseYear`.
* `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 updates `meta.js` file.
* `release.sh`: packs plasmoid sources and creates release file. Target file name is
going to be `PACKAGE-VERSION.plasmoid` and constructed using `metadata.desktop` information.
Note: it automatically updates `meta.js` file.


# Installation #

As mentioned, scripts are "location agnostic" and can be invoked from any directory.
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](https://fishshell.com/)
and added following aliases to my `~/.config/fish/config.fish`:

Expand All @@ -59,14 +59,13 @@ alias ometa "<TOOLS_DIR>/bin/meta.sh"

# Tips #

* 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 setting `QT_MESSAGE_PATTERN`. See `test.sh` souces
for details and additional links.
* 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 setting `QT_MESSAGE_PATTERN`. See `test.sh` souces
for details and additional links.

## License ##

* Written and copyrighted &copy;2020-2022 by Marcin Orlowski <mail (#) marcinorlowski (.) com>
* Plasmoid Tools is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

* Written and copyrighted &copy;2020-2023 by Marcin Orlowski <mail (#) marcinorlowski (.) com>
* Plasmoid Tools is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).
5 changes: 3 additions & 2 deletions bin/colors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# KDE Plasma Applets Developer Tools
#
# @author Marcin Orlowski <mail (#) marcinOrlowski (.) com>
# @copyright 2020-2022 Marcin Orlowski
# @copyright 2020-2023 Marcin Orlowski
# @license http://www.opensource.org/licenses/mit-license.php MIT
# @link https://github.com/MarcinOrlowski/plasmoid-tools
#
Expand All @@ -22,7 +22,8 @@ function TPUT {
# We need to have $TERM set otherwise tput would fail
# When invoked by cron, we may or may not have it so...
if [[ -n "${TERM:-}" && "${TERM}" != "dumb" ]]; then
tput "${1:-}" "${2:-}" "${3:-}"
echo tput "${1:-}" ${2:-} ${3:-}
tput "${1:-}" ${2:-} ${3:-}
else
echo -n ""
fi
Expand Down
2 changes: 1 addition & 1 deletion bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# KDE Plasma Applets Developer Tools
#
# @author Marcin Orlowski <mail (#) marcinOrlowski (.) com>
# @copyright 2020-2022 Marcin Orlowski
# @copyright 2020-2023 Marcin Orlowski
# @license http://www.opensource.org/licenses/mit-license.php MIT
# @link https://github.com/MarcinOrlowski/plasmoid-tools
#
Expand Down
4 changes: 2 additions & 2 deletions bin/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# KDE Plasma Applets Developer Tools
#
# @author Marcin Orlowski <mail (#) marcinOrlowski (.) com>
# @copyright 2020-2022 Marcin Orlowski
# @copyright 2020-2023 Marcin Orlowski
# @license http://www.opensource.org/licenses/mit-license.php MIT
# @link https://github.com/MarcinOrlowski/plasmoid-tools
#
# Packs plasmoid and installs/upgrades it locally, then restarts plasmashell.
# Packs plasmoid and installs/upgrades it locally (for your user), then restarts plasmashell.
#

set -euo pipefail
Expand Down
4 changes: 2 additions & 2 deletions bin/meta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# KDE Plasma Applets Developer Tools
#
# @author Marcin Orlowski <mail (#) marcinOrlowski (.) com>
# @copyright 2020-2022 Marcin Orlowski
# @copyright 2020-2023 Marcin Orlowski
# @license http://www.opensource.org/licenses/mit-license.php MIT
# @link https://github.com/MarcinOrlowski/plasmoid-tools
#
# Creates <PLASMOID_ROOT>/contents/js/meta.js file
# Creates <PLASMOID_ROOT>/contents/js/meta.js file with plasmoid metadata.
#

set -euo pipefail
Expand Down
4 changes: 3 additions & 1 deletion bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
# KDE Plasma Applets Developer Tools
#
# @author Marcin Orlowski <mail (#) marcinOrlowski (.) com>
# @copyright 2020-2022 Marcin Orlowski
# @copyright 2020-2023 Marcin Orlowski
# @license http://www.opensource.org/licenses/mit-license.php MIT
# @link https://github.com/MarcinOrlowski/plasmoid-tools
#
# Packs plasmoid files for the release.
#

set -euo pipefail

Expand Down
4 changes: 3 additions & 1 deletion bin/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
# KDE Plasma Applets Developer Tools
#
# @author Marcin Orlowski <mail (#) marcinOrlowski (.) com>
# @copyright 2020-2022 Marcin Orlowski
# @copyright 2020-2023 Marcin Orlowski
# @license http://www.opensource.org/licenses/mit-license.php MIT
# @link https://github.com/MarcinOrlowski/plasmoid-tools
#
# Runs instance of the plasmoid in plasmoidviewer.
#

set -euo pipefail

Expand Down

0 comments on commit a7b3843

Please sign in to comment.