1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-09 00:58:15 +03:00

option to close active window with mid click

--an option to close active window with middle
click from empty areas
This commit is contained in:
Michail Vourlakos 2020-01-18 19:35:46 +02:00
parent 2b8978c2b4
commit 77b66e85e0
5 changed files with 40 additions and 4 deletions

View File

@ -175,6 +175,10 @@
<default>false</default>
<label>Drag and maximize/restore active window from empty areas</label>
</entry>
<entry name="closeActiveWindowEnabled" type="Bool">
<default>false</default>
<label>Close active window from empty areas</label>
</entry>
<entry name="activeWindowFilter" type="Enum">
<choices>
<choice name="InCurrentScreen"/>

View File

@ -36,6 +36,8 @@ Loader {
width: root.isHorizontal ? length : localThickness + root.localScreenEdgeMargin
height: root.isVertical ? length : localThickness + root.localScreenEdgeMargin
acceptedButtons: Qt.LeftButton | Qt.MidButton
readonly property int localThickness: (root.isHovered ? (root.iconSize + root.thickMargins)*root.zoomFactor : (root.iconSize + root.thickMargins))
readonly property int length: {
if (screenEdgeMarginEnabled && plasmoid.configuration.fittsLawIsRequested) {
@ -61,12 +63,18 @@ Loader {
}
}
onClicked: {
if (root.closeActiveWindowEnabled && mouse.button === Qt.MidButton) {
selectedWindowsTracker.lastActiveWindow.requestClose();
}
}
onPressed: {
if (!root.dragActiveWindowEnabled) {
return;
}
if (selectedWindowsTracker.lastActiveWindow.canBeDragged()) {
if (mouse.button == Qt.LeftButton && selectedWindowsTracker.lastActiveWindow.canBeDragged()) {
lastPressX = mouse.x;
lastPressY = mouse.y;
dragWindowTimer.start();

View File

@ -182,7 +182,7 @@ Item{
onYChanged: root.updateEffectsArea();
EnvironmentActions {
active: root.scrollAction !== Latte.Types.ScrollNone || root.dragActiveWindowEnabled
active: root.scrollAction !== Latte.Types.ScrollNone || root.dragActiveWindowEnabled || root.closeActiveWindowEnabled
}
AppletsContainer {

View File

@ -211,6 +211,7 @@ Item {
readonly property bool parabolicEffectEnabled: zoomFactor>1 && !inConfigureAppletsMode
property bool dockIsShownCompletely: !(dockIsHidden || inSlidingIn || inSlidingOut) && !root.editMode
property bool closeActiveWindowEnabled: plasmoid.configuration.closeActiveWindowEnabled
property bool dragActiveWindowEnabled: plasmoid.configuration.dragActiveWindowEnabled
property bool immutable: plasmoid.immutable
property bool inFullJustify: (plasmoid.configuration.panelPosition === Latte.Types.Justify) && (maxLengthPerCentage===100)

View File

@ -583,7 +583,8 @@ PlasmaComponents.Page {
readonly property int maxLabelWidth: Math.max(trackActiveLbl.implicitWidth,
mouseWheelLbl.implicitWidth,
leftBtnLbl.implicitWidth)
leftBtnLbl.implicitWidth,
midBtnLbl.implicitWidth)
LatteComponents.SubHeader {
text: i18n("Active Window")
@ -650,7 +651,29 @@ PlasmaComponents.Page {
}
RowLayout {
Layout.topMargin: units.smallSpacing
PlasmaComponents.Label {
id: midBtnLbl
Layout.minimumWidth: actionsPropertiesColumn.maxLabelWidth
Layout.maximumWidth: actionsPropertiesColumn.maxLabelWidth
text: i18n("Middle Button")
}
PlasmaComponents.Button {
Layout.fillWidth: true
text: i18n("Close Active Window")
checked: plasmoid.configuration.closeActiveWindowEnabled
checkable: true
tooltip: i18n("The user can use middle mouse button to close last active window")
iconName: "window-close"
onClicked: {
plasmoid.configuration.closeActiveWindowEnabled = !plasmoid.configuration.closeActiveWindowEnabled;
}
}
}
RowLayout {
// Layout.topMargin: units.smallSpacing
PlasmaComponents.Label {
id: mouseWheelLbl