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:/config"
|
||||||
import "root:/modules/osd" as Osd
|
import "root:/modules/osd" as Osd
|
||||||
import "root:/modules/notifications" as Notifications
|
import "root:/modules/notifications" as Notifications
|
||||||
|
import "root:/modules/session" as Session
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Shapes
|
import QtQuick.Shapes
|
||||||
|
|
@ -19,8 +20,8 @@ Shape {
|
||||||
Osd.Background {
|
Osd.Background {
|
||||||
wrapper: panels.osd
|
wrapper: panels.osd
|
||||||
|
|
||||||
startX: root.width
|
startX: root.width - panels.session.width
|
||||||
startY: (root.height - panels.osd.height) / 2
|
startY: (root.height - wrapper.height) / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Notifications.Background {
|
Notifications.Background {
|
||||||
|
|
@ -29,4 +30,11 @@ Shape {
|
||||||
startX: root.width
|
startX: root.width
|
||||||
startY: 0
|
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:/services"
|
||||||
import "root:/config"
|
import "root:/config"
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
||||||
Variants {
|
Variants {
|
||||||
|
|
@ -24,6 +25,7 @@ Variants {
|
||||||
screen: scope.modelData
|
screen: scope.modelData
|
||||||
name: "drawers"
|
name: "drawers"
|
||||||
exclusionMode: ExclusionMode.Ignore
|
exclusionMode: ExclusionMode.Ignore
|
||||||
|
keyboardFocus: visibilities.launcher || visibilities.session ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
||||||
|
|
||||||
mask: Region {
|
mask: Region {
|
||||||
x: BorderConfig.thickness
|
x: BorderConfig.thickness
|
||||||
|
|
@ -77,6 +79,8 @@ Variants {
|
||||||
property bool osd
|
property bool osd
|
||||||
property bool notifications: Notifs.popups.length > 0
|
property bool notifications: Notifs.popups.length > 0
|
||||||
property bool session
|
property bool session
|
||||||
|
|
||||||
|
Component.onCompleted: Visibilities.screens[scope.modelData] = this
|
||||||
}
|
}
|
||||||
|
|
||||||
Interactions {
|
Interactions {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import "root:/config"
|
import "root:/config"
|
||||||
import "root:/modules/osd" as Osd
|
import "root:/modules/osd" as Osd
|
||||||
import "root:/modules/notifications" as Notifications
|
import "root:/modules/notifications" as Notifications
|
||||||
|
import "root:/modules/session" as Session
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
||||||
|
|
@ -12,6 +13,7 @@ Item {
|
||||||
|
|
||||||
readonly property Osd.Wrapper osd: osd
|
readonly property Osd.Wrapper osd: osd
|
||||||
readonly property Notifications.Wrapper notifications: notifications
|
readonly property Notifications.Wrapper notifications: notifications
|
||||||
|
readonly property Session.Wrapper session: session
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: BorderConfig.thickness
|
anchors.margins: BorderConfig.thickness
|
||||||
|
|
@ -20,19 +22,28 @@ Item {
|
||||||
id: osd
|
id: osd
|
||||||
|
|
||||||
screen: root.screen
|
screen: root.screen
|
||||||
visibility: visibilities.osd
|
visibility: root.visibilities.osd
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: session.width
|
||||||
}
|
}
|
||||||
|
|
||||||
Notifications.Wrapper {
|
Notifications.Wrapper {
|
||||||
id: notifications
|
id: notifications
|
||||||
|
|
||||||
screen: root.screen
|
visibility: root.visibilities.notifications
|
||||||
visibility: visibilities.notifications
|
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.right: parent.right
|
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 {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property ShellScreen screen
|
|
||||||
required property bool visibility
|
required property bool visibility
|
||||||
|
|
||||||
visible: height > 0
|
visible: height > 0
|
||||||
|
|
|
||||||
|
|
@ -3,68 +3,61 @@ import "root:/config"
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Shapes
|
import QtQuick.Shapes
|
||||||
|
|
||||||
Shape {
|
ShapePath {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property real wrapperWidth
|
required property Wrapper wrapper
|
||||||
required property real wrapperHeight
|
|
||||||
readonly property real rounding: BorderConfig.rounding
|
readonly property real rounding: BorderConfig.rounding
|
||||||
readonly property bool flatten: wrapperWidth < rounding * 2
|
readonly property bool flatten: wrapper.width < rounding * 2
|
||||||
readonly property real roundingX: flatten ? wrapperWidth / 2 : rounding
|
readonly property real roundingX: flatten ? wrapper.width / 2 : rounding
|
||||||
|
|
||||||
preferredRendererType: Shape.CurveRenderer
|
strokeWidth: -1
|
||||||
opacity: Colours.transparency.enabled ? Colours.transparency.base : 1
|
fillColor: BorderConfig.colour
|
||||||
|
|
||||||
ShapePath {
|
PathArc {
|
||||||
strokeWidth: -1
|
relativeX: -root.roundingX
|
||||||
fillColor: BorderConfig.colour
|
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
|
Behavior on fillColor {
|
||||||
|
ColorAnimation {
|
||||||
PathArc {
|
duration: Appearance.anim.durations.normal
|
||||||
relativeX: -root.roundingX
|
easing.type: Easing.BezierSpline
|
||||||
relativeY: root.rounding
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import QtQuick
|
||||||
Column {
|
Column {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property Scope session
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
padding: Appearance.padding.large
|
padding: Appearance.padding.large
|
||||||
|
|
||||||
|
|
@ -28,10 +28,10 @@ Column {
|
||||||
KeyNavigation.down: shutdown
|
KeyNavigation.down: shutdown
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: session
|
target: root.visibilities
|
||||||
|
|
||||||
function onSessionVisibleChanged(): void {
|
function onSessionChanged(): void {
|
||||||
if (session.sessionVisible)
|
if (root.visibilities.session)
|
||||||
logout.focus = true;
|
logout.focus = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +92,7 @@ Column {
|
||||||
|
|
||||||
Keys.onEnterPressed: proc.startDetached()
|
Keys.onEnterPressed: proc.startDetached()
|
||||||
Keys.onReturnPressed: proc.startDetached()
|
Keys.onReturnPressed: proc.startDetached()
|
||||||
Keys.onEscapePressed: root.session.sessionVisible = false
|
Keys.onEscapePressed: root.visibilities.session = false
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: proc
|
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 "root:/config"
|
||||||
|
import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property bool sessionVisible
|
required property PersistentProperties visibilities
|
||||||
required property real contentWidth
|
|
||||||
property bool shouldBeVisible
|
|
||||||
|
|
||||||
visible: width > 0
|
visible: width > 0
|
||||||
width: 0
|
implicitWidth: 0
|
||||||
|
implicitHeight: content.height + BorderConfig.rounding * 2
|
||||||
|
|
||||||
states: State {
|
states: State {
|
||||||
name: "visible"
|
name: "visible"
|
||||||
when: root.sessionVisible
|
when: root.visibilities.session
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
root.width: contentWidth
|
root.implicitWidth: content.width
|
||||||
root.shouldBeVisible: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -26,37 +26,31 @@ Item {
|
||||||
from: ""
|
from: ""
|
||||||
to: "visible"
|
to: "visible"
|
||||||
|
|
||||||
SequentialAnimation {
|
NumberAnimation {
|
||||||
PropertyAction {
|
target: root
|
||||||
target: root
|
property: "implicitWidth"
|
||||||
property: "shouldBeVisible"
|
duration: Appearance.anim.durations.large
|
||||||
}
|
easing.type: Easing.BezierSpline
|
||||||
NumberAnimation {
|
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
||||||
target: root
|
|
||||||
property: "width"
|
|
||||||
duration: Appearance.anim.durations.large
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Transition {
|
Transition {
|
||||||
from: "visible"
|
from: "visible"
|
||||||
to: ""
|
to: ""
|
||||||
|
|
||||||
SequentialAnimation {
|
NumberAnimation {
|
||||||
NumberAnimation {
|
target: root
|
||||||
target: root
|
property: "implicitWidth"
|
||||||
property: "width"
|
duration: Appearance.anim.durations.normal
|
||||||
duration: Appearance.anim.durations.normal
|
easing.type: Easing.BezierSpline
|
||||||
easing.type: Easing.BezierSpline
|
easing.bezierCurve: Appearance.anim.curves.emphasizedAccel
|
||||||
easing.bezierCurve: Appearance.anim.curves.emphasizedAccel
|
|
||||||
}
|
|
||||||
PropertyAction {
|
|
||||||
target: root
|
|
||||||
property: "shouldBeVisible"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
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/bar"
|
||||||
import "modules/launcher"
|
import "modules/launcher"
|
||||||
import "modules/session"
|
|
||||||
import "modules/drawers"
|
import "modules/drawers"
|
||||||
import "modules/background"
|
import "modules/background"
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|
@ -10,5 +10,6 @@ ShellRoot {
|
||||||
Launcher {}
|
Launcher {}
|
||||||
Background {}
|
Background {}
|
||||||
Drawers {}
|
Drawers {}
|
||||||
Session {}
|
|
||||||
|
Shortcuts {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue