feat: drag launcher to open/close

Also fix dragging for session
This commit is contained in:
2 * r + 2 * t 2025-07-10 13:03:33 +10:00
parent 6eb2164756
commit 938b2f1f71
2 changed files with 11 additions and 1 deletions

View file

@ -5,6 +5,7 @@ JsonObject {
property int maxWallpapers: 9 // Warning: even numbers look bad
property string actionPrefix: ">"
property bool enableDangerousActions: false // Allow actions that can cause losing data, like shutdown, reboot and logout
property int dragThreshold: 50
property JsonObject sizes: JsonObject {
property int itemWidth: 600

View file

@ -81,7 +81,7 @@ MouseArea {
}
// Show/hide session on drag
if (pressed && withinPanelHeight(panels.session, x, y)) {
if (pressed && inRightPanel(panels.session, dragStart.x, dragStart.y) && withinPanelHeight(panels.session, x, y)) {
const dragX = x - dragStart.x;
if (dragX < -Config.session.dragThreshold)
visibilities.session = true;
@ -89,6 +89,15 @@ MouseArea {
visibilities.session = false;
}
// Show/hide launcher on drag
if (pressed && inBottomPanel(panels.launcher, dragStart.x, dragStart.y) && withinPanelWidth(panels.launcher, x, y)) {
const dragY = y - dragStart.y;
if (dragY < -Config.launcher.dragThreshold)
visibilities.launcher = true;
else if (dragY > Config.launcher.dragThreshold)
visibilities.launcher = false;
}
// Show dashboard on hover
const showDashboard = inTopPanel(panels.dashboard, x, y);