Reduce keyboard switcher padding

This commit is contained in:
wackyideas 2024-01-30 21:22:41 +01:00
parent a5493fc8a8
commit 7024ed44fb

View file

@ -4,6 +4,7 @@
*/ */
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Layouts 1.1
import Qt.labs.platform 1.1 import Qt.labs.platform 1.1
import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.core 2.0 as PlasmaCore
@ -27,13 +28,18 @@ Item {
id: panelSvg id: panelSvg
visible: false visible: false
imagePath: "widgets/panel-background" imagePath: "widgets/panel-background"
} }
Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
Plasmoid.compactRepresentation: KeyboardLayoutSwitcher { Plasmoid.fullRepresentation: KeyboardLayoutSwitcher {
id: keySwitcher id: keySwitcher
property int widgetWidth: 24 * PlasmaCore.Units.devicePixelRatio
Layout.minimumWidth: widgetWidth
Layout.maximumWidth: widgetWidth
Layout.preferredWidth: widgetWidth
Plasmoid.toolTipSubText: layoutNames.longName Plasmoid.toolTipSubText: layoutNames.longName
Plasmoid.status: hasMultipleKeyboardLayouts ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.HiddenStatus Plasmoid.status: hasMultipleKeyboardLayouts ? PlasmaCore.Types.ActiveStatus : PlasmaCore.Types.HiddenStatus
@ -83,7 +89,9 @@ Item {
text: layoutNames.displayName || layoutNames.shortName text: layoutNames.displayName || layoutNames.shortName
visible: !icon.visible visible: !icon.visible
anchors.fill: parent anchors.fill: parent
anchors.margins: PlasmaCore.Units.smallSpacing*2 //anchors.margins: PlasmaCore.Units.smallSpacing*2
anchors.bottomMargin: PlasmaCore.Units.smallSpacing*2
anchors.topMargin: PlasmaCore.Units.smallSpacing*2 - PlasmaCore.Units.smallSpacing/2
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
fontSizeMode: Text.Fit fontSizeMode: Text.Fit
@ -93,11 +101,13 @@ Item {
font.pointSize: height font.pointSize: height
font.capitalization: Font.AllUppercase font.capitalization: Font.AllUppercase
} }
MouseArea { MouseArea {
id: ma id: ma
property int margin: PlasmaCore.Units.smallSpacing/2+((0.4*keySwitcher.height) - 9)
anchors.fill: parent anchors.fill: parent
anchors.margins: PlasmaCore.Units.smallSpacing+((0.3*keySwitcher.height) - 6.8) anchors.topMargin: margin
anchors.bottomMargin: margin
hoverEnabled: true hoverEnabled: true
propagateComposedEvents: true propagateComposedEvents: true
onClicked: { onClicked: {
@ -108,7 +118,8 @@ Item {
id: decorationButton id: decorationButton
z: -1 z: -1
anchors.fill: parent anchors.fill: parent
anchors.margins: PlasmaCore.Units.smallSpacing+((0.3*keySwitcher.height) - 6.8) anchors.topMargin: ma.margin
anchors.bottomMargin: ma.margin
imagePath: Qt.resolvedUrl("svgs/button.svg") imagePath: Qt.resolvedUrl("svgs/button.svg")
visible: ma.containsMouse visible: ma.containsMouse
prefix: { prefix: {