Commit 764b072f authored by Nate Graham's avatar Nate Graham
Browse files

Make windowlist app name display configurable

Before Plasma 5.25, this widget's panel button was always just an icon. That
changed in 5.25, so now it also has text when used on a horizontal panel,
where there's space for it. This makes the widget awkward if there are other
widgets adjacent to it, because its width will constantly change based on the
name of the active application, causing other widgets to shift around and
breaking the user's muscle memory. On the other hand, this is fine as long as
the widget has a flexible spacer between it and any other widgets, or if its
adjacent widgets have their own built-in space-filling flexible spacers, as
the Task Manager and Global Menu widgets do.

Because that can't be programmatically determined, and also because users of
horizontal panels may prefer the icons-only version anyway, let's make this
configurable.

This new config option only works when the widget is located on a horizontal
panel, so it automatically disables itself and shows an explanatory message
when it's being used in any other circumstance.

| Config UI when the widget is on a horizontal panel | Config UI when the widget is on a vertical panel | Config UI when the widget is on the Desktop |
| -------------------------------------------------- | ------------------------------------------------ | ------------------------ |
| ![Horizontal_panel](/uploads/a8b6da1269f316dd8eec024ada89b1e6/Horizontal_panel.png) | ![Vertical_panel](/uploads/f079d4e34f67df93e4cdca923c68c29f/Vertical_panel.png) | ![Desktop](/uploads/3aed5d892fe4f8d83cde6a8fddef476c/Desktop.png) |

BUG: 455560
FIXED-IN: 5.26

@cblack @teams/usability @teams/vdg
parent c33ef19d
Pipeline #197196 passed with stage
in 3 minutes and 49 seconds
/*
* SPDX-FileCopyrightText: 2022 Nate Graham <nate@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.0
import org.kde.plasma.configuration 2.0
ConfigModel {
ConfigCategory {
name: i18n("General")
icon: "preferences-desktop-plasma"
source: "ConfigGeneral.qml"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<group name="General">
<entry name="showText" type="Bool">
<label>Whether to show the window title when the applet is used on a horizontal panel</label>
<default>true</default>
</entry>
</group>
</kcfg>
/*
* SPDX-FileCopyrightText: 2022 Nate Graham <nate@kde.org>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.15
import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.13
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.kirigami 2.20 as Kirigami
Item {
property bool cfg_showText: plasmoid.configuration.showText
Kirigami.FormLayout {
anchors.right: parent.right
anchors.left: parent.left
QQC2.CheckBox {
id: showTextCheckbox
enabled: plasmoid.formFactor === PlasmaCore.Types.Horizontal
text: i18n("Show active application's name on Panel button")
// We do manual state handling rather than making cfg_showText an
// alias property because we want to force the checkbox to look
// unchecked when it's disabled, regardless of its actual underlying
// state.
checked: enabled ? cfg_showText : false
onToggled: cfg_showText = checked
}
QQC2.Label {
Layout.fillWidth: true
// Arbitrary maximum length to make it wrap earlier, because long
// unwrapped text is ugly and harder to read.
Layout.maximumWidth: Kirigami.Units.gridUnit * 25
visible: !showTextCheckbox.enabled
text: plasmoid.formFactor === PlasmaCore.Types.Vertical ?
// On a vertical panel
i18n("Only icons can be shown when the Panel is vertical.") :
// On the desktop
i18n("Not applicable when the widget is on the Desktop.")
wrapMode: Text.Wrap
font: Kirigami.Theme.smallFont
}
}
}
......@@ -63,7 +63,7 @@ AbstractButton {
}
PC3.Label {
id: label
visible: plasmoid.formFactor === PlasmaCore.Types.Horizontal
visible: plasmoid.formFactor === PlasmaCore.Types.Horizontal && plasmoid.configuration.showText
text: controlRoot.Kirigami.MnemonicData.richTextLabel
......
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