Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions contents/config/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,26 @@
<label>Sets where the indicator should be. 0 = Top, 1 = Bottom, 2 = Left, 3 = Right</label>
<default>0</default>
</entry>
<entry name="usePlasmaStyle" type="Enum">
<label>Enable both Plasma Style and custom indicators. 0 = Only Custom Indicators, 1 = Both.</label>
<default>0</default>
</entry>
<entry name="indicatorStyle" type="Enum">
<label>Select between 1 of 3 indicator styles. 0 = Metro, 1 = Cliora, 2 = Dots</label>
<default>0</default>
</entry>
<entry name="indicatorLimit" type="Int">
<label>Set the maximum number of running indicators to display.</label>
<default>4</default>
</entry>
<entry name="indicatorDesaturate" type="Bool">
<label>Desaturate the indicator when minimized</label>
<default>false</default>
</entry>
<entry name="indicatorGrow" type="Bool">
<label>Shrink the indicator when minimized</label>
<default>false</default>
</entry>
<entry name="indicatorGrowFactor" type="Int">
<label>Amount to grow the indicator by</label>
<default>100</default>
</entry>
<entry name="indicatorSize" type="Int">
<label>Set the size of the indicator in pixels</label>
<default>4</default>
Expand Down
55 changes: 55 additions & 0 deletions contents/ui/ConfigIndicators.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Kirigami.FormLayout {
property alias cfg_indicatorReverse: indicatorReverse.checked
property alias cfg_indicatorOverride: indicatorOverride.checked
property alias cfg_indicatorStyle: indicatorStyle.currentIndex
property alias cfg_indicatorLimit: indicatorLimit.value
property alias cfg_indicatorDesaturate: indicatorDesaturate.checked
property alias cfg_indicatorGrow: indicatorGrow.checked
property alias cfg_indicatorGrowFactor: indicatorGrowFactor.value
property alias cfg_indicatorSize: indicatorSize.value
property alias cfg_indicatorLength: indicatorLength.value
property alias cfg_indicatorRadius: indicatorRadius.value
Expand Down Expand Up @@ -93,6 +97,57 @@ Kirigami.FormLayout {
]
}

SpinBox {
enabled: indicatorsEnabled.currentIndex
id: indicatorLimit
Kirigami.FormData.label: i18n("Indicator Limit:")
from: 1
to: 10
}

CheckBox {
enabled: indicatorsEnabled.currentIndex
id: indicatorDesaturate
Kirigami.FormData.label: i18n("Minimize Options:")
text: i18n("Desaturate")
}

CheckBox {
enabled: indicatorsEnabled.currentIndex
id: indicatorGrow
text: i18n("Shrink when minimized")
}

SpinBox {
id: indicatorGrowFactor
enabled: indicatorsEnabled.currentIndex
visible: indicatorGrow.checked
from: 100
to: 10 * 100
stepSize: 25
Kirigami.FormData.label: i18n("Growth/Shrink factor:")

property int decimals: 2
property real realValue: value / 100

validator: DoubleValidator {
bottom: Math.min(indicatorGrowFactor.from, indicatorGrowFactor.to)
top: Math.max(indicatorGrowFactor.from, indicatorGrowFactor.to)
}

textFromValue: function(value, locale) {
return Number(value / 100).toLocaleString(locale, 'f', indicatorGrowFactor.decimals)
}

valueFromText: function(text, locale) {
return Number.fromLocaleString(locale, text) * 100
}
}

Item {
Kirigami.FormData.isSection: true
}

SpinBox {
enabled: indicatorsEnabled.currentIndex
id: indicatorSize
Expand Down
28 changes: 22 additions & 6 deletions contents/ui/Task.qml
Original file line number Diff line number Diff line change
Expand Up @@ -412,16 +412,20 @@ MouseArea {
}
return Math.min((task.childCount === 0) ? 1 : task.childCount, maxStates);
}
readonly property int maxStates: isMetro ? 2 : 4
readonly property int maxStates: plasmoid.configuration.indicatorLimit

Rectangle{
id: stateRect
Behavior on height { PropertyAnimation {} }
Behavior on width { PropertyAnimation {} }
Behavior on color { PropertyAnimation {} }
Behavior on radius { PropertyAnimation {} }
readonly property color decoColor: frame.dominantColor
readonly property int maxStates: isMetro ? 2 : 4
readonly property int maxStates: plasmoid.configuration.indicatorLimit
readonly property bool isFirst: index === 0
readonly property int adjust: plasmoid.configuration.indicatorShrink
readonly property int indicatorLength: plasmoid.configuration.indicatorLength
readonly property int spacing: PlasmaCore.Units.smallSpacing /2
readonly property int spacing: PlasmaCore.Units.smallSpacing
readonly property bool isVertical: {
if(plasmoid.formFactor === PlasmaCore.Types.Vertical && !plasmoid.configuration.indicatorOverride)
return true;
Expand All @@ -441,6 +445,7 @@ MouseArea {
var parentSize = !isVertical ? frame.width : frame.height;
var indicatorComputedSize;
var adjustment = isFirst ? adjust : 0
var parentSpacingAdjust = task.childCount >= 1 && maxStates >= 2 ? spacing * 3 : 0 //Spacing fix for multiple items
if(plasmoid.configuration.indicatorDominantColor){
colorEval = decoColor
}
Expand All @@ -451,15 +456,22 @@ MouseArea {
colorEval = plasmoid.configuration.indicatorCustomColor
}
if(isFirst){//compute the size
var growFactor = plasmoid.configuration.indicatorGrowFactor / 100
if(plasmoid.configuration.indicatorGrow && task.state === "minimized") {
var mainSize = indicatorLength * growFactor;
}
else{
var mainSize = (parentSize + parentSpacingAdjust);
}
switch(plasmoid.configuration.indicatorStyle){
case 0:
indicatorComputedSize = parentSize - (Math.min(task.childCount, maxStates) * ((spacing + indicatorLength) / 2) + adjust)
indicatorComputedSize = mainSize - (Math.min(task.childCount, maxStates === 1 ? 0 : maxStates) * (spacing + indicatorLength)) - adjust
break
case 1:
indicatorComputedSize = parentSize - (Math.min(task.childCount, maxStates) * ((spacing + indicatorLength)) + adjust)
indicatorComputedSize = mainSize - (Math.min(task.childCount, maxStates === 1 ? 0 : maxStates) * (spacing + indicatorLength)) - adjust
break
case 2:
indicatorComputedSize = indicatorLength
indicatorComputedSize = plasmoid.configuration.indicatorGrow && task.state !== "minimized" ? indicatorLength * growFactor : indicatorLength
break
default:
break
Expand All @@ -476,6 +488,10 @@ MouseArea {
width = plasmoid.configuration.indicatorSize
height = indicatorComputedSize
}
if(plasmoid.configuration.indicatorDesaturate && task.state === "minimized") {
var colorHSL = hexToHSL(colorEval)
colorCalc = Qt.hsla(colorHSL.h, 0.2, 0.6, 1)
}
if(!isFirst && plasmoid.configuration.indicatorStyle === 0) {//Metro specific handling
colorCalc = Qt.darker(colorEval, 1.2)
}
Expand Down