session: move to drawers
This commit is contained in:
parent
8ea4362ba1
commit
3fd429c9f3
11 changed files with 135 additions and 187 deletions
14
modules/Shortcuts.qml
Normal file
14
modules/Shortcuts.qml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import "root:/widgets"
|
||||
import "root:/services"
|
||||
import Quickshell
|
||||
|
||||
Scope {
|
||||
CustomShortcut {
|
||||
name: "session"
|
||||
description: "Toggle session menu"
|
||||
onPressed: {
|
||||
const visibilities = Visibilities.getForActive();
|
||||
visibilities.session = !visibilities.session;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ import "root:/services"
|
|||
import "root:/config"
|
||||
import "root:/modules/osd" as Osd
|
||||
import "root:/modules/notifications" as Notifications
|
||||
import "root:/modules/session" as Session
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Shapes
|
||||
|
|
@ -19,8 +20,8 @@ Shape {
|
|||
Osd.Background {
|
||||
wrapper: panels.osd
|
||||
|
||||
startX: root.width
|
||||
startY: (root.height - panels.osd.height) / 2
|
||||
startX: root.width - panels.session.width
|
||||
startY: (root.height - wrapper.height) / 2
|
||||
}
|
||||
|
||||
Notifications.Background {
|
||||
|
|
@ -29,4 +30,11 @@ Shape {
|
|||
startX: root.width
|
||||
startY: 0
|
||||
}
|
||||
|
||||
Session.Background {
|
||||
wrapper: panels.session
|
||||
|
||||
startX: root.width
|
||||
startY: (root.height - wrapper.height) / 2
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import "root:/widgets"
|
|||
import "root:/services"
|
||||
import "root:/config"
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import QtQuick
|
||||
|
||||
Variants {
|
||||
|
|
@ -24,6 +25,7 @@ Variants {
|
|||
screen: scope.modelData
|
||||
name: "drawers"
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
keyboardFocus: visibilities.launcher || visibilities.session ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
||||
|
||||
mask: Region {
|
||||
x: BorderConfig.thickness
|
||||
|
|
@ -77,6 +79,8 @@ Variants {
|
|||
property bool osd
|
||||
property bool notifications: Notifs.popups.length > 0
|
||||
property bool session
|
||||
|
||||
Component.onCompleted: Visibilities.screens[scope.modelData] = this
|
||||
}
|
||||
|
||||
Interactions {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import "root:/config"
|
||||
import "root:/modules/osd" as Osd
|
||||
import "root:/modules/notifications" as Notifications
|
||||
import "root:/modules/session" as Session
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
|
|
@ -12,6 +13,7 @@ Item {
|
|||
|
||||
readonly property Osd.Wrapper osd: osd
|
||||
readonly property Notifications.Wrapper notifications: notifications
|
||||
readonly property Session.Wrapper session: session
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: BorderConfig.thickness
|
||||
|
|
@ -20,19 +22,28 @@ Item {
|
|||
id: osd
|
||||
|
||||
screen: root.screen
|
||||
visibility: visibilities.osd
|
||||
visibility: root.visibilities.osd
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: session.width
|
||||
}
|
||||
|
||||
Notifications.Wrapper {
|
||||
id: notifications
|
||||
|
||||
screen: root.screen
|
||||
visibility: visibilities.notifications
|
||||
visibility: root.visibilities.notifications
|
||||
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
}
|
||||
|
||||
Session.Wrapper {
|
||||
id: session
|
||||
|
||||
visibilities: root.visibilities
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import QtQuick
|
|||
Item {
|
||||
id: root
|
||||
|
||||
required property ShellScreen screen
|
||||
required property bool visibility
|
||||
|
||||
visible: height > 0
|
||||
|
|
|
|||
|
|
@ -3,68 +3,61 @@ import "root:/config"
|
|||
import QtQuick
|
||||
import QtQuick.Shapes
|
||||
|
||||
Shape {
|
||||
ShapePath {
|
||||
id: root
|
||||
|
||||
required property real wrapperWidth
|
||||
required property real wrapperHeight
|
||||
required property Wrapper wrapper
|
||||
readonly property real rounding: BorderConfig.rounding
|
||||
readonly property bool flatten: wrapperWidth < rounding * 2
|
||||
readonly property real roundingX: flatten ? wrapperWidth / 2 : rounding
|
||||
readonly property bool flatten: wrapper.width < rounding * 2
|
||||
readonly property real roundingX: flatten ? wrapper.width / 2 : rounding
|
||||
|
||||
preferredRendererType: Shape.CurveRenderer
|
||||
opacity: Colours.transparency.enabled ? Colours.transparency.base : 1
|
||||
strokeWidth: -1
|
||||
fillColor: BorderConfig.colour
|
||||
|
||||
ShapePath {
|
||||
strokeWidth: -1
|
||||
fillColor: BorderConfig.colour
|
||||
PathArc {
|
||||
relativeX: -root.roundingX
|
||||
relativeY: root.rounding
|
||||
radiusX: Math.min(root.rounding, root.wrapper.width)
|
||||
radiusY: root.rounding
|
||||
}
|
||||
PathLine {
|
||||
relativeX: -(root.wrapper.width - root.roundingX * 2)
|
||||
relativeY: 0
|
||||
}
|
||||
PathArc {
|
||||
relativeX: -root.roundingX
|
||||
relativeY: root.rounding
|
||||
radiusX: Math.min(root.rounding, root.wrapper.width)
|
||||
radiusY: root.rounding
|
||||
direction: PathArc.Counterclockwise
|
||||
}
|
||||
PathLine {
|
||||
relativeX: 0
|
||||
relativeY: root.wrapper.height - root.rounding * 4
|
||||
}
|
||||
PathArc {
|
||||
relativeX: root.roundingX
|
||||
relativeY: root.rounding
|
||||
radiusX: Math.min(root.rounding, root.wrapper.width)
|
||||
radiusY: root.rounding
|
||||
direction: PathArc.Counterclockwise
|
||||
}
|
||||
PathLine {
|
||||
relativeX: root.wrapper.width - root.roundingX * 2
|
||||
relativeY: 0
|
||||
}
|
||||
PathArc {
|
||||
relativeX: root.roundingX
|
||||
relativeY: root.rounding
|
||||
radiusX: Math.min(root.rounding, root.wrapper.width)
|
||||
radiusY: root.rounding
|
||||
}
|
||||
|
||||
startX: root.wrapperWidth - 1
|
||||
|
||||
PathArc {
|
||||
relativeX: -root.roundingX
|
||||
relativeY: root.rounding
|
||||
radiusX: Math.min(root.rounding, root.wrapperWidth)
|
||||
radiusY: root.rounding
|
||||
}
|
||||
PathLine {
|
||||
x: root.roundingX
|
||||
relativeY: 0
|
||||
}
|
||||
PathArc {
|
||||
relativeX: -root.roundingX
|
||||
relativeY: root.rounding
|
||||
radiusX: Math.min(root.rounding, root.wrapperWidth)
|
||||
radiusY: root.rounding
|
||||
direction: PathArc.Counterclockwise
|
||||
}
|
||||
PathLine {
|
||||
y: root.wrapperHeight - root.rounding * 2
|
||||
}
|
||||
PathArc {
|
||||
relativeX: root.roundingX
|
||||
relativeY: root.rounding
|
||||
radiusX: Math.min(root.rounding, root.wrapperWidth)
|
||||
radiusY: root.rounding
|
||||
direction: PathArc.Counterclockwise
|
||||
}
|
||||
PathLine {
|
||||
x: (root.flatten ? root.roundingX : root.wrapperWidth - root.rounding) - 1
|
||||
relativeY: 0
|
||||
}
|
||||
PathArc {
|
||||
relativeX: root.roundingX
|
||||
relativeY: root.rounding
|
||||
radiusX: Math.min(root.rounding, root.wrapperWidth)
|
||||
radiusY: root.rounding
|
||||
}
|
||||
|
||||
Behavior on fillColor {
|
||||
ColorAnimation {
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.standard
|
||||
}
|
||||
Behavior on fillColor {
|
||||
ColorAnimation {
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.standard
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import QtQuick
|
|||
Column {
|
||||
id: root
|
||||
|
||||
required property Scope session
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
padding: Appearance.padding.large
|
||||
|
||||
|
|
@ -28,10 +28,10 @@ Column {
|
|||
KeyNavigation.down: shutdown
|
||||
|
||||
Connections {
|
||||
target: session
|
||||
target: root.visibilities
|
||||
|
||||
function onSessionVisibleChanged(): void {
|
||||
if (session.sessionVisible)
|
||||
function onSessionChanged(): void {
|
||||
if (root.visibilities.session)
|
||||
logout.focus = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ Column {
|
|||
|
||||
Keys.onEnterPressed: proc.startDetached()
|
||||
Keys.onReturnPressed: proc.startDetached()
|
||||
Keys.onEscapePressed: root.session.sessionVisible = false
|
||||
Keys.onEscapePressed: root.visibilities.session = false
|
||||
|
||||
Process {
|
||||
id: proc
|
||||
|
|
|
|||
|
|
@ -1,87 +0,0 @@
|
|||
import "root:/widgets"
|
||||
import "root:/services"
|
||||
import "root:/config"
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import QtQuick
|
||||
|
||||
Scope {
|
||||
id: root
|
||||
|
||||
property int winHeight
|
||||
property bool sessionVisible
|
||||
|
||||
// Connections {
|
||||
// target: Drawers
|
||||
|
||||
// function onPosChanged(screen: ShellScreen, x: int, y: int): void {
|
||||
// if (x > screen.width - BorderConfig.thickness && y > (screen.height - root.winHeight) / 2 && y < (screen.height + root.winHeight) / 2)
|
||||
// root.sessionVisible = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
LazyLoader {
|
||||
loading: true
|
||||
|
||||
StyledWindow {
|
||||
id: win
|
||||
|
||||
name: "osd"
|
||||
keyboardFocus: root.sessionVisible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
||||
visible: wrapper.shouldBeVisible
|
||||
|
||||
mask: Region {
|
||||
item: wrapper
|
||||
}
|
||||
|
||||
anchors.left: true
|
||||
anchors.right: true
|
||||
height: wrapper.height
|
||||
|
||||
Component.onCompleted: {
|
||||
root.winHeight = height;
|
||||
Drawers.rightExclusion = Qt.binding(() => bg.width);
|
||||
}
|
||||
|
||||
Background {
|
||||
id: bg
|
||||
|
||||
visible: false
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
|
||||
wrapperWidth: Math.min(wrapper.width, content.width)
|
||||
wrapperHeight: wrapper.height
|
||||
}
|
||||
|
||||
LayerShadow {
|
||||
source: bg
|
||||
}
|
||||
|
||||
Wrapper {
|
||||
id: wrapper
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
|
||||
implicitHeight: content.height + bg.rounding * 2
|
||||
|
||||
sessionVisible: root.sessionVisible
|
||||
contentWidth: content.width
|
||||
|
||||
Content {
|
||||
id: content
|
||||
|
||||
session: root
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CustomShortcut {
|
||||
name: "session"
|
||||
description: "Toggle session menu"
|
||||
onPressed: root.sessionVisible = !root.sessionVisible
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +1,23 @@
|
|||
import "root:/services"
|
||||
import "root:/config"
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property bool sessionVisible
|
||||
required property real contentWidth
|
||||
property bool shouldBeVisible
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
visible: width > 0
|
||||
width: 0
|
||||
implicitWidth: 0
|
||||
implicitHeight: content.height + BorderConfig.rounding * 2
|
||||
|
||||
states: State {
|
||||
name: "visible"
|
||||
when: root.sessionVisible
|
||||
when: root.visibilities.session
|
||||
|
||||
PropertyChanges {
|
||||
root.width: contentWidth
|
||||
root.shouldBeVisible: true
|
||||
root.implicitWidth: content.width
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -26,37 +26,31 @@ Item {
|
|||
from: ""
|
||||
to: "visible"
|
||||
|
||||
SequentialAnimation {
|
||||
PropertyAction {
|
||||
target: root
|
||||
property: "shouldBeVisible"
|
||||
}
|
||||
NumberAnimation {
|
||||
target: root
|
||||
property: "width"
|
||||
duration: Appearance.anim.durations.large
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
||||
}
|
||||
NumberAnimation {
|
||||
target: root
|
||||
property: "implicitWidth"
|
||||
duration: Appearance.anim.durations.large
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
||||
}
|
||||
},
|
||||
Transition {
|
||||
from: "visible"
|
||||
to: ""
|
||||
|
||||
SequentialAnimation {
|
||||
NumberAnimation {
|
||||
target: root
|
||||
property: "width"
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasizedAccel
|
||||
}
|
||||
PropertyAction {
|
||||
target: root
|
||||
property: "shouldBeVisible"
|
||||
}
|
||||
NumberAnimation {
|
||||
target: root
|
||||
property: "implicitWidth"
|
||||
duration: Appearance.anim.durations.normal
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: Appearance.anim.curves.emphasizedAccel
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
Content {
|
||||
id: content
|
||||
|
||||
visibilities: root.visibilities
|
||||
}
|
||||
}
|
||||
|
|
|
|||
11
services/Visibilities.qml
Normal file
11
services/Visibilities.qml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
|
||||
Singleton {
|
||||
property var screens: ({})
|
||||
|
||||
function getForActive(): PersistentProperties {
|
||||
return Object.entries(screens).find(s => s[0].slice(s[0].indexOf('"') + 1, s[0].lastIndexOf('"')) === Hyprland.focusedMonitor.name)[1];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import "modules"
|
||||
import "modules/bar"
|
||||
import "modules/launcher"
|
||||
import "modules/session"
|
||||
import "modules/drawers"
|
||||
import "modules/background"
|
||||
import Quickshell
|
||||
|
|
@ -10,5 +10,6 @@ ShellRoot {
|
|||
Launcher {}
|
||||
Background {}
|
||||
Drawers {}
|
||||
Session {}
|
||||
|
||||
Shortcuts {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue