sidebar: corner triggers open only when reaching thru vertical edge

This commit is contained in:
end-4
2025-10-29 11:53:12 +01:00
parent f5c421ab99
commit db3d8ddfc2
3 changed files with 43 additions and 18 deletions
@@ -425,10 +425,11 @@ Singleton {
property bool bottom: false
property bool valueScroll: true
property bool clickless: false
property real cornerRegionWidth: 250
property real cornerRegionHeight: 2
property int cornerRegionWidth: 250
property int cornerRegionHeight: 5
property bool visualize: false
property bool clicklessCornerEnd: true
property int clicklessCornerVerticalOffset: 1
}
property JsonObject quickToggles: JsonObject {
@@ -79,10 +79,12 @@ Scope {
implicitWidth: Config.options.sidebar.cornerOpen.cornerRegionWidth
implicitHeight: Config.options.sidebar.cornerOpen.cornerRegionHeight
hoverEnabled: true
onMouseXChanged: {
onPositionChanged: {
if (!Config.options.sidebar.cornerOpen.clicklessCornerEnd) return;
if ((cornerWidget.isRight && mouseArea.mouseX >= mouseArea.width - 2)
|| (cornerWidget.isLeft && mouseArea.mouseX <= 2))
const verticalOffset = Config.options.sidebar.cornerOpen.clicklessCornerVerticalOffset;
const correctX = (cornerWidget.isRight && mouseArea.mouseX >= mouseArea.width - 2) || (cornerWidget.isLeft && mouseArea.mouseX <= 2);
const correctY = (cornerWidget.isTop && mouseArea.mouseY > verticalOffset || cornerWidget.isBottom && mouseArea.mouseY < mouseArea.height - verticalOffset);
if (correctX && correctY)
screenCorners.actionForCorner[cornerPanelWindow.corner]();
}
onEntered: {
@@ -787,22 +787,22 @@ ContentPage {
}
}
}
ConfigSwitch {
buttonIcon: "highlight_mouse_cursor"
text: Translation.tr("Hover to trigger")
checked: Config.options.sidebar.cornerOpen.clickless
onCheckedChanged: {
Config.options.sidebar.cornerOpen.clickless = checked;
}
StyledToolTip {
text: Translation.tr("When this is off you'll have to click")
}
}
Row {
ConfigSwitch {
buttonIcon: "highlight_mouse_cursor"
text: Translation.tr("Hover to trigger")
checked: Config.options.sidebar.cornerOpen.clickless
onCheckedChanged: {
Config.options.sidebar.cornerOpen.clickless = checked;
}
StyledToolTip {
text: Translation.tr("When this is off you'll have to click")
}
}
ConfigSwitch {
enabled: !Config.options.sidebar.cornerOpen.clickless
text: Translation.tr("but force at absolute corner")
text: Translation.tr("Force hover open at absolute corner")
checked: Config.options.sidebar.cornerOpen.clicklessCornerEnd
onCheckedChanged: {
Config.options.sidebar.cornerOpen.clicklessCornerEnd = checked;
@@ -812,7 +812,29 @@ ContentPage {
text: Translation.tr("When the previous option is off and this is on,\nyou can still hover the corner's end to open sidebar,\nand the remaining area can be used for volume/brightness scroll")
}
}
ConfigSpinBox {
icon: "arrow_cool_down"
text: Translation.tr("with vertical offset")
value: Config.options.sidebar.cornerOpen.clicklessCornerVerticalOffset
from: 0
to: 20
stepSize: 1
onValueChanged: {
Config.options.sidebar.cornerOpen.clicklessCornerVerticalOffset = value;
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.NoButton
StyledToolTip {
extraVisibleCondition: mouseArea.containsMouse
text: Translation.tr("Why this is cool:\nFor non-0 values, it won't trigger when you reach the\nscreen corner along the horizontal edge, but it will when\nyou do along the vertical edge")
}
}
}
}
ConfigRow {
uniform: true
ConfigSwitch {