Commit f4e03208 authored by Tanbir Jishan's avatar Tanbir Jishan 💬 Committed by Nate Graham
Browse files

applets/margins-separator: make smaller normally, and more visible in Edit mode

Margin separator by default has a large width which may not be desirable always
and it is also not directly related to its core functionality. Now it takes up
only 1px of space (the minimum amount) outside of Edit Mode, but expands and
becomes more visually obvious in Edit Mode.

BUG: 451164
BUG: 433475
FIXED-IN: 5.25
parent cb032194
Pipeline #155973 passed with stage
in 2 minutes and 31 seconds
......@@ -15,4 +15,5 @@ endif()
add_subdirectory(minimizeall)
add_subdirectory(showdesktop)
add_subdirectory(kimpanel)
add_subdirectory(margins-separator)
plasma_install_package(keyboardlayout org.kde.plasma.keyboardlayout)
plasma_install_package(package org.kde.plasma.marginsseparator)
add_subdirectory(plugin)
......@@ -10,9 +10,12 @@ import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.extras 2.0 as PlasmaExtras
Item {
Rectangle {
id: root
Layout.minimumWidth: units.largeSpacing
readonly property bool editMode : Plasmoid.nativeInterface.containment.editMode
color: editMode ? PlasmaCore.Theme.buttonFocusColor : "transparent" // So that user can identify the Plasmoid in edit mode
Layout.minimumWidth: editMode ? units.largeSpacing : 1 // We don't have zeroSpacing and assigning 0 does not work as well
Layout.preferredWidth: Layout.minimumWidth
Layout.maximumWidth: Layout.minimumWidth
......
kde_enable_exceptions()
add_definitions(-DTRANSLATION_DOMAIN=\"marginSeparator\")
kcoreaddons_add_plugin(org.kde.plasma.marginsseparator SOURCES marginSeparator.cpp INSTALL_NAMESPACE "plasma/applets")
target_link_libraries(org.kde.plasma.marginsseparator Qt::Gui Qt::Core Qt::Qml Qt::Quick KF5::Plasma KF5::PlasmaQuick KF5::I18n)
/*
SPDX-FileCopyrightText: 2020 Tanbir Jishan <tantalising007@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "marginSeparator.h"
#include <QDebug>
#include <QProcess>
#include <QtQml>
#include <Plasma/Containment>
#include <Plasma/Corona>
#include <PlasmaQuick/AppletQuickItem>
MarginSeparator::MarginSeparator(QObject *parent, const KPluginMetaData &data, const QVariantList &args)
: Plasma::Applet(parent, data, args)
{
}
PlasmaQuick::AppletQuickItem *MarginSeparator::containmentGraphicObject() const
{
return containment()->property("_plasma_graphicObject").value<PlasmaQuick::AppletQuickItem *>();
}
K_PLUGIN_CLASS_WITH_JSON(MarginSeparator, "../package/metadata.json")
#include "marginSeparator.moc"
/*
SPDX-FileCopyrightText: 2022 Tanbir Jishan <tantalising007@gmail.com>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <Plasma/Applet>
#include <PlasmaQuick/AppletQuickItem>
namespace Plasma
{
class Containment;
}
class MarginSeparator;
class MarginSeparator : public Plasma::Applet
{
Q_OBJECT
Q_PROPERTY(PlasmaQuick::AppletQuickItem *containment READ containmentGraphicObject CONSTANT)
public:
MarginSeparator(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
PlasmaQuick::AppletQuickItem *containmentGraphicObject() const;
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment