Plasma Marble Globe wallpaper (was: Re: My first task)

Friedrich W. H. Kossebau kossebau at kde.org
Fri May 23 10:25:16 BST 2025


Hi Piotr,

Am Freitag, 23. Mai 2025, 10:02:54 Mitteleuropäische Sommerzeit schrieb Piotr 
Frankowski:
> Hello,
> Long time has passed, I have found some free time, and with little help of
> LLM I have managed to reproduce your work, modify the script(?), and it
> works. I have enabled stars, but I cannot force clouds display - I think
> problem is inside of Marble. I have found, that in the script there is
> marbleItem which is
> https://api.kde.org/marble/html/MarbleQuickItem_8h_source.html - and it has
> less properties than MarbleMap. In my setup there is a problem with getting
> location - geolocation is returning access denied or something. My KDE is
> 5.27, I'm just curious if this script will work on new KDE. 

Myself not involved or staying experienced in for some years with both Marble 
& Plasma things, also out of spare leisure time here. So sadly cannot help 
myself.

Perhaps there is someone active around on the mailing-list marble-devel, so I 
added them to the cc: next to kde-devel (you might want to subscribe there, 
see for more related contact info also
    https://marble.kde.org/contributors-welcome.php
)

Hope you find some people assisting you and can have some more fun and finally 
achieve your goals here and extend on them :)

Cheers
Friedrich

> This is my sript:
> 
> ```
> /*
>  * Copyright 2018  Friedrich W. H. Kossebau <kossebau at kde.org>
>  *
>  * This program is free software; you can redistribute it and/or
>  * modify it under the terms of the GNU Lesser General Public
>  * License as published by the Free Software Foundation; either
>  * version 2.1 of the License, or (at your option) any later version.
>  *
>  * This program is distributed in the hope that it will be useful,
>  * but WITHOUT ANY WARRANTY; without even the implied warranty of
>  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>  * Lesser General Public License for more details.
>  *
>  * You should have received a copy of the GNU Lesser General Public
>  * License along with this program. If not, see <
> http://www.gnu.org/licenses/>.
>  */
> 
> import QtQuick 2.1
> 
> import org.kde.plasma.core 2.0 as PlasmaCore
> import org.kde.plasma.extras 2.0 as PlasmaExtras
> 
> import org.kde.marble.private.plasma 0.20
> 
> MarbleItem {
>     id: marbleItem
>     // https://api.kde.org/marble/html/MarbleQuickItem_8h_source.html
>     // available properties
> 
>     readonly property int centerMode: wallpaper.configuration.centerMode
>     property double fixedLongitude: wallpaper.configuration.fixedLongitude
>     property double fixedLatitude: wallpaper.configuration.fixedLatitude
>     property double locationLongitude: 0.0
>     property double locationLatitude: 0.0
> 
>     enabled: false // do not handle input
> 
>     radius: {
>         var ratio = width/height;
>         if (ratio > 1) {
>             return height / 2.5;
>         }
>         return width / 2.5
>     }
> 
>     // Theme settings.
>     projection: MarbleItem.Spherical
>     mapThemeId: "earth/bluemarble/bluemarble.dgml"
> 
>     // Visibility of layers/plugins.
>     showAtmosphere: true
>     showClouds: true
>     showBackground: true
> 
>     showGrid: false
>     showCrosshairs: false
>     showCompass: false
>     showOverviewMap: false
>     showScaleBar: false
>     showOtherPlaces: false
>     showPublicTransport: false
>     showOutdoorActivities: false
> 
> 
>     onCenterModeChanged: handleCenterModeChange()
>     function handleCenterModeChange() {
>         if (centerMode === 0) {
>             marbleItem.centerOn(locationLongitude, locationLatitude);
>         } else if (centerMode === 1)  {
>             marbleItem.centerOn(fixedLongitude, fixedLatitude);
>         } else {
>             marbleItem.centerOn(locationLongitude, locationLatitude);
>         }
>     }
> 
>     onFixedLongitudeChanged: handleFixedLonLatChange()
>     onFixedLatitudeChanged: handleFixedLonLatChange()
>     function handleFixedLonLatChange() {
>         if (centerMode === 1) {
>             marbleItem.centerOn(fixedLongitude, fixedLatitude);
>         }
>     }
> 
>     onLocationLongitudeChanged:handleLocationChange()
>     onLocationLatitudeChanged:handleLocationChange()
>     function handleLocationChange() {
>         if (centerMode === 2) {
>             marbleItem.centerOn(locationLongitude, locationLatitude);
>         }
>     }
> 
>     Component.onCompleted: {
> 
>         // marbleItem.setShowPlaces(false);
>         // marbleItem.setShowCities(false);
>         marbleItem.setShowOtherPlaces(showOtherPlaces);
>         marbleItem.setShowBackground(showBackground);
> 
>         handleCenterModeChange();
>     }
> 
>     PlasmaCore.DataSource {
>         id: geolocationDataSource
>         engine: "geolocation"
>         connectedSources: (marbleItem.centerMode === 2) ? ["location"] : []
>         interval: 10 * 60 * 1000 // every 30 minutes, might be still too
> large for users on the ISS :P
>     }
> 
>     Timer {
>         id: sunPositionTimer
>         interval: 60000 // Update every minute
>         running: marbleItem.centerMode === 0 // Only when following sun
>         repeat: true
>         triggeredOnStart: true
> 
>         onTriggered: {
>             var sunPos = calculateSunPosition();
>             marbleItem.locationLongitude = sunPos.longitude;
>             marbleItem.locationLatitude = sunPos.latitude;
>             handleCenterModeChange();
>         }
>     }
> 
>     // Function to calculate sun's position
>     function calculateSunPosition() {
>         var now = new Date();
>         var dayOfYear = getDayOfYear(now);
>         var timeOfDay = now.getUTCHours() + now.getUTCMinutes() / 60.0;
> 
>         // Solar declination (simplified)
>         var declination = -23.45 * Math.cos(2 * Math.PI * (dayOfYear + 10)
> / 365.25);
> 
>         // Hour angle - sun's longitude changes 15 degrees per hour
>         var hourAngle = 15 * (timeOfDay - 12); // 0° at solar noon (12:00
> UTC)
> 
>         // Sun's subsolar point
>         var longitude = hourAngle;
>         var latitude = declination;
> 
>         // Normalize longitude to [-180, 180]
>         while (longitude > 180) longitude -= 360;
>         while (longitude < -180) longitude += 360;
> 
>         // debug
>         //console.log("[earthglobe]]: ", longitude);
>         //console.log("[earthglobe]]: ", latitude);
> 
>         return {
>             longitude: -longitude,
>             latitude: -latitude
>         };
>     }
> 
>     function getDayOfYear(date) {
>         var start = new Date(date.getFullYear(), 0, 0);
>         var diff = date - start;
>         return Math.floor(diff / (1000 * 60 * 60 * 24));
>     }
> }
> ```
> 
> [image: image.png]
> 
> 
> pt., 12 cze 2020 o 21:26 Piotr Frankowski <frankowski.piotrek at gmail.com>
> 
> napisał(a):
> > Thanks - good starting point for me. Your email is like 5 hours of
> > mentoring;) have a nice weekend
> > 
> > pt., 12 cze 2020 o 01:10 Friedrich W. H. Kossebau <kossebau at kde.org>
> > 
> > napisał(a):
> >> Hi Piotr,
> >> 
> >> Am Donnerstag, 11. Juni 2020, 20:49:57 CEST schrieb Piotr Frankowski:
> >> > Hello,
> >> > 
> >> > First of all,thanks for such great piece of software, which I am using
> >> 
> >> for
> >> 
> >> > 15 years. I would like to make small contribution - but I need little
> >> 
> >> help,
> >> 
> >> > a kind of mentoring or a plan and help at begin. I would like rewrite
> >> 
> >> KDE4
> >> 
> >> > app - plasma-wallpaper-globe, to KDE5 using QML. I think it is possible
> >> 
> >> to
> >> 
> >> > do - I am thinking, that I should create plasma-wallpaper plugin, which
> >> > uses Marbles Maps API.
> >> 
> >> ((quick reminder to speak with same terms: post-KDE4 there is no KDE5,
> >> things
> >> got split in cross-platform apps (for platforms like Plasma, Gnome,
> >> $OTHERLINUXSHELL, Windows, macOS, Android. HaikuOS, etc.), modular
> >> reusable Qt
> >> extensions (KDE Frameworks) and the actual workspace (Plasma).))
> >> 
> >> When it comes to the Globe plasma wallpaper, there actually has been a
> >> working
> >> patch. I know because I did it :) Though just for coding fun, did not
> >> plan to
> >> use it, so it died as review request because no-one pushed and no-one
> >> pulled.
> >> 
> >> It is up for adaption here, might still apply:
> >>     https://phabricator.kde.org/D11969
> >> > 
> >> > First questions:
> >> > - is there template for plasma-wallpaper-plugin?
> >> 
> >> Yes, the blog post you linked below is referencing one, and it does still
> >> exist.
> >> 
> >> > - is there tutorial for writing plasma-plugins?
> >> 
> >> Sadly Plasma developers are lacking here and need support. People
> >> learning are
> >> some of the best people to write documentation/tutorials while they lean,
> >> because they see all the problems and can mention them, so consider
> >> picking up
> >> that as side-task.
> >> 
> >> > - I have found some linke, are they actual:
> >> https://frinring.wordpress.com/2018/04/04/templates-to-create-your-own-pl
> >> asm>> 
> >> > a-wallpaper-plugin/
> >> 
> >> Should still apply (I just fixed some links now given you mentioned it
> >> and I
> >> found they were broken). Not tested though, but I would hope Plasma
> >> developers
> >> kept compatibility during Plasma 5 times ;)
> >> 
> >> > - I should learn QML and C++, right?
> >> 
> >> Yes. If you are completely new, best first walk yourself through all the
> >> Qt
> >> tutorials to get some first sense about things before you enter the
> >> partially
> >> rough world of developing for Plasma.
> >> See https://doc.qt.io/qt-5/qtexamplesandtutorials.html and make yourself
> >> familiar with Qt and QtQuick/Qml. And try to find some local people to
> >> talk
> >> and learn together in real life, that also helps (it did for me when I
> >> started).
> >> 
> >> Sorry, not available myself for mentoring.
> >> 
> >> Cheers
> >> Friedrich
> > 
> > --
> > Pozdrawiam
> > pf






More information about the Marble-devel mailing list