Index: package/contents/ui/CompactRepresentation.qml =================================================================== --- package/contents/ui/CompactRepresentation.qml +++ package/contents/ui/CompactRepresentation.qml @@ -48,6 +48,8 @@ property color redshiftColour: '#ff3c0b' property color brightnessColour: '#39a2ee' + property string versionString: 'N/A' + PlasmaCore.IconItem { id: customIcon anchors.fill: parent @@ -136,7 +138,11 @@ } } } - redshiftDS.connectedSources.push(redshiftOneTimeCommand) + if (parseFloat(versionString) >= 1.12) { + redshiftDS.connectedSources.push(redshiftOneTimeCommand + " -P") + } else { + redshiftDS.connectedSources.push(redshiftOneTimeCommand) + } } onClicked: { @@ -169,4 +175,19 @@ } } + PlasmaCore.DataSource { + id: getOptionsDS + engine: 'executable' + + connectedSources: ['redshift -V'] + + onNewData: { + connectedSources.length = 0 + if (data['exit code'] > 0) { + print('Error running redshift with command: ' + sourceName + ' ...stderr: ' + data.stderr) + return + } + versionString = data.stdout.split(' ')[1] + } + } } Index: package/contents/ui/main.qml =================================================================== --- package/contents/ui/main.qml +++ package/contents/ui/main.qml @@ -67,7 +67,7 @@ // - commands property string redshiftCommand: 'redshift' + locationCmdPart + modeCmdPart + ' -t ' + dayTemperature + ':' + nightTemperature + brightnessAndGamma + (smoothTransitions ? '' : ' -r') property string redshiftOneTimeBrightnessAndGamma: ' -b ' + (currentBrightness*0.01).toFixed(2) + ':' + (currentBrightness*0.01).toFixed(2) + ' -g ' + gammaR + ':' + gammaG + ':' + gammaB - property string redshiftOneTimeCommand: 'redshift -O ' + manualTemperature + redshiftOneTimeBrightnessAndGamma + ' -r' + property string redshiftOneTimeCommand: 'redshift -P -O ' + manualTemperature + redshiftOneTimeBrightnessAndGamma + ' -r' property string redshiftPrintCommand: 'LANG=C ' + redshiftCommand + ' -p' property bool inTray: (plasmoid.parent === null || plasmoid.parent.objectName === 'taskItemContainer')