sidebars: open by hovering (or clicking) corners

This commit is contained in:
end-4
2025-08-26 10:51:40 +07:00
parent 63b7a3a36c
commit e7ffd2455a
4 changed files with 123 additions and 10 deletions
@@ -1,3 +1,4 @@
import qs
import qs.modules.common
import qs.modules.common.widgets
import QtQuick
@@ -10,6 +11,12 @@ import Quickshell.Hyprland
Scope {
id: screenCorners
readonly property Toplevel activeWindow: ToplevelManager.activeToplevel
property var actionForCorner: ({
[RoundCorner.CornerEnum.TopLeft]: () => GlobalStates.sidebarLeftOpen = !GlobalStates.sidebarLeftOpen,
[RoundCorner.CornerEnum.BottomLeft]: () => GlobalStates.sidebarLeftOpen = !GlobalStates.sidebarLeftOpen,
[RoundCorner.CornerEnum.TopRight]: () => GlobalStates.sidebarRightOpen = !GlobalStates.sidebarRightOpen,
[RoundCorner.CornerEnum.BottomRight]: () => GlobalStates.sidebarRightOpen = !GlobalStates.sidebarRightOpen
})
component CornerPanelWindow: PanelWindow {
id: cornerPanelWindow
@@ -19,25 +26,55 @@ Scope {
exclusionMode: ExclusionMode.Ignore
mask: Region {
item: null
item: sidebarCornerOpenInteractionLoader.active ? sidebarCornerOpenInteractionLoader : null
}
WlrLayershell.namespace: "quickshell:screenCorners"
WlrLayershell.layer: WlrLayer.Overlay
color: "transparent"
anchors {
top: cornerPanelWindow.corner === RoundCorner.CornerEnum.TopLeft || cornerPanelWindow.corner === RoundCorner.CornerEnum.TopRight
left: cornerPanelWindow.corner === RoundCorner.CornerEnum.TopLeft || cornerPanelWindow.corner === RoundCorner.CornerEnum.BottomLeft
bottom: cornerPanelWindow.corner === RoundCorner.CornerEnum.BottomLeft || cornerPanelWindow.corner === RoundCorner.CornerEnum.BottomRight
right: cornerPanelWindow.corner === RoundCorner.CornerEnum.TopRight || cornerPanelWindow.corner === RoundCorner.CornerEnum.BottomRight
top: cornerWidget.isTopLeft || cornerWidget.isTopRight
left: cornerWidget.isBottomLeft || cornerWidget.isTopLeft
bottom: cornerWidget.isBottomLeft || cornerWidget.isBottomRight
right: cornerWidget.isTopRight || cornerWidget.isBottomRight
}
implicitWidth: cornerWidget.implicitWidth
implicitHeight: cornerWidget.implicitHeight
RoundCorner {
id: cornerWidget
implicitSize: Appearance.rounding.screenRounding
corner: cornerPanelWindow.corner
implicitSize: Appearance.rounding.screenRounding
implicitHeight: Math.max(implicitSize, sidebarCornerOpenInteractionLoader.implicitHeight)
implicitWidth: Math.max(implicitSize, sidebarCornerOpenInteractionLoader.implicitWidth)
Loader {
id: sidebarCornerOpenInteractionLoader
active: !fullscreen && Config.options.sidebar.cornerOpen.enabled
anchors {
top: (cornerWidget.isTopLeft || cornerWidget.isTopRight) ? parent.top : undefined
bottom: (cornerWidget.isBottomLeft || cornerWidget.isBottomRight) ? parent.bottom : undefined
left: (cornerWidget.isTopLeft || cornerWidget.isBottomLeft) ? parent.left : undefined
right: (cornerWidget.isTopRight || cornerWidget.isBottomRight) ? parent.right : undefined
}
sourceComponent: MouseArea {
implicitWidth: Config.options.sidebar.cornerOpen.cornerRegionWidth
implicitHeight: Config.options.sidebar.cornerOpen.cornerRegionHeight
hoverEnabled: Config.options.sidebar.cornerOpen.clickless
onEntered: screenCorners.actionForCorner[cornerPanelWindow.corner]()
Loader {
active: Config.options.sidebar.cornerOpen.visualize
anchors.fill: parent
sourceComponent: Rectangle {
// DEBUG
color: Appearance.colors.colPrimary
}
}
}
}
}
}
@@ -50,8 +87,8 @@ Scope {
property HyprlandMonitor monitor: Hyprland.monitorFor(modelData)
// Hide when fullscreen
property list<HyprlandWorkspace> workspacesForMonitor: Hyprland.workspaces.values.filter(workspace=>workspace.monitor && workspace.monitor.name == monitor.name)
property var activeWorkspaceWithFullscreen: workspacesForMonitor.filter(workspace=>((workspace.toplevels.values.filter(window=>window.wayland.fullscreen)[0] != undefined) && workspace.active))[0]
property list<HyprlandWorkspace> workspacesForMonitor: Hyprland.workspaces.values.filter(workspace => workspace.monitor && workspace.monitor.name == monitor.name)
property var activeWorkspaceWithFullscreen: workspacesForMonitor.filter(workspace => ((workspace.toplevels.values.filter(window => window.wayland.fullscreen)[0] != undefined) && workspace.active))[0]
property bool fullscreen: activeWorkspaceWithFullscreen != undefined
CornerPanelWindow {