osd: show on hover
This commit is contained in:
parent
ad7c6ea98e
commit
1656e5c355
5 changed files with 32 additions and 43 deletions
|
|
@ -70,14 +70,24 @@ Variants {
|
|||
source: background
|
||||
}
|
||||
|
||||
Panels {
|
||||
id: panels
|
||||
PersistentProperties {
|
||||
id: visibilities
|
||||
|
||||
screen: scope.modelData
|
||||
property bool launcher
|
||||
property bool osd
|
||||
property bool notifs
|
||||
property bool session
|
||||
}
|
||||
|
||||
Interactions {
|
||||
screen: scope.modelData
|
||||
visibilities: visibilities
|
||||
|
||||
Panels {
|
||||
id: panels
|
||||
|
||||
screen: scope.modelData
|
||||
visibilities: visibilities
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,22 @@
|
|||
import "root:/services"
|
||||
import "root:/config"
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
MouseArea {
|
||||
required property ShellScreen screen
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
property point dragStart
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onPositionChanged: event => Drawers.setPosForScreen(screen, event.x, event.y)
|
||||
|
||||
onPressed: event => dragStart = Qt.point(event.x, event.y)
|
||||
onExited: visibilities.osd = false
|
||||
|
||||
onPositionChanged: ({x, y}) => {
|
||||
// Show osd on hover
|
||||
const osd = panels.osd;
|
||||
visibilities.osd = (x > width - BorderConfig.thickness - osd.width && y >= osd.y && y <= osd.y + osd.height);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import "root:/widgets"
|
||||
import "root:/services"
|
||||
import "root:/config"
|
||||
import "root:/modules/osd" as Osd
|
||||
import Quickshell
|
||||
|
|
@ -9,6 +7,8 @@ Item {
|
|||
id: root
|
||||
|
||||
required property ShellScreen screen
|
||||
required property PersistentProperties visibilities
|
||||
|
||||
readonly property Osd.Wrapper osd: osd
|
||||
|
||||
anchors.fill: parent
|
||||
|
|
@ -18,6 +18,7 @@ Item {
|
|||
id: osd
|
||||
|
||||
screen: root.screen
|
||||
visibility: visibilities.osd
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ Item {
|
|||
id: root
|
||||
|
||||
required property ShellScreen screen
|
||||
required property bool visibility
|
||||
|
||||
visible: width > 0
|
||||
implicitWidth: 0
|
||||
|
|
@ -14,7 +15,7 @@ Item {
|
|||
|
||||
states: State {
|
||||
name: "visible"
|
||||
when: Drawers.visibilities[root.screen].osd
|
||||
when: root.visibility
|
||||
|
||||
PropertyChanges {
|
||||
root.implicitWidth: content.width
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
pragma Singleton
|
||||
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
property var visibilities: Quickshell.screens.reduce((acc, s) => {
|
||||
acc[s] = visibleComp.createObject(root);
|
||||
return acc;
|
||||
}, {})
|
||||
|
||||
property var positions: ({})
|
||||
property int rightExclusion
|
||||
|
||||
signal posChanged(screen: ShellScreen, x: int, y: int)
|
||||
|
||||
function setPosForScreen(screen: ShellScreen, x: int, y: int): void {
|
||||
positions[screen] = Qt.point(x, y);
|
||||
posChanged(screen, x, y);
|
||||
}
|
||||
|
||||
Component {
|
||||
id: visibleComp
|
||||
|
||||
QtObject {
|
||||
property bool launcher
|
||||
property bool osd
|
||||
property bool notifs
|
||||
property bool session
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue