Open Shihira opened 6 years ago
PS: How I use this indicator mode
Hmmm, if you hadn't already written the code, I'd have recommended the kargos widget (https://store.kde.org/p/1173112/ | https://github.com/lipido/kargos).
Anyways, lets break down the PR.
Changing the min interval to 50ms. Not sure why I thought 1sec was the minimum. I do remember PlasmaCore.DataSource
having a hardcoded minimum though. We can confirm the shorter period works with:
date +%S.%N
watch -n 0.1 date +%S.%N
Oh right, now I remember why.
While DataEngine.cpp does have a hardcoded minimum of 20 times a second (50ms).
DataEngine's also have the ability to set a minimum, which the executable dataengine sets as 1000ms.
ExecutableEngine::ExecutableEngine(QObject* parent, const QVariantList& args)
: Plasma::DataEngine(parent, args)
{
setMinimumPollingInterval(1000);
}
However, my assumption was wrong. That 1000ms is how often it checks to see if the process is still running. It can "update" sooner if the process finishes in just ~10ms.
We can confirm this by using date +%S.%N
in the widget.
So nice catch, I should have tested that.
id: link_runner
=> id: linkRunner
, though actually, you don't need it at all since you're using it to open a url in the browser. Qt.openUrlExternally(link)
should work.units.devicePixelRatio
is necessary for HiDPI screens. Not sure why you removed it from font.pixelSize: 16 * units.devicePixelRatio
. Try testing with: QT_DEVICE_PIXEL_RATIO=2 QML_DISABLE_DISK_CACHE=true plasmoidviewer -a package`
ConfigSection.qml
as that's definitely neither the before and after of this diff are correct. I can fix that after the merge though. If you're wondering what's wrong, it's because it should be content.data
in default property alias _contentChildren: content.data
.
.data
accepts both .children
and .resources
.children
only accepts visual objects which extend Item
(Rectangle
/etc). If you pass something like (QtObject
/Connection
/`DataSource
) which doesn't have a item.parent
it'll break..data
property, but the "bugfix" workaround looping the .children
since only the visual Items have a parent property.I introduced linkRunner because I wanted to run some shell commands by clicking links (like launching ksysguard).
How are you formatting the "links"? <a href="ksysguard">KSysGuard</a>
?
Yes. Is that weird?
It's a hackish way to do it, but that's fine I guess. I'll probably be adding the following after the merge:
onLinkActivated: {
var urlStartRegex = /^\w+:\/\//
if (urlStartRegex.match(link)) {
Qt.openUrlExternally(link)
} else { // Assume it's a command
linkRunner.exec(link)
}
}
So that you don't need to prefix urls with xdg-open
like <a href="xdg-open http://google.com">