Skip to content

Commit

Permalink
Merge branch 'master' into tweaks5.24
Browse files Browse the repository at this point in the history
  • Loading branch information
psifidotos committed Feb 12, 2022
2 parents 8597116 + 11a3ad3 commit 3ad2f3a
Show file tree
Hide file tree
Showing 14 changed files with 681 additions and 127 deletions.
51 changes: 49 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,49 @@
# plasma-systray-latte-tweaks
Latte tweaks for Plasma systray
# Plasma SysTray Tweaks for Latte

Plasma systray is too important to be forked and maintained and this is why I am not taking up this task. On the other hand there is no real reason to not present some Latte specific optimisations. All the changes and improvements introduced are only in qml side and as such it might be easier to maintain when plasma system tray evolves between different plasma versions. The reasons that these tweaks were needed are the following:

* Plasma systray is not using the Latte AutoColoring introduced with v0.9 and as such all applets in the systray are painted with no exceptions. With these tweaks the user can now choose which applets/tasks will be auto-colored in the systray or not; by default all applets are auto-colored
* As a gift, an icons spacing option is included that can be accessed from systray setttings -> Appearance tab

<p align="center">
<img src="https://i.imgur.com/NBjthiP.gif" width="530"><br/>
<i>systray auto-coloring demonstration</i>
</p>

<p align="center">
<img src="https://i.imgur.com/rVKoCM8.png" width="580"><br/>
<i>Auto-Color option</i>
</p>

<p align="center">
<img src="https://i.imgur.com/F6F8wBJ.png" width="580"><br/>
<i>icons margin in Apperance tab</i>
</p>


# Install

1. Copy folders `org.kde.plasma.systemtray` and `org.kde.plasma.private.systemtray` at your user folder: `~/.local/share/plasma/plasmoids`
2. Restart Latte


# Update

1. Replace folders the two folders installed at `~/.local/share/plasma/plasmoids` with their newer counter parts
2. Restart Latte


# Remove

1. Remove the two installed folders from your `~/.local/share/plasma/plasmoids` folder
2. Restart Latte

# Warning

* Use with care and in case your systray breaks (it can happen during plasma upgrades) just remove **tweaks** from your `~/.local/share/plasma/plasmoids` folder.

# Maintenance

* The current code is using Plasma v5.20 and I will try to update it when new plasma versions are released with changes in their QML code. That means of course that any improvements in plasma qml code will not be available if you dont remove the **tweaks** or update with newer versions of tweaked files.

* If someone wants to check out what the tweaks are changing for safety reasons etc, the [tweaks](https://github.com/psifidotos/plasma-systray-latte-tweaks/commits/tweaks) branch holds all the relevant commits.
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ ConfigModel {
name: i18n("Entries")
icon: "preferences-desktop-notification"
source: "ConfigEntries.qml"
}
}
}
42 changes: 41 additions & 1 deletion org.kde.plasma.private.systemtray/contents/config/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<label>All items that are shown. It's a comma-separated string list of unique identifiers that are either plasmoid plugin ids or StatusNotifier ids.</label>
<default></default>
</entry>
<entry name="showAllItems" type="bool">
<entry name="showAllItems" type="Bool">
<label>If true, all systray entries will be always in the main area, outside the popup.</label>
<default>false</default>
</entry>
Expand All @@ -33,6 +33,46 @@
<label>Whether the popup should remain open when another window is activated</label>
<default>false</default>
</entry>

<entry name="iconsSpacing" type="Int">
<label>Spacing between systray icons in pixels</label>
<default>0</default>
</entry>
<entry name="canFillThickness" type="Bool">
<label>items can use all panel thickness</label>
<default>false</default>
</entry>

<entry name="hasBackgroundLayer" type="Bool">
<label>Add a background layer to items</label>
<default>false</default>
</entry>
<entry name="hasReversedColors" type="Bool">
<label>Whether reversed color pallete will be used for icons in the systray</label>
<default>false</default>
</entry>
<entry name="reversedBackgroundRadius" type="Int">
<label>Radius of reversed background</label>
<default>30</default>
</entry>
<entry name="reversedBackgroundOpacity" type="Int">
<label>Opacity of reversed background</label>
<default>70</default>
</entry>

<entry name="maxLines" type="Int">
<label>Maximum Lines to use for the Grid</label>
<default>2</default>
</entry>

<entry name="internalMainHighlightEnabled" type="Bool">
<label>internal main highlight state</label>
<default>true</default>
</entry>
<entry name="blockedAutoColorItems" type="StringList">
<label>All items that are not auto-colored based on Latte provided color palette. It's a comma-separated string list of unique identifiers that are either plasmoid plugin ids or StatusNotifier ids.</label>
<default></default>
</entry>
</group>

</kcfg>
Expand Down
43 changes: 41 additions & 2 deletions org.kde.plasma.private.systemtray/contents/ui/ConfigEntries.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ ColumnLayout {
property var cfg_hiddenItems: []
property var cfg_extraItems: []
property alias cfg_showAllItems: showAllCheckBox.checked
property var cfg_blockedAutoColorItems: []

QQC2.CheckBox {
id: showAllCheckBox
Expand Down Expand Up @@ -59,8 +60,10 @@ ColumnLayout {
ListView {
id: itemsList

property var visibilityColumnWidth: Kirigami.Units.gridUnit
property var keySequenceColumnWidth: Kirigami.Units.gridUnit
property var autoColorColumnWidth: units.gridUnit
property var visibilityColumnWidth: units.gridUnit
property var keySequenceColumnWidth: units.gridUnit


clip: true

Expand All @@ -82,6 +85,12 @@ ColumnLayout {
Layout.preferredWidth: itemsList.visibilityColumnWidth
Component.onCompleted: itemsList.visibilityColumnWidth = Math.max(implicitWidth, itemsList.visibilityColumnWidth)
}
Kirigami.Heading {
text: i18n("Auto Color")
level: 2
Layout.preferredWidth: itemsList.autoColorColumnWidth
Component.onCompleted: itemsList.autoColorColumnWidth = Math.max(implicitWidth, itemsList.autoColorColumnWidth)
}
Kirigami.Heading {
text: i18n("Keyboard Shortcut")
level: 2
Expand Down Expand Up @@ -237,6 +246,36 @@ ColumnLayout {
}
}
}

Item{
implicitWidth: itemsList.autoColorColumnWidth + 10
height: autoColorChkBox.height

QQC2.CheckBox {
id: autoColorChkBox
anchors.centerIn: parent

checked: cfg_blockedAutoColorItems.indexOf(model.itemId) === -1

onToggled: {
var blockedIndex = cfg_blockedAutoColorItems.indexOf(model.itemId);
var updated = false;

if (checked && blockedIndex >= 0) {
cfg_blockedAutoColorItems.splice(blockedIndex, 1);
updated = true;
} else if (!checked && blockedIndex === -1) {
cfg_blockedAutoColorItems.push(model.itemId);
updated = true;
}

if (updated) {
iconsPage.configurationChanged();
}
}
}
}

KQC.KeySequenceItem {
id: keySequenceItem
Layout.minimumWidth: itemsList.keySequenceColumnWidth
Expand Down
104 changes: 101 additions & 3 deletions org.kde.plasma.private.systemtray/contents/ui/ConfigGeneral.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import QtQuick 2.14
import QtQuick.Controls 1.0 as QtControls
import QtQuick.Controls 2.14 as QQC2
import QtQuick.Layouts 1.13

Expand All @@ -12,8 +13,19 @@ import org.kde.plasma.core 2.1 as PlasmaCore
import org.kde.kirigami 2.13 as Kirigami

ColumnLayout {
id: generalPage
property bool cfg_scaleIconsToFit

property alias cfg_canFillThickness: canFillThicknessChk.checked
property alias cfg_hasBackgroundLayer: hasBackgroundLayerChk.checked
property alias cfg_hasReversedColors: reversedColorsChk.checked
property alias cfg_maxLines: maxLinesSpn.value
property alias cfg_reversedBackgroundRadius: reversedBackgroundRadiusSlider.value
property alias cfg_reversedBackgroundOpacity: reversedBackgroundOpacitySlider.value
property alias cfg_iconsSpacing: iconsSpacing.value
property alias cfg_internalMainHighlightEnabled: internalHighlightChk.checked


Kirigami.FormLayout {
Layout.fillHeight: true

Expand All @@ -32,10 +44,96 @@ ColumnLayout {
checked: cfg_scaleIconsToFit == true || Kirigami.Settings.tabletMode
onToggled: cfg_scaleIconsToFit = checked
}

QQC2.Label {
visible: Kirigami.Settings.tabletMode
text: i18n("Automatically enabled when in tablet mode")
font: PlasmaCore.Theme.smallestFont
text: " "
}

QtControls.SpinBox{
id: iconsSpacing
minimumValue: 0
maximumValue: 36 //in pixels

suffix: i18nc("pixels","px.")

Kirigami.FormData.label: i18n("Spacing:")
}

QQC2.Label {
text: " "
}

RowLayout {
Kirigami.FormData.label: i18n("Maximum:")
enabled: !cfg_scaleIconsToFit

QtControls.SpinBox{
id: maxLinesSpn
minimumValue: 1
maximumValue: 5
}

QtControls.Label {
text: maxLinesSpn.value<=1 ? i18nc("one line", "line is used to distribute applets") : i18nc("multiple lines","lines are used to distribute applets")
}
}


QQC2.Label {
text: " "
}

QtControls.CheckBox {
id: hasBackgroundLayerChk
text: i18n("Add background layer to items")
Kirigami.FormData.label: i18n("Background:")
}

QtControls.CheckBox {
id: reversedColorsChk
enabled: cfg_hasBackgroundLayer
text: i18n("Reversed color palette for items")
}

RowLayout {
enabled: cfg_hasBackgroundLayer
QQC2.Slider {
id: reversedBackgroundRadiusSlider
from: 0
to: 50
}
QtControls.Label {
text: Math.round(cfg_reversedBackgroundRadius) + "% radius"
enabled: reversedBackgroundRadiusSlider.enabled
}
}

RowLayout {
enabled: cfg_hasBackgroundLayer
QQC2.Slider {
id: reversedBackgroundOpacitySlider
from: 0
to: 100
}
QtControls.Label {
text: Math.round(cfg_reversedBackgroundOpacity) + "% opacity"
enabled: reversedBackgroundOpacitySlider.enabled
}
}

QQC2.Label {
text: " "
}

QtControls.CheckBox {
id: canFillThicknessChk
text: i18n("Fill all panel thickness with no margins")
Kirigami.FormData.label: i18n("Behavior:")
}

QtControls.CheckBox {
id: internalHighlightChk
text: i18n("Internal highlight for main popup window is enabled")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,19 @@ PlasmaCore.FrameSvgItem {
id: currentItemHighLight

property int location

property bool animationEnabled: true
property var highlightedItem: null

z: -1 // always draw behind icons
width: parent.width
height: parent.height
opacity: parent && systemTrayState.expanded && (plasmoid.configuration.internalMainHighlightEnabled || isAppletExpanded) ? 1 : 0

readonly property bool isAppletExpanded: systemTrayState.activeApplet
&& systemTrayState.activeApplet.parent
&& systemTrayState.activeApplet.parent.inVisibleLayout


property var containerMargins: {
let item = currentItemHighLight;
while (item.parent) {
Expand All @@ -27,9 +36,6 @@ PlasmaCore.FrameSvgItem {
return undefined;
}

z: -1 // always draw behind icons
opacity: systemTrayState.expanded ? 1 : 0

imagePath: "widgets/tabbar"
prefix: {
var prefix = ""
Expand Down
Loading

0 comments on commit 3ad2f3a

Please sign in to comment.