diff --git a/app/view/effects.cpp b/app/view/effects.cpp
index 6f598e3ee..8e70e6347 100644
--- a/app/view/effects.cpp
+++ b/app/view/effects.cpp
@@ -60,6 +60,7 @@ void Effects::init()
});
connect(m_view, &Latte::View::alignmentChanged, this, &Effects::updateEnabledBorders);
+ connect(m_view, &Latte::View::screenEdgeMarginChanged, this, &Effects::updateEnabledBorders);
connect(m_view, &Latte::View::behaveAsPlasmaPanelChanged, this, &Effects::updateEffects);
connect(m_view, &Latte::View::behaveAsPlasmaPanelChanged, this, &Effects::updateShadows);
connect(m_view, &Latte::View::configWindowGeometryChanged, this, &Effects::updateMask);
@@ -489,25 +490,27 @@ void Effects::updateEnabledBorders()
Plasma::FrameSvg::EnabledBorders borders = Plasma::FrameSvg::AllBorders;
- switch (m_view->location()) {
- case Plasma::Types::TopEdge:
- borders &= ~Plasma::FrameSvg::TopBorder;
- break;
+ if (!m_view->screenEdgeMarginEnabled()) {
+ switch (m_view->location()) {
+ case Plasma::Types::TopEdge:
+ borders &= ~Plasma::FrameSvg::TopBorder;
+ break;
- case Plasma::Types::LeftEdge:
- borders &= ~Plasma::FrameSvg::LeftBorder;
- break;
+ case Plasma::Types::LeftEdge:
+ borders &= ~Plasma::FrameSvg::LeftBorder;
+ break;
- case Plasma::Types::RightEdge:
- borders &= ~Plasma::FrameSvg::RightBorder;
- break;
+ case Plasma::Types::RightEdge:
+ borders &= ~Plasma::FrameSvg::RightBorder;
+ break;
- case Plasma::Types::BottomEdge:
- borders &= ~Plasma::FrameSvg::BottomBorder;
- break;
+ case Plasma::Types::BottomEdge:
+ borders &= ~Plasma::FrameSvg::BottomBorder;
+ break;
- default:
- break;
+ default:
+ break;
+ }
}
if ((m_view->location() == Plasma::Types::LeftEdge || m_view->location() == Plasma::Types::RightEdge)) {
diff --git a/app/view/view.cpp b/app/view/view.cpp
index e68994b24..0eee2f354 100644
--- a/app/view/view.cpp
+++ b/app/view/view.cpp
@@ -809,6 +809,26 @@ void View::setOffset(int offset)
emit offsetChanged();
}
+bool View::screenEdgeMarginEnabled() const
+{
+ return (m_screenEdgeMargin > -1);
+}
+
+int View::screenEdgeMargin() const
+{
+ return m_screenEdgeMargin;
+}
+
+void View::setScreenEdgeMargin(int margin)
+{
+ if (m_screenEdgeMargin == margin) {
+ return;
+ }
+
+ m_screenEdgeMargin = margin;
+ emit screenEdgeMarginChanged();
+}
+
int View::fontPixelSize() const
{
return m_fontPixelSize;
diff --git a/app/view/view.h b/app/view/view.h
index 24d106197..2b5e1d84d 100644
--- a/app/view/view.h
+++ b/app/view/view.h
@@ -101,6 +101,8 @@ class View : public PlasmaQuick::ContainmentView
Q_PROPERTY(int maxThickness READ maxThickness WRITE setMaxThickness NOTIFY maxThicknessChanged)
Q_PROPERTY(int normalThickness READ normalThickness WRITE setNormalThickness NOTIFY normalThicknessChanged)
Q_PROPERTY(int offset READ offset WRITE setOffset NOTIFY offsetChanged)
+ Q_PROPERTY(int screenEdgeMargin READ screenEdgeMargin WRITE setScreenEdgeMargin NOTIFY screenEdgeMarginChanged)
+
Q_PROPERTY(float maxLength READ maxLength WRITE setMaxLength NOTIFY maxLengthChanged)
@@ -160,6 +162,8 @@ public:
bool isTouchingTopViewAndIsBusy() const;
void setIsTouchingTopViewAndIsBusy(bool touchAndBusy);
+ bool screenEdgeMarginEnabled() const;
+
float maxLength() const;
void setMaxLength(float length);
@@ -178,6 +182,9 @@ public:
int offset() const;
void setOffset(int offset);
+ int screenEdgeMargin() const;
+ void setScreenEdgeMargin(int margin);
+
int alignment() const;
void setAlignment(int alignment);
@@ -278,6 +285,7 @@ signals:
void offsetChanged();
void onPrimaryChanged();
void positionerChanged();
+ void screenEdgeMarginChanged();
void screenGeometryChanged();
void typeChanged();
void visibilityChanged();
@@ -333,6 +341,7 @@ private:
int m_maxThickness{24};
int m_normalThickness{24};
int m_offset{0};
+ int m_screenEdgeMargin{-1};
float m_maxLength{1};
Types::Alignment m_alignment{Types::Center};
diff --git a/containment/package/contents/config/main.xml b/containment/package/contents/config/main.xml
index a2e2d55f6..82909756b 100644
--- a/containment/package/contents/config/main.xml
+++ b/containment/package/contents/config/main.xml
@@ -53,6 +53,10 @@
-1
+
+ -1
+
+
false
diff --git a/containment/package/contents/ui/PanelBox.qml b/containment/package/contents/ui/PanelBox.qml
index 90a146dfd..933b57faa 100644
--- a/containment/package/contents/ui/PanelBox.qml
+++ b/containment/package/contents/ui/PanelBox.qml
@@ -45,6 +45,8 @@ Item{
property int animationTime: 6*root.durationTime*units.shortDuration
+ property int screenEdgeMargin: root.screenEdgeMarginEnabled ? root.screenEdgeMargin - shadowsSvgItem.screenEdgeShadow : 0
+
property int lengthMargins: {
return root.isVertical ? shadowsSvgItem.marginsHeight : shadowsSvgItem.marginsWidth
}
@@ -180,6 +182,22 @@ Item{
NumberAnimation { duration: 0 }
}
+ property int screenEdgeShadow: {
+ if (imagePath === "" || !root.screenEdgeMarginEnabled) {
+ return 0;
+ }
+
+ if (plasmoid.location === PlasmaCore.Types.LeftEdge) {
+ return margins.left;
+ } else if (plasmoid.location === PlasmaCore.Types.RightEdge) {
+ return margins.right;
+ } else if (plasmoid.location === PlasmaCore.Types.TopEdge) {
+ return margins.top;
+ } else if (plasmoid.location === PlasmaCore.Types.BottomEdge) {
+ return margins.bottom;
+ }
+ }
+
property int marginsWidth: {
if (imagePath === "") {
return 0;
@@ -625,7 +643,7 @@ Item{
}
PropertyChanges{
target: barLine
- anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:0; anchors.bottomMargin:0;
+ anchors.leftMargin: barLine.screenEdgeMargin; anchors.rightMargin:0; anchors.topMargin:0; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: (root.panelAlignment === Latte.Types.Center ? root.offset : 0);
}
},
@@ -644,7 +662,7 @@ Item{
}
PropertyChanges{
target: barLine
- anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:root.offset; anchors.bottomMargin:0;
+ anchors.leftMargin: barLine.screenEdgeMargin; anchors.rightMargin:0; anchors.topMargin:root.offset; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
@@ -663,7 +681,7 @@ Item{
}
PropertyChanges{
target: barLine
- anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:0; anchors.bottomMargin:root.offset;
+ anchors.leftMargin: barLine.screenEdgeMargin; anchors.rightMargin:0; anchors.topMargin:0; anchors.bottomMargin:root.offset;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
@@ -682,7 +700,7 @@ Item{
}
PropertyChanges{
target: barLine
- anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:0; anchors.bottomMargin:0;
+ anchors.leftMargin: 0; anchors.rightMargin: barLine.screenEdgeMargin; anchors.topMargin:0; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: (root.panelAlignment === Latte.Types.Center ? root.offset : 0);
}
},
@@ -700,7 +718,7 @@ Item{
}
PropertyChanges{
target: barLine
- anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:root.offset; anchors.bottomMargin:0;
+ anchors.leftMargin: 0; anchors.rightMargin: barLine.screenEdgeMargin; anchors.topMargin:root.offset; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
@@ -718,7 +736,7 @@ Item{
}
PropertyChanges{
target: barLine
- anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:0; anchors.bottomMargin:root.offset;
+ anchors.leftMargin: 0; anchors.rightMargin: barLine.screenEdgeMargin; anchors.topMargin:0; anchors.bottomMargin:root.offset;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
@@ -737,7 +755,7 @@ Item{
}
PropertyChanges{
target: barLine
- anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:0; anchors.bottomMargin:0;
+ anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:0; anchors.bottomMargin: barLine.screenEdgeMargin;
anchors.horizontalCenterOffset: (root.panelAlignment === Latte.Types.Center ? root.offset : 0); anchors.verticalCenterOffset: 0;
}
},
@@ -757,7 +775,7 @@ Item{
}
PropertyChanges{
target: barLine
- anchors.leftMargin: root.offset; anchors.rightMargin:0; anchors.topMargin:0; anchors.bottomMargin:0;
+ anchors.leftMargin: root.offset; anchors.rightMargin:0; anchors.topMargin:0; anchors.bottomMargin: barLine.screenEdgeMargin;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
@@ -778,7 +796,7 @@ Item{
}
PropertyChanges{
target: barLine
- anchors.leftMargin: 0; anchors.rightMargin:root.offset; anchors.topMargin:0; anchors.bottomMargin:0;
+ anchors.leftMargin: 0; anchors.rightMargin:root.offset; anchors.topMargin:0; anchors.bottomMargin: barLine.screenEdgeMargin;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
@@ -797,7 +815,7 @@ Item{
}
PropertyChanges{
target: barLine
- anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin:0; anchors.bottomMargin:0;
+ anchors.leftMargin: 0; anchors.rightMargin:0; anchors.topMargin: barLine.screenEdgeMargin; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: (root.panelAlignment === Latte.Types.Center ? root.offset : 0); anchors.verticalCenterOffset: 0;
}
},
@@ -817,7 +835,7 @@ Item{
}
PropertyChanges{
target: barLine
- anchors.leftMargin: root.offset; anchors.rightMargin:0; anchors.topMargin:0; anchors.bottomMargin:0;
+ anchors.leftMargin: root.offset; anchors.rightMargin:0; anchors.topMargin: barLine.screenEdgeMargin; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
},
@@ -837,7 +855,7 @@ Item{
}
PropertyChanges{
target: barLine
- anchors.leftMargin: 0; anchors.rightMargin:root.offset; anchors.topMargin:0; anchors.bottomMargin:0;
+ anchors.leftMargin: 0; anchors.rightMargin:root.offset; anchors.topMargin: barLine.screenEdgeMargin; anchors.bottomMargin:0;
anchors.horizontalCenterOffset: 0; anchors.verticalCenterOffset: 0;
}
}
diff --git a/containment/package/contents/ui/VisibilityManager.qml b/containment/package/contents/ui/VisibilityManager.qml
index 724f16c59..b84d59645 100644
--- a/containment/package/contents/ui/VisibilityManager.qml
+++ b/containment/package/contents/ui/VisibilityManager.qml
@@ -175,6 +175,13 @@ Item{
value: plasmoid.configuration.offset
}
+ Binding{
+ target: latteView
+ property: "screenEdgeMargin"
+ when: latteView
+ value: plasmoid.configuration.screenEdgeMargin
+ }
+
Binding{
target: latteView
property: "alignment"
diff --git a/containment/package/contents/ui/main.qml b/containment/package/contents/ui/main.qml
index 38080600e..2acee8e60 100644
--- a/containment/package/contents/ui/main.qml
+++ b/containment/package/contents/ui/main.qml
@@ -387,6 +387,9 @@ Item {
}
property int thickMargin: thickMarginFactor * root.iconSize
+ property bool screenEdgeMarginEnabled: plasmoid.configuration.screenEdgeMargin >= 0
+ property int screenEdgeMargin: plasmoid.configuration.screenEdgeMargin <=0 ? 0 : plasmoid.configuration.screenEdgeMargin
+
//! thickness margins are always two and equal in order for items
//! to be always correctly centered
property int thickMargins: 2 * thickMargin
diff --git a/shell/package/contents/configuration/pages/AppearanceConfig.qml b/shell/package/contents/configuration/pages/AppearanceConfig.qml
index 89babe6e2..195117b9a 100644
--- a/shell/package/contents/configuration/pages/AppearanceConfig.qml
+++ b/shell/package/contents/configuration/pages/AppearanceConfig.qml
@@ -585,6 +585,44 @@ PlasmaComponents.Page {
readonly property int currentValue: Math.max(thickMarginSlider.minimumInternalValue, thickMarginSlider.value)
}
}
+
+ RowLayout {
+ Layout.minimumWidth: dialog.optionsWidth
+ Layout.maximumWidth: Layout.minimumWidth
+ spacing: units.smallSpacing
+ enabled: !plasmoid.configuration.shrinkThickMargins
+
+ PlasmaComponents.Label {
+ text: i18n("Screen")
+ horizontalAlignment: Text.AlignLeft
+ }
+
+ LatteComponents.Slider {
+ id: screenEdgeMarginSlider
+ Layout.fillWidth: true
+
+ value: plasmoid.configuration.screenEdgeMargin
+ from: -1
+ to: 25
+ stepSize: 1
+ wheelEnabled: false
+
+ onPressedChanged: {
+ if (!pressed) {
+ plasmoid.configuration.screenEdgeMargin = value;
+ }
+ }
+ }
+
+ PlasmaComponents.Label {
+ text: currentValue < 0 ? "---" : i18nc("number in pixels, e.g. 85 px.","%0 px.").arg(currentValue)
+ horizontalAlignment: Text.AlignRight
+ Layout.minimumWidth: theme.mSize(theme.defaultFont).width * 4
+ Layout.maximumWidth: theme.mSize(theme.defaultFont).width * 4
+
+ readonly property int currentValue: screenEdgeMarginSlider.value
+ }
+ }
}
}
//! END: Margins